Skip to main content

Overview

Flagging messages allows users to report inappropriate content to moderators or administrators. When a message is flagged, it appears in the CometChat Dashboard under Moderation > Flagged Messages for review.
Available via: SDK | REST API | Dashboard
For a complete understanding of how flagged messages are reviewed and managed, see the Flagged Messages documentation.

Prerequisites

Before using the flag message feature:
  1. Moderation must be enabled for your app in the CometChat Dashboard
  2. Flag reasons should be configured under Moderation > Advanced Settings

How It Works

Get Flag Reasons

Before flagging a message, retrieve the list of available flag reasons configured in your Dashboard:

Response

The response is a list of FlagReason objects containing:

Flag a Message

To flag a message, use the flagMessage() method with the message ID and a FlagDetail object:

Parameters

On Success — A String message confirming the message has been flagged:

Complete Example

Here’s a complete implementation showing how to build a report message flow:

Next Steps

Receive Messages

Handle incoming messages and real-time events

Delete Message

Remove messages from conversations

AI Moderation

Automate content moderation with AI

Delivery & Read Receipts

Track message delivery and read status