Moderate users and messages

Chat SDK provides a few ways to moderate users and messages.

Flag users/messages

If a chat user wants to report/flag an offensive behavior to the chat admin, they can:

In each case, users must provide a reason for reporting a message or another user.

Mute users

Admins can block users from posting messages on channels by muting them.

You can set up Access Manager in your app and take the write access away from the muted user. As a result, this user cannot send messages to that channel but can still see messages published by others (read access).

Ban users

Admins can block users from posting nad reading messages on channels by banning them.

You can set up Access Manager in your app and take the read and write access away from the banned user. As a result, this user cannot send messages to that channel and read any messages published by others.

Check user restrictions

Chat SDK provides methods for verifying if a given user is muted or banned on a given channel by checking user restrictions.

In your chat app, you may want to implement a logic that verifies these permissions for users to prevent them from performing some operations in the chat app. For example, you can check if a user is muted before they try to post a message on a channel, or verify if they are banned before they attempt to join a given channel.

It's highly recommended to use both moderation restrictions and Access Manager rules in your app. The permissions schema defined in Access Manager is verified against the moderation restrictions set in the Chat SDK before access is provided. This way, you ensure that an unauthorized person won't perform unauthorized operations on PubNub channels and other users' metadata.

Listen to flagging events

Chat SDK lets you monitor as an admin if anyone reported offensive behavior (user or message) by listening to:

Handle flagging events

Based on the information provided by Chat SDK, you can code your own additional moderation logic. For example, you can integrate your app with third-party services through PubNub Integrations. You can import some of these integrations from within Admin Portal (in the Functions tab) and quickly integrate your app with third-party services to add profanity filtering for messages.

Prevent message spamming

Chat SDK also lets you set the client-side limit (expressed in milliseconds) that states the rate at which messages can be published on a given channel type (you can set different limits for direct, group, and public channels) by configuring the rateLimitPerChannel and rateLimitFactor options when initializing the Chat SDK. This way, you can stop users from spamming on your application.

Read the Configuration document for all the details.

Last updated on