Automate Muting and Banning in Real Time with PubNub Illuminate
How to take action on spam and harmful behavior instantly
In our previous two-part blog series, we showed how PubNub Illuminate helps detect and prevent chat flooding and cross-posting spam. Now, we’re taking it a step further. In this blog, we’ll share how you can automatically mute or ban a user within a channel using Illuminate’s Update Membership action.
This action is especially useful if you’ve built your chat app using PubNub’s Chat SDK. By combining Illuminate, Chat SDK, and Channel Monitor, moderators can:
Watch live chat activity across multiple channels
See when automated spam detection triggers an action
Instantly mute or ban users based on predefined rules.
What is Channel Monitor?
Channel Monitor is a companion tool to PubNub’s Chat SDK that provides a real-time preview of live and historical conversations across all channels. It enables moderators to:
View chat activity across multiple channels at once
Identify misbehavior or offensive messages in real time
Take immediate action—either manually or via automated rules
Learn more about Channel Monitor here.
Automating moderation with Illuminate
In addition to automatically detecting spam, Illuminate lets you automate moderation actions, so you don’t need to rely solely on manual intervention. As covered in the previous blogs, you can set threshold values for spam detection. Once a user reaches a spam threshold—or becomes a repeat offender—you can automatically mute or ban them using the Update Membership action in Illuminate.
A quick recap on PubNub Illuminate PubNub Illuminate is a real-time decisioning and analytics solution that lets you automate decisions based on live data—without writing code. For spam detection, it allows you to:
Track message frequency and detect cross-posting spam
Notify moderators in real time when suspicious activity is detected
Take automated actions—such as muting or banning repeat offenders
How to automatically mute or ban users with Illuminate
We’ll build on the chat flooding decision created in the previous blog. If you haven’t set it up yet, follow Steps 1-6 from Part Two before proceeding.
Before we start, deactivate the chat flooding decision you previously created if it’s active.
1. Add channel as another condition
Go to the Spam Detection
Business Object you created previously. Open your existing chat flooding metric and select Channels
as another dimension to group by. The metric now tracks the number of chats a user posts within a channel.
2. Add the mute or ban action
Open your existing chat flooding decision in Illuminate and go to Edit Configuration
. Add another action named Ban User
. Make sure to deactivate the decision if it’s currently active.
3. Configure the user’s ban status within a channel
Select Update Membership
as the action type and enter the following dynamic variables as shown in the picture. Remember, to select available variables, enter a dollar sign $
followed by a left curly bracket {
.
${User ID}
– Automatically references the detected spammer.${Channel}
– Set this at the end of the stringPUBNUB_INTERNAL_MODERATION_${Channel}
Also, add a custom property:
ban
as aBOOLEAN
with a value of true — to ban a user, which is what we’re doing for this example.mute
as aBOOLEAN
with a value of true — to mute a user(Optional) Add a
reason
field for easy reference.
4. Update your decision rule
Your decision rule now has a new action column called Ban User
. You can set it to Yes or No with an action execution limit of once per interval per condition by going to Edit Rules
.
Activate the decision once you finish updating the decision table. This decision automatically triggers a user ban, which you can check in Channel Monitor. Moderators can then:
Review and confirm the mute/ban
Override the action if necessary (e.g., if the rule caught a false positive)
Adjust thresholds in Illuminate to fine-tune the automation.
Keep chat safe and spam-free—automatically
With Illuminate and Channel Monitor, you can automate chat moderation in real time. You no longer need to rely solely on manual intervention—set up rules once and let the system handle spam and bad actors.
Ready to try it out? Set up automated moderation with Illuminate today!