Skip to main content

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, which depends on the pricing plan. The limit is 3,000 users for the Chat Premium Plan and Chat Ultimate Plan. For other plans, please refer to the Service Limits section in the Feature Comparison Table.
  • Sending one-to-one chat messages via the server API is not restricted by the blocklist by default. To enable this restriction, set verifyBlacklist to 1 when calling the API.

Add to Blocklist

Add a user to the blocklist.

Method


addToBlocklist(
userId: string,
callback: IRCIMIWAddToBlocklistCallback
): Promise<number>;

Parameter Description

ParameterTypeDescription
userIdstringUser ID
callbackIRCIMIWAddToBlocklistCallbackCallback for the API call result.

Return Value

Return ValueDescription
numberStatus 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

ParameterTypeDescription
userIdstringUser ID
callbackIRCIMIWRemoveFromBlocklistCallbackCallback for the API call result.

Return Value

Return ValueDescription
numberStatus 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

ParameterTypeDescription
userIdstringUser ID
callbackIRCIMIWGetBlocklistStatusCallbackCallback for the API call result.

Return Value

Return ValueDescription
numberStatus 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

ParameterTypeDescription
callbackIRCIMIWGetBlocklistCallbackCallback for the API call result.

Return Value

Return ValueDescription
numberStatus 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);