Skip to main content

Report User

Enables your users to report users who use offensive or suspicious messages in the chat.

Image

Extension settings

  1. Login to CometChat and select your app.
  2. Go to the Extensions section and enable the Report user extension.
  3. Open the settings for this extension.
  4. The settings page has the following:
    • Moderation criteria: The max number of reports after which you want to be notified.
    • Moderation actions: Get the list of reports on the configured Webhook URL.
Image

How does it work?

The extension has the following functionalities:

  1. Allowing end-users to report other users.
  2. Allowing admins to login to the Dashboard to take action on the reports.

1. Reporting a user

Users can be reported in either group conversations or one-on-one conversations.

By clicking on the user's avatar, you can show an item in the context menu called "Report". Clicking on the "Report" button should open up a modal asking for the reason.

Here's the description of the parameters that need to be passed to the extension:

ParametersValueDescription
uidStringThe UID of the user that needs to be reported
reasonStringReason for reporting. This should be max 150 characters.
guidStringThe GUID of the group in which the user is being reported.If the user is being reported in a one-on-one conversation, this can be skipped.

Once you have the user to be reported along with the reason, make use of the callExtension method provided by the SDK to submit the report:

CometChat.callExtension('report-user', 'POST', 'v1/report', {
"uid": "superhero3",
"reason": "Misbehaving",
// "guid": "supergroup" // Used only when reporting the user in a group
}).then(response => {
// { success: true }
})
.catch(error => {
// Error occurred
});

2. View reports and take action on a reported user

Image

In order to list and take an action on the reported users:

  1. Open up the Extension's settings page

  2. Click "View Reports" link. This will load all the reports.

  3. Select the criteria from the dropdown:

    1. One-on-one conversations => Lists the users who have been reported in One-on-one conversations.
    2. Group conversations => List the users who have been reported in a Group.
    3. All reports => Lists all the reports.
  4. The following actions can be taken for users reported in Group:

    1. Kick => Reported user is kicked out of the group.
    2. Ban => Reported user is banned from the group.
    3. Ignore => The report is ignored.
  5. The following actions can be take for users reported in one-on-one conversations:

    1. Block => The reported user is blocked on behalf of the reporter.
    2. Ignore => The report is ignored.
  6. To load new reports, click on the Refresh button.