Report User
Enables your users to report users who use offensive or suspicious messages in the chat.
![Image](/docs/assets/images/bv16zxdct5sye4ojb5y5d9g1693yancs4ikajattzlhkx7uo1y039q6odasw4su9-7ccd6ecc13fbcf9831cc9f3781cf957a.jpeg)
Extension settings
- Login to CometChat and select your app.
- Go to the Extensions section and enable the Report user extension.
- Open the settings for this extension.
- 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](/docs/assets/images/bisa63v9ec1r6wz4gxvp0zaub5j4vkuqxd2uucyvkl3oaeat4sofyg2pw4991gcx-8be36110c470fe10c2059d807fdcaf6b.png)
How does it work?
The extension has the following functionalities:
- Allowing end-users to report other users.
- 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:
Parameters | Value | Description |
---|---|---|
uid | String | The UID of the user that needs to be reported |
reason | String | Reason for reporting. This should be max 150 characters. |
guid | String | The 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:
- Javascript
- Java
- Swift
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
});
import org.json.simple.JSONObject;
JSONObject body=new JSONObject();
body.put("uid", "superhero3");
body.put("reason", "Misbehaving");
// body.put("guid", "supergroup"); // Used only when reporting the user in a group
CometChat.callExtension("report-user", "POST", "/v1/report", body,
new CometChat.CallbackListener < JSONObject > () {
@Override
public void onSuccess(JSONObject jsonObject) {
//On Success
}
@Override
public void onError(CometChatException e) {
//On Failure
}
});
CometChat.callExtension(slug: "report-user", type: .post, endPoint: "v1/report", body: [
"uid": "superhero3",
"reason":"Misbehaving",
"guid":"supergroup" // Used only when reporting the user in a group
] as [String : Any], onSuccess: { (response) in
// Success
}) { (error) in
// Error occured
}
2. View reports and take action on a reported user
![Image](/docs/assets/images/g3ulxivvcaosqyghj1seogu0sp39qpmh2nzs1s2gl9wclo34ekna2k5je6k9phc2-4362b1f4c9b6d7438639ccd13bd01530.jpg)
In order to list and take an action on the reported users:
-
Open up the Extension's settings page
-
Click "View Reports" link. This will load all the reports.
-
Select the criteria from the dropdown:
- One-on-one conversations => Lists the users who have been reported in One-on-one conversations.
- Group conversations => List the users who have been reported in a Group.
- All reports => Lists all the reports.
-
The following actions can be taken for users reported in Group:
- Kick => Reported user is kicked out of the group.
- Ban => Reported user is banned from the group.
- Ignore => The report is ignored.
-
The following actions can be take for users reported in one-on-one conversations:
- Block => The reported user is blocked on behalf of the reporter.
- Ignore => The report is ignored.
-
To load new reports, click on the Refresh button.