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?
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.