Moderation Integration
To maintain a safe, respectful, and engaging environment for your users, our platform offers a powerful Moderation Integration system. This system allows you to automatically review, filter, and take action on user-generated messages, images, and videos before they are delivered. With Moderation Integration, you can define flexible rules, receive real-time updates, and ensure your app meets community guidelines, legal standards, and brand values without manual intervention.Integrate Moderation
Note: If you’re using CometChat UI Kits or SDKs, you can skip steps 2 & 3.
1
Setup Rules
Define content moderation rules for your app’s messaging system.
2
Configure Moderation Webhook
Set up a webhook to receive real-time moderation events.
3
Integrate & Test Moderation API
Use APIs to send and review flagged messages programmatically.
Key Components of Moderation Integration
Step 1: Set up moderation rules Step 2: Configure a moderation webhook Step 3: Integrate and test the Moderation APISetting Up Moderation Rules
Moderation rules act as filters to ensure that the messages exchanged within your app meet your safety and content guidelines.How It Works
- When a message, image, or video is submitted, it is automatically checked against the moderation rules you’ve configured.
- These rules can detect offensive language, sensitive content, spam, scams, and more.
- Based on your settings, content can be:
- Approved: Delivered to the recipient.
- Disapproved: Blocked and not delivered.
Benefits
- Safety first: Protect your users and brand from harmful or unwanted content.
- Customizable: Fine-tune moderation rules to suit your app’s unique needs.
- Seamless experience: Moderation happens in real time, keeping communication flowing smoothly.
Creating Moderation Rules
CometChat provides a set of default moderation rules designed to cover common use cases such as offensive language, spam, and inappropriate content. You can enable these rules to start moderating messages immediately, without any additional setup.
- Using the CometChat Dashboard — A simple, no-code interface for visually creating and managing moderation rules.

- Using the CometChat API — Programmatically create and manage moderation rules for advanced or automated workflows. See the Create Rule API documentation.
Configuring a Moderation Webhook
To automate your moderation flow and receive updates in real time, configure a moderation webhook. This allows your system to react instantly when a message or media is moderated.How It Works
- Every time content is moderated, a webhook event is triggered and sent to the URL you specify.
- Your application can then take action based on the moderation result.
Prerequisites
- Your webhook URL must be accessible over HTTPS to ensure secure data transmission.
- The URL should be publicly accessible from the internet.
- Ensure your endpoint supports the
HTTP POST
method. Event payloads will be delivered viaPOST
requests in JSON format. - Configure your endpoint to respond immediately to the CometChat server with a
200 OK
response. - For security, set up Basic Authentication (username and password) for server-to-server communication.
Handle Moderation Events
Ensure your webhook endpoint is ready to process moderation events. Refer to the Moderation Events section for the full list. The key events to handle include:moderation_engine_approved
— Triggered when the engine automatically approves content.moderation_engine_blocked
— Triggered when the engine automatically blocks content.moderation_manual_approved
— Triggered when a moderator manually approves previously blocked content.
Application → Webhooks → Create Webhook → Triggers → ModerationSelect all three moderation triggers to ensure your app receives the necessary notifications.

Integrating and Testing the Moderation API
Once your moderation rules and webhook are configured, integrate the Moderation API into your application to programmatically submit content and receive moderation results.Steps to Integrate and Test
- Submit content: Use the API to send messages, images, or videos for moderation.
- Check responses: Verify moderation status in real time.
- Handle outcomes: Apply business logic based on approved, flagged, or disapproved responses.
- End-to-end testing: Test both the API response and webhook delivery to ensure complete coverage.
Send message
This endpoint is used to submit a message for moderation before it is delivered to the recipient. The message is scanned against the moderation rules configured for the app. URL:List messages
Retrieves a list of messages submitted for moderation, along with the current moderation status of each message as determined by your configured rules. URL:Get message
Retrieves the details of a specific message submitted for moderation, including its current moderation status as determined by your configured rules. URL:Update message
Edits an existing message. The moderation status is re-evaluated based on your configured rules. URL:Delete message
Deletes a previously submitted message along with its associated moderation data, in accordance with your configured rules. URL:Approve message
Approves a previously blocked message, allowing it to be delivered to the recipient. URL:Endpoint | Purpose |
---|---|
Send message for moderationPOST /moderation/messages | Submits a new message for moderation. Triggers the engine, emits a webhook, and makes the message available via the get-message endpoint. |
Edit message for moderationPUT /moderation/messages/:id | Re-evaluates an edited message. If approved, the updates are accepted; if blocked, the message is withheld. |
Get message moderation statusGET /moderation/messages/:id | Retrieves the moderation status, rule metadata, and action history of a message. |
List messages for moderationGET /moderation/messages | Lists all moderated messages with optional filters such as category, type, status, and receiver UID/GUID. |
Delete message from moderationDELETE /moderation/messages/:id | Deletes a moderated message. |