/ SDKs / JavaScript
SDKs
Chat SDKs JavaScript v4
Chat SDKs JavaScript
Chat SDKs
JavaScript
Version 4

Report a message, user, or channel

Copy link

Users can report suspicious or harassing messages and other users who use abusive language in a channel. They can also report the channel itself if there is any inappropriate content or activity in the channel. Based on this functionality and our report API, you can build your own in-app system for managing objectionable content and subject.

To use report API, you can use getReportCategoryInfoList API to retrieve the list of available report categories. Once the category list is fetched, allow the user to select one of the categories. The selected category can be included as a parameter when invoking report API.

JavaScriptTypeScript
const reportCategoryInfoList = await sb.getReportCategoryInfoList();
// Display Report Category List

const reportCategoryInfo = reportCategoryInfoList[0];

// Report a Message
await channel.reportMessage(message, reportCategoryInfo, description);

// Report a User
await channel.reportUser(offendingUser, reportCategoryInfo, description);

// Report a Channel
await channel.report(reportCategoryInfo, description);

List of arguments

Copy link
ArgumentTypeDescription

message

object

Specifies the message to report for its suspicious, harassing, or inappropriate content.

offendingUser

object

Specifies the user who uses offensive or abusive language such as sending explicit messages or inappropriate comments.

reportCategoryInfo

object

Specifies a report category that indicates the reason for reporting. You can retrieve ReportCategoryInfo through getReportCategoryInfoList(). The default categories are suspicious, harassing, inappropriate, and spam, but if you have enabled Advanced Moderation, you can add custom categories through the Sendbird Dashboard.

description

string

Specifies additional information to include in the report.