Moderation

Block a user

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.

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 with 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.

https://sendbird.com/docs/chat/platform-api/v3/moderation/blocking-users/block-users#1-block-users

post/v3/users/{user_id}/block

Request

  • Base URL
    https://api-APP_ID.sendbird.com
  • Auth
    none declared

Path parameters

user_idstring required

(Required)

Headers

api-tokenstring
Example:{{API_TOKEN}}

Request body

target_idstring
user_idsstring[]

Specifies an array of IDs of all the users to block. This property can be used interchangeably with the users[] property when blocking multiple users at once.

Response

Successful response

nextstring

Example response

{
  "next": "next",
  "users": [
    {
      "metadata": "{}",
      "is_active": true,
      "preferred_languages": [
        "preferred_languages",
        "preferred_languages"
      ],
      "require_auth_for_profile_image": true,
      "unread_channel_count": 6,
      "discovery_keys": [
        "discovery_keys",
        "discovery_keys"
      ],
      "profile_url": "profile_url",
      "is_created": true,
      "created_at": 9,
      "has_ever_logged_in": true,
      "locale": "locale",
      "unread_message_count": 8,
      "access_token": "access_token",
      "is_shadow_blocked": true,
      "user_id": "user_id",
      "nickname": "nickname",
      "phone_number": "phone_number",
      "is_online": true,
      "state": "",
      "is_hide_me_from_friends": true,
      "last_seen_at": 9
    },
    {
      "metadata": "{}",
      "is_active": true,
      "preferred_languages": [
        "preferred_languages",
        "preferred_languages"
      ],
      "require_auth_for_profile_image": true,
      "unread_channel_count": 6,
      "discovery_keys": [
        "discovery_keys",
        "discovery_keys"
      ],
      "profile_url": "profile_url",
      "is_created": true,
      "created_at": 9,
      "has_ever_logged_in": true,
      "locale": "locale",
      "unread_message_count": 8,
      "access_token": "access_token",
      "is_shadow_blocked": true,
      "user_id": "user_id",
      "nickname": "nickname",
      "phone_number": "phone_number",
      "is_online": true,
      "state": "",
      "is_hide_me_from_friends": true,
      "last_seen_at": 9
    }
  ]
}

Changes

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • breaking

      the response property // became nullable for the status

    • warning

      removed the optional property // from the response with the status

    • info

      the response's property default value was added for the status

    • breaking

      the response property / became nullable for the status

    • breaking

      the / response's property type changed from string to object for status

    • warning

      deleted the header request parameter Api-Token

    • warning

      removed the request property

    • warning

      removed the request property

    • info

      api operation id blockUser removed and replaced with blockAUser

    • info

      added the new optional header request parameter api-token

    • info

      the request property became optional

    • info

      the request property became optional

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the required property // to the response with the status