As your chat app grows in user count, it's expected to encounter users who misbehave and share content in undesirable ways. To help you deal with this issue most efficiently, Stream is continually building new moderation tools to help tackle these problems in specific ways.
Stream's newest moderation tool is the shadow ban. Also known as stealth ban, ghost ban, or comment ghosting, it works by allowing the shadow banned user to post content but preventing that content from being seen by other users. It's possible to shadow ban a user on a specific channel or within the entire app.
The shadow ban prevents undesired content from circulating in your chat community without alerting the offender of their banned status. Typically, the shadow banned user will be frustrated by the lack of responses to their offending messages and choose to stop posting rather than look for ways to circumvent the consequences.
Messages that come from shadow banned users will contain the fieldshadowed: true
. However, this field is not available to the message's author. Even using the API directly, the author cannnot detect their shadow ban.
Shadow Banning A User
To shadow ban a user from a specific channel or the whole app, use the following lines of code respectively:
// shadow ban a user from a channel let data = await channel.shadowBan('eviluser'); // shadow ban a user globally (from all channels) let data = await client.shadowBan('eviluser');
Removing The Shadow Ban
To remove the shadow ban from a specific channel or the whole app, use the following lines of code respectively:
// remove shadow ban from channel let data = await channel.removeShadowBan('eviluser'); // remove global shadow ban let data = await client.removeShadowBan('eviluser');
We're happy to bring yet another tool to allow chat apps built with Stream Chat to be safe and pleasant to use. To learn more about all the available moderation tools, including shadow ban, see our documentation on moderation tools, image moderation, and block lists.