Block and unblock other members
A user can block another user if the user doesn't wish to receive any messages or notifications from the blocked user in a 1-to-1 group channel. In a 1-to-N group channel, the user may receive messages from the blocked user, depending on the UI settings of the chat view. In any case, notifications from the blocked user won't be delivered to the 1-to-N group channel. You can also choose whether or not to allow the user to view which users are blocked in the channel UI.
Sendbird application provides two blocking options: including or excluding blocked users when sending invitations, and turning on or off notifications from blocked users. Explicit and classic block modes have been deprecated and are only supported for customers who started using them before they were deprecated.
Including or excluding blocked users when sending invitations: Determines whether or not to automatically filter out blocked users when a user invites a group of users to a new group channel. By default, blocked users are included when sending invitations. The value of this option can be changed by Sendbird if your Sendbird application isn't integrated to the client app. If you want to change the value, contact our sales team.
Turning on or off notifications from blocked users: Determines whether or not to receive message notifications from the blocked user in a specific 1-to-N group channel where they are both members. By default, a user doesn't receive notifications from blocked users. The value of this option can be set to individual channels. If you want to use this option, contact our sales team.
The following table explains what happens to a user's chat experience when the user blocks another user in a 1-to-1 or 1-to-N group channel. In the case of a 1-to-1 group channel, the block mode is only maintained with the original members. If users other than the original members are added, the rules for 1-to-N group channel begin to apply.
Block consequences by channel type
|Channel type||Channel list||Notifications||Messages|
1-to-1 group channel
A user's channel list isn't updated in response to the blocked user's messages.
A user can't receive notifications for the messages from the blocked user.
A user can only see the messages that the blocked user has sent before being blocked. Even though messages sent from the blocked user aren't delivered to the channel, they are saved in the database and only displayed in the blocked user's channel view. This means that the blocked user isn't aware of their blocked status.
1-to-N group channel
A user's channel list is updated in response to a blocked user's message.
By default, a user can't receive message notifications from a blocked user. If the option is turned on, the user can receive message notifications from the blocked user.
All messages from blocked users are delivered to the channel. You can choose whether or not a user can view the messages from the blocked users in the channel UI.
How to use block modes
You can let users block and unblock other users by implementing the following code in your client app.