Moderate users and messages
Related moderation approaches
Chat SDK provides programmatic muting, banning, and flagging. See also: Auto Moderation (AI-powered), Channel Monitor (manual review), Moderation Overview.
Chat SDK offers multiple approaches for moderating users and messages.
Flag messages
Users can flag a message to report offensive content. A reason is required.
Mute users
- As an admin
- As a user
Admins can mute users to block them from posting. With Access Manager, revoke write access so muted users can read but not send messages.
Access Manager with client-side mute list
When using Access Manager with syncMutedUsers enabled, grant these permissions (replace $currentUserId with the user's ID):
readon channelPN_PRV.$currentUserId.mute1update,delete,getfor userPN_PRV.$currentUserId.mute1
Secret Key required
Mute and ban operations require a Secret Key (from Admin Portal). Use only on secure servers, never expose to clients. If compromised, generate a new key in Admin Portal.
Users can mute others on their client to hide incoming and historical messages (other users still see them).
The mute list holds up to 200 users and persists only for the session by default. Enable persistence to save and retrieve the list across sessions.
Ban users
Admins can ban users to block both posting and reading. With Access Manager, revoke read and write access.
Check user restrictions
Check user restrictions to verify mute or ban status before allowing operations.
Combine moderation restrictions with Access Manager rules for comprehensive protection. Access Manager verifies permissions against moderation restrictions before granting access.
Listen to flagging events
Monitor reported message events as an admin.
Handle flagging events
Add custom moderation logic or integrate with third-party services via PubNub Integrations (import from Admin Portal's Functions tab for profanity filtering and more).
Prevent message spamming
Set client-side rate limits per channel type (direct, group, public) using rateLimitPerChannel and rateLimitFactor during initialization. See Configuration for details.