AI Integration Quick Reference
AI Integration Quick Reference
PENDING → APPROVED or DISAPPROVEDPENDING 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
- Moderation enabled in the CometChat Dashboard
- Moderation rules configured under Moderation > Rules
- CometChat SDK version that supports moderation
How It Works
Supported Message Types
Moderation is triggered only for the following message types:Moderation Status
ThegetModerationStatus() 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:- TypeScript
- JavaScript
Step 2: Listen for Moderation Results
Register a message listener to receive moderation results in real-time. TheonMessageModerated callback receives a BaseMessage object:
- TypeScript
- JavaScript
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:- TypeScript
- JavaScript
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