Block / Unblock

1. Get Blocked Users

Use pagination to retrieve the next page of blocked users.

const resp = await client.getBlockedUsers({}); // paginated

if resp.hasNext {
    const lastUserId = resp.users[resp.users.length - 1].id;
   
    // get the next page
    const moreResp = await client.getBlockedUsers({lastUserId: lastUserId});
}

Response

{
  "users": [
    {
      "id": "user456",
      "username": "user456"
      "profileImageUrl": "http://cnd.test.com/123.jpg",
      "updatedAt": 1603245523729,
      "createdAt": 1603244410844
    }
  ],
  "hasNext": false // check for pagination
}

2. Block / Unblock Users

You can block or unblock users.

// block
await client.blockUser({userId: 'bad_user'});

// unblock
await client.unblockUser({userId: 'another_user'});

Please refer to the following limitations:

Whether I can add someone whom I’ve blocked to a channel that I own

X

Whether someone whom I’ve blocked can join a channel that I own

X

Whether someone whom I’ve blocked can be added as a member to a channel that I am a member of

O

Whether someone whom I’ve blocked can join a channel that I am a member of

O

Whether I can be added as a member to a channel that is owned by someone I’ve blocked

X

Whether I can join a channel that is owned by someone I’ve blocked

X

Whether I can be added as a member to a channel where someone I’ve blocked is a member of

O

Whether I can join a channel where someone I’ve blocked is a member of

O

Last updated