Skip to main content
Supported types: Text, Image, Video messages only Statuses: PENDINGAPPROVED or DISAPPROVED
AI Moderation automatically reviews messages for inappropriate content in real-time. When a user sends a text, image, or video message, it’s held in a PENDING state while the moderation service analyzes it, then marked as APPROVED or DISAPPROVED via the onMessageModerated event. getModerationStatus() is available on TextMessage and MediaMessage objects. Custom messages are not subject to moderation.
For configuring moderation rules and managing flagged messages from the dashboard, see the Moderation Overview.

Prerequisites

  1. Moderation enabled in the CometChat Dashboard
  2. Moderation rules configured under Moderation > Rules
  3. CometChat SDK version that supports moderation

How It Works

Supported Message Types

Moderation is triggered only for the following message types:

Moderation Status

The getModerationStatus() method returns one of the following values:

Implementation

Step 1: Send a Message and Check Initial Status

When you send a text, image, or video message, check the initial moderation status:

Step 2: Listen for Moderation Results

Register a message listener to receive moderation results in real-time. The onMessageModerated callback receives a BaseMessage object:

Step 3: Handle Disapproved Messages

When a message is disapproved, you should handle it appropriately in your UI:

Complete Example

Here’s a complete implementation showing the full moderation flow:
Always remove listeners when they’re no longer needed (e.g., on component unmount or page navigation). Failing to remove listeners can cause memory leaks and duplicate event handling.

Next Steps

Flag Message

Allow users to report inappropriate messages manually

AI Agents

Build intelligent automated conversations with AI Agents

AI User Copilot

Smart replies, conversation summaries, and more

Send Messages

Send text, media, and custom messages