The content moderation sample utilizes the Sendbird Platform SDK to ban a user from a group channel if the message sent is considered to be toxic. The Perspective API analyzes message and returns a decimal score between 0 and 1 ranking how toxic the message is. A webhook is used Express and Ngrok to connect to the Sendbird server and receieve a request each time a message is sent in an applications group channel.
This section shows you the prerequisites you need to set up the Content Moderation Sample for Javascript. If you have any comments or questions regarding bugs and feature requests, visit Sendbird community.
The minimum requirements for Calls SDK for Javascript sample are:
- Node
- npm (or yarn)
- Modern browser, supporting WebRTC APIs.
This section gives you information you need to get started with the Content Moderation Sample.
-
Use
NodeJSfor your local server: Download and installNodeJSif your system doesn't have it yet. -
Install
ExpressJS,GoogleApis,Ngrok, andPerspective Api Client. -
Install the Sendbird Platform SDK for local development.
- Login or Sign-up for an account on Sendbird Dashboard.
- Create or select an application on the dashboard.
- Note your Sendbird application ID for future reference.
- On the Sendbird dashboard, navigate to the Settings menu. Under Chat, go to Features to enable Webhooks.
- Go to Settings, under Chat click Webhooks. In Events, select the event that you want to subscribe to. For this sample, click Group Channel and select 'group_channel:message_send' to subscribe to the event where a user sends a message.
- In Settings under Chat in Webhooks, ensure that the webhook URL is set once Ngrok is installed and running. The Ngrok URL that is generated along with the post method path used in the application will be the webhook URL you want to use to recieve webhook events from the Sendbird server.
- On the Sendbird dashboard, navigate to the Users menu.
- Create a new user
- On the Sendbird dashboard, navigate to the Group Channels menu.
- Create a new group channel
Now that there is a user and a group channel, send a message through the dashboard to test the sample as walk through it.