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 a user 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 the blocklist, which depends on the pricing plan. The Chat Premium Plan and Chat Ultimate Plan have a limit of 3000 users. For other plans, refer to the Service Limits section in the Feature Comparison Table.
  • By default, one-to-one messages sent via the server API are not restricted by the blocklist. To enable this restriction, set verifyBlacklist to 1 when calling the API.

Add to Blocklist

Add a user to the blocklist.

Method

Future<int> addToBlacklist(String userId, {IRCIMIWAddToBlacklistCallback? callback});

Parameter Description

ParameterTypeDescription
userIdStringUser ID
callbackIRCIMIWAddToBlacklistCallbackEvent callback. SDK supports callback method starting from version 5.3.1. Other callback methods are deprecated as of version 5.4.0. If the callback parameter is provided, only the callback will be triggered.

Return Value

Return ValueDescription
Future<int>Status code of the current operation. 0 indicates success. The specific result requires implementing the interface callback. Non-zero indicates the current operation failed, and the interface callback will not be triggered. Refer to the error codes for details.

Callback Method

  • onBlacklistAdded
Function(int? code, String? userId)? onBlacklistAdded;

Parameter Description

ParameterTypeDescription
codeintStatus code of the callback. 0 indicates success, non-zero indicates an exception.
userIdStringUser ID

Code Example

engine?.onBlacklistAdded = (int? code, String? userId) {
//...
};

Remove from Blocklist

Remove a user from the blocklist.

Method

Future<int> removeFromBlacklist(String userId, {IRCIMIWRemoveFromBlacklistCallback? callback});

Parameter Description

ParameterTypeDescription
userIdStringUser ID
callbackIRCIMIWRemoveFromBlacklistCallbackEvent callback. SDK supports callback method starting from version 5.3.1. Other callback methods are deprecated as of version 5.4.0. If the callback parameter is provided, only the callback will be triggered.

Return Value

Return ValueDescription
Future<int>Status code of the current operation. 0 indicates success. The specific result requires implementing the interface callback. Non-zero indicates the current operation failed, and the interface callback will not be triggered. Refer to the error codes for details.

Callback Method

  • onBlacklistRemoved
Function(int? code, String? userId)? onBlacklistRemoved;

Parameter Description

ParameterTypeDescription
codeintStatus code of the callback. 0 indicates success, non-zero indicates an exception.
userIdStringUser ID

Code Example

engine?.onBlacklistRemoved = (int? code, String? userId) {
//...
};

Check if User is in Blocklist

Check if a user is in the blocklist.

Method

Future<int> getBlacklistStatus(String userId, {IRCIMIWGetBlacklistStatusCallback? callback});

Parameter Description

ParameterTypeDescription
userIdStringUser ID
callbackIRCIMIWGetBlacklistStatusCallbackEvent callback. SDK supports callback method starting from version 5.3.1. Other callback methods are deprecated as of version 5.4.0. If the callback parameter is provided, only the callback will be triggered.

Return Value

Return ValueDescription
Future<int>Status code of the current operation. 0 indicates success. The specific result requires implementing the interface callback. Non-zero indicates the current operation failed, and the interface callback will not be triggered. Refer to the error codes for details.

Callback Method

  • onBlacklistStatusLoaded
Function(int? code, String? userId, RCIMIWBlacklistStatus? status)? onBlacklistStatusLoaded;

Parameter Description

ParameterTypeDescription
codeintStatus code of the callback. 0 indicates success, non-zero indicates an exception.
userIdStringUser ID
statusRCIMIWBlacklistStatusCurrent status

Code Example

engine?.onBlacklistStatusLoaded = (int? code, String? userId, RCIMIWBlacklistStatus? status) {
//...
};

Get Blocklist

Get the current user's blocklist.

Method

Future<int> getBlacklist({IRCIMIWGetBlacklistCallback? callback});

Return Value

ParameterTypeDescription
callbackIRCIMIWGetBlacklistCallbackEvent callback. SDK supports callback method starting from version 5.3.1. Other callback methods are deprecated as of version 5.4.0. If the callback parameter is provided, only the callback will be triggered.

Callback Method

  • onBlacklistLoaded
Function(int? code, List<String>? userIds)? onBlacklistLoaded;

Parameter Description

ParameterTypeDescription
codeintStatus code of the callback. 0 indicates success, non-zero indicates an exception.
userIdsList<String>List of user IDs

Code Example

engine?.onBlacklistLoaded = (int? code, List<String>? userIds) {
//...
};