PubNub Integration

Chat Message Profanity Filter

In-app chat

In-app chat

Last Updated:

2019/04/30

Author:

Nishith Agarwal

Profanity Filter Block lets you run realtime moderation on chat messages

The Profanity Filter Block lets you run realtime moderation on chat messages as they go over the PubNub Data Stream Network. The block detects bad words, swear words, and profanity in any given text, and lets you censor the content in a variety of different ways. Whenever a user publishes messages, the block processes the text for profanity, and either blocks the publishing of the post, or sensors the specific words.

Walkthrough

Profanity Filter Block is triggered before a message is published on a channel. It checks the contents of the message against a dictionary of swear words and allows you to either replace a part of the text with special characters or completely block the message.

After a certain number of violations, you can also block the user's IP address entirely by keeping track of sender details and checking against violations on each publish.

Set the channel to * in the Functions editor to moderate chat messages on all channels across your app's key set.

Input

Publish a message text on any channel. Include profanity in the text and see the output message with the profanity filtered.

{
    "text": "profanity message here"
}

Output

{
    "text": "**** message here"
}

Feedback & Support

Need help? Contact PubNub Support.


Talk to an expert

Contact Sales