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.

Retrieve a list of blocked users

You can retrieve a list of all or specific blocked users in your Sendbird application using a BlockedUserListQuery instance. The next() method returns a list of User objects, which contain information about the blocked users.

// Retrieve all blocked users.
const query = sb.createBlockedUserListQuery();
const blockedUsers = await query.next();

With the UserIdsFilter parameter in the BlockedUserListQueryParams instance, you can retrieve a list of the blocked users that match the user IDs in the filter.

const queryParams: BlockedUserListQueryParams = {
  userIdsFilter: ['John', 'Daniel', 'Jeff'],
};
const query = sb.createBlockedUserListQuery(queryParams);

const blockedUsers = await query.next();