Blocklist Management
After adding a user to the blocklist, you will no longer receive any one-to-one chat messages from them.
- Adding to the blocklist is a one-way operation. For example, if User A blocks User B, B cannot send messages to A (error code
405). However, A can still send messages to B, and B will receive them normally. - There is a limit to the total number of users that can be added to a single user's blocklist. For Chat Starter Plan and Chat Pro Plan, the limit is 3,000 users.
- Sending one-to-one chat messages via the server API is not restricted by the blocklist by default. To enable this restriction, set
verifyBlacklistto1when calling the API.
Add to Blocklist
Add a user to the blocklist.
Method
addToBlocklist(
userId: string,
callback: IRCIMIWAddToBlocklistCallback
): Promise<number>;
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| userId | string | User ID |
| callback | IRCIMIWAddToBlocklistCallback | Callback for the API call result. |
Return Value
| Return Value | Description |
|---|---|
| number | Status code of the current API operation. 0 indicates success. The specific result needs to be implemented in the callback. Non-zero values indicate failure, and the callback will not be triggered. Refer to the error codes for details. |
Code Example
const callback = {
onBlocklistAdded: (code: number, userId: string) => {
//...
},
};
let code = await engine.addToBlocklist(userId, callback);
Remove from Blocklist
Remove a user from the blocklist.
Method
removeFromBlocklist(
userId: string,
callback: IRCIMIWRemoveFromBlocklistCallback
): Promise<number>;
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| userId | string | User ID |
| callback | IRCIMIWRemoveFromBlocklistCallback | Callback for the API call result. |
Return Value
| Return Value | Description |
|---|---|
| number | Status code of the current API operation. 0 indicates success. The specific result needs to be implemented in the callback. Non-zero values indicate failure, and the callback will not be triggered. Refer to the error codes for details. |
Code Example
const callback = {
onBlocklistRemoved: (code: number, userId: string) => {
//...
},
};
let code = await engine.removeFromBlocklist(userId, callback);
Check if a User is in the Blocklist
Check if a user is in the blocklist.
Method
getBlocklistStatus(
userId: string,
callback: IRCIMIWGetBlocklistStatusCallback
): Promise<number>;
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| userId | string | User ID |
| callback | IRCIMIWGetBlocklistStatusCallback | Callback for the API call result. |
Return Value
| Return Value | Description |
|---|---|
| number | Status code of the current API operation. 0 indicates success. The specific result needs to be implemented in the callback. Non-zero values indicate failure, and the callback will not be triggered. Refer to the error codes for details. |
Code Example
const callback = {
onSuccess: (t: RCIMIWBlocklistStatus) => {
//...
},
onError: (code: number) => {
//...
},
};
let code = await engine.getBlocklistStatus(userId, callback);
Get Blocklist
Get the current user's blocklist.
Method
getBlocklist(
callback: IRCIMIWGetBlocklistCallback
): Promise<number>;
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| callback | IRCIMIWGetBlocklistCallback | Callback for the API call result. |
Return Value
| Return Value | Description |
|---|---|
| number | Status code of the current API operation. 0 indicates success. The specific result needs to be implemented in the callback. Non-zero values indicate failure, and the callback will not be triggered. Refer to the error codes for details. |
Code Example
const callback = {
onSuccess: (t: Array<string>) => {
//...
},
onError: (code: number) => {
//...
},
};
let code = await engine.getBlocklist(callback);