Flagging messages allows users to report inappropriate content to moderators or administrators. CometChat provides methods to flag messages with specific reasons and retrieve available flag reasons configured in your dashboard.Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-docs-flutter-sdk-mark-as-unread.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Flag a Message
In other words, as a user, how do I report a message? To flag a message, you can use theflagMessage() method. This method takes the message ID and a payload containing an optional reason ID and remark.
- Swift
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | long | Yes | The ID of the message to be flagged |
| flagDetail | FlagDetail | Yes | Contains flagging details |
| flagDetail.setReasonId | String | Yes | ID of the flag reason (from getFlagReasons) |
| flagDetail.setRemark | String | No | Additional context or explanation |
Response
On successful flagging, you’ll receive a response object:Get Flag Reasons
In other words, what are the available reasons for flagging a message? Before flagging a message, you can retrieve the list of available flag reasons using thegetFlagReasons() method. These reasons are configured in the CometChat Dashboard.
- Swift