Chat / JavaScript
Chat JavaScript v4
Chat JavaScript
Chat
JavaScript
Home
/
Chat
/
JavaScript
/
User
This is the new Docs for Chat SDK v4 for JavaScript. To see the previous Docs, click here.

Block and unblock other members

Members of a group channel can block and unblock each other to stop receiving messages and message notifications in 1-to-1 and 1-to-N group chats. When a member is blocked, they won't be notified of their blocked status and can still send messages to the channel. Also, the blocked member can't see any messages from the user who blocked them in the channel. You can choose whether or not users can view which users they have blocked in the channel UI.

Sendbird application provides two blocking options: exclude blocked users when sending invitations and turn off push notifications from blocked users. The previous block modes are now deprecated and only available for customers who started using them before.

  • Exclude 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. To change the value, contact our sales team for support.

  • Turn 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 individually per channel. To use this option, contact our sales team for support.

1-to-1 group channel

Channel listNotificationsMessages

A user's channel list isn't updated in response to the blocked user's messages.

A user isn't notified that the blocked user sent a message.

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. The blocked user isn't aware of their blocked status.

* If the blocked user is unblocked, a user can see all the messages except those that were sent during the blocking period.

1-to-N group channel

Channel listNotificationsMessages

A user's channel list is updated in response to a blocked user's message.

By default, a user won't receive message notifications from a blocked user. If the option is turned on, the user will 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 UI of the channel.

You can allow a users to block and unblock other members by implementing the following code to the client app.

const user = await sb.blockUser(USER);

Note: You can also use blockUserWithUserId() and unblockUserWithUserId() as they have the same functionalities. See our API reference for more information.