Moderate users and messages

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

Flag messages

If a chat user wants to report/flag an offensive behavior to the chat admin, they can flag a message. You must provide a reason for reporting a given message.

Mute users

Regular Swift Chat SDK users can mute users on their clients.

A user who muted another on their client won't be able to see any incoming or historical messages from the muted user. Other chat users will still be able to see their messages.

The user IDs that a given chat user wants to hide messages from (mute them) are saved to a list. This mute list can hold up to 200 users and, by default, is only persisted for the duration of the user session. A local mute list can be saved and retrieved during initialization, effectively persisting the mute list.

Mute list and Access Manager

If you use Access Manager within your chat app and users use the client-side mute list functionality with the syncMutedUsers parameter enabled, you must grant the Swift Chat SDK user the following permissions:

  • read permission to the PN_PRV.$currentUserId.mute1 channel.
  • update, delete, and get permissions for the PN_PRV.$currentUserId.mute1 user.

Make sure to change $currentUserId to the user ID of the chat user that will use the mute list functionality.

Listen to flagging events

Chat SDK lets you monitor as an admin if anyone reported an offensive message by listening to reported message events.

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 seconds) 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