CometChat allows you to integrate your own moderation logic using a Custom API. With this feature, you can define a webhook URL in the List Configuration, where CometChat will send messages for moderation along with relevant context from the conversation (if provided in settings).
When a user sends a message, CometChat retrieves the webhook URL from the configured List.
The message, along with previous conversation messages (if a context window is set in settings), is sent to the webhook.
The webhook (your external API) processes the data using your custom moderation logic.
The webhook responds with a structured decision containing details about the moderation outcome.
CometChat processes the response and applies the moderation decision in real-time.
This approach gives you complete control over moderation, allowing you to implement custom filtering, AI-based analysis, or any other logic on your own servers.
The webhook should return a response in the following format:
Copy
Ask AI
{ isMatchingCondition: true, // True if the message violates the rule confidence: 0.95, // Confidence score of the decision reason: "Contains hate speech" // Reason for flagging}