Block users
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 can still receive messages from the blocked user, but this depends 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 choose whether or not the user can view which users are blocked in the channel UI.
Block modes
Sendbird application provides two blocking options: include or exclude blocked users when sending invitations, and turn 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.
-
Include or 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. If you want to change the value, contact our sales team.
-
Turn 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 individually per channel. If you want to use this option, contact our sales team.
Note: To learn more about other available moderation tools, see Moderation Overview.
The following tables explain 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 other than the original members are added, the rules for 1-to-N group channel begin to apply.
1-to-1 group channel
Channel list | Notifications | Messages |
---|---|---|
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. |
1-to-N group channel
Channel list | Notifications | Messages |
---|---|---|
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. |
HTTP request
Parameters
The following table lists a parameter that this action supports.
Required
Parameter name | Type | Description |
---|---|---|
user_id | string | Specifies the unique ID of the user. |
Request body
The following table lists the properties of an HTTP request that this action supports.
Optional
Property name | Type | Description |
---|---|---|
target_id | string | Specifies the ID of the user to be blocked. |
user_ids[] | array of strings | Specifies an array of IDs of all the users to block. This property can be used interchangeably with the |
users[] | array of objects | Specifies an array of IDs of all users to block. This property can be used interchangeably with the |
Responses
If successful, this action returns the blocked user resource in the response body.
Error
In the case of an error, an error object like below is returned. See the error codes section for more details.