Bulk email without duplicates

AI-generated summary

In a discussion titled “Bulk email without duplicates” under the Support category, EMHmark7 seeks a way to send announcement emails to users who have selected multiple overlapping groups or subcategories — without sending duplicate messages. jahan_gagan advises exporting user lists, merging and deduplicating them, then using an external email processor — the most reliable method. EMHmark7 asks about automation via Discourse’s API and Python, to which jahan_gagan confirms the API supports user/group/category queries, event monitoring via webhooks or polling, and recommends a custom Discourse plugin for real-time, integrated workflows. EMHmark7 inquires about plugin deployment on hosted Discourse instances, to which NateDhaliwal replies that unofficial plugins typically require Enterprise or self-hosting. jahan_gagan clarifies plugins can generate dynamic lists, export data, or push updates to external services — eliminating the need for polling. tobiaseigen suggests alternatives: using Discourse’s built-in category watching features or PMs to groups (which avoid duplicates), or integrating with WordPress via wp-discourse for mailing list functionality — hinting that a dedicated mailing list tool might better suit the use case than Discourse alone.

Imagine a member has selected groups and sub-categories he is interested in.

I want to send an announcement to those who selected either of those groups and sub-categories.

Example: In a city made of the global main city, several boroughs and matters.
I would also have groups that are borough-matter specific.

The user can select:

  • A specific matter (Which as a general group),
  • A group in his borough for this matter,
  • A group in two other borough for this matter,
  • A second specific matter (Which as a general group),
  • All groups in all boroughs for this matter,
  • The main group for the main city;

If I wish to send an email to one or more groups or subcategories in these groups, some users might end up receiving more than one email of the same announcement, especially if the person selected the main city group that would forward the info from all boroughs and matters, plus some subgroups, etc.

The question: How can I prepare a mailing touching more than one targeted group and sub-categories list, duplicate-free, and send that message?

  1. Do I need to use an external script?

  2. Do I need an external email processor?

Thanks

Marc

If you require guaranteed duplicate-free delivery across arbitrary sets of groups and categories, you must:

  • Export user lists from the targeted groups or categories.
  • Merge and deduplicate these lists, either manually or using a script.
  • Use an external email processor to send the message to the deduplicated list.

This is the most robust way to ensure that users don’t receive the same announcement multiple times.

Thanks, Do you know if we can automate that, such as requesting the API to receive messages for each new member registration/withdraw or group/category selection, and receive only the new changes OR (less good) the whole list with their group/category, that can be requested by a Python program?

(I can manage to code Python). The question is more about automating communication between Discourse and Python AND Python and Mailing processor.

Discourse provides a robust REST API that allows you to:

  • List all users, groups, and user-group memberships
  • Monitor new user registrations and group join/leave actions (via polling or webhooks)
  • Retrieve category membership configurations

You can query either the full list or attempt to track recent changes. For full incremental change detection, you may need to implement time-based checks and manage differences locally. Authentication is handled through HTTP headers (Api-Key, Api-Username).

However, for more efficient and integrated control, I recommend creating a custom Discourse plugin. A plugin runs inside the Discourse server environment and provides direct access to Discourse internals, such as:

  • User, group, and category membership updates
  • Lifecycle event hooks for registrations and group changes
  • Direct access to Discourse’s internal APIs and database

This approach gives you real-time capabilities and greater flexibility for implementing automated workflows like mail handling or user segmentation.

  1. Can we create a plugin that will work on our instance even if it is hosted by Discourse, or we need to host it?

  2. Then, for emailing, do I need to export the list created by the plugin?

  3. What would a plugin do? Can I create a kind of long list from within the Discourse server? Or the idea is to send info to another server?

Thanks

If it’s an unofficial plugin, I think you can only install it on the Enterprise plan, otherwise you’ll have to self-host it.

  • Generate dynamic lists (user/group/category data) and display or store them within Discourse.
  • Export data to a file, or create downloadable admin reports.
  • Make HTTP(S) requests to another server (e.g., push user list updates to your Python/email tool).
  • Trigger webhooks, schedule tasks, or integrate directly with external APIs—all from inside Discourse, with no polling required.

@EMHmark7 did you end up figuring out how you want to get this working?

In Discourse, one way to get at what you want is to create categories and to let members in the community “subscribe” to those categories by choosing the “watching” notification level. The Default categories watching or Default categories watching first post are handy for having an announcements category on your site, to reach out to everyone on your site.

I believe there are ways to manage the above based on group membership or some other criteria but I haven’t done it myself in a while - maybe somebody else has a recipe they can share.

Another approach is to PM the groups directly - if you send a PM to a handful of groups and the same member is in multiple groups there will not be any duplication.

But it does sound to me like you might be looking for a different tool, if what you want is not a forum or community that people log into to participate in discussions but rather a bunch of mailing lists that sends out email.

All of this can live in code outside Discourse, so you don’t have to install it. If you are using WordPress then you can get a bunch of this for free using GitHub - discourse/wp-discourse: WordPress plugin that lets you use Discourse as the community engine for a WordPress blog · GitHub, and then use another WordPress plugin to handle the mailing list part.