How to integrate a third-party moderation service with Discourse?

AI-generated summary

The discussion addresses integrating a third-party moderation service with Discourse. KnorJador asks if this is officially supported, can be done via the REST API, and what the best practices are for retrieving pending posts and submitting decisions.

awesomerobot explains that while not a dedicated feature, all review queue actions are available via the API. The recommended approach involves creating a dedicated user with moderation permissions and an API key. To retrieve pending items, one can poll /review.json or use webhooks like reviewable_created. Decisions are submitted using PUT /review/:id/perform/:action_id?version=N, where the version parameter prevents conflicts. For capturing every post (not just those in the review queue), post webhooks (post_created/post_edited) are necessary. Existing first-party plugins like Discourse Akismet and Discourse AI serve as useful examples of external integrations. Additionally, Editor0732 suggests referencing the discourse-moderation-api plugin as a potential starting point.

Hi everyone,

We are looking to integrate an external third-party moderation service with our Discourse forum.

The goal is to allow an external moderation provider to retrieve posts pending moderation, review them through its own platform, and send moderation decisions (approve, reject, or flag) back to Discourse.

I would like to know:

  • Does Discourse officially support this type of external moderation workflow?

  • Can this integration be implemented entirely through the Discourse REST API?

  • Is there a recommended way to retrieve pending posts and submit moderation decisions programmatically?

  • Are there any existing plugins, integrations, or best practices for connecting Discourse to third-party moderation platforms?

Ideally, we would like to keep Discourse as the main discussion platform while delegating moderation operations to an external provider.

Any guidance or examples of similar implementations would be greatly appreciated.

Thanks in advance!

Not as a dedicated feature, but everything in our review queue goes through our API so anything a human can do in /review is doable via the API. So you can create a dedicated user with moderation permissions for your integration, and generate an API key for that user.

Yes, but there are lots of variations in the details. The review queue only sees posts if they’re pending (based on site/category/user settings) or flagged by a user. If you need every post to go through your system you’d need to use the post webhooks like post_created/post_edited.

You can poll /review.json or use webhooks like reviewable_created/reviewable_updated. You can fetch individual items with /review/:id.json — this will include the actions available and current version.

To send an action back you can use PUT /review/:id/perform/:action_id?version=N. The version is required so you don’t create conflicts if the item has changed post fetch.

If you want to figure out how to execute a specific action, you can reverse engineer it by doing it in your browser via the Discourse UI and copying the request from the network tab, check out Reverse engineer the Discourse API

Discourse Akismet (probably closest example) and Discourse AI are both first-party plugins that can reach out to third parties as part of a flagging process. These might be useful to look at.

Also out of curiosity, which service are you looking to integrate?

moderation-api/discourse-moderation-api
You can refer to this plugin and use AI to make some modifications