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
to1
when calling the API.
Add to Blocklist
Add a user to the blocklist.
Method
Future<int> addToBlacklist(String userId, {IRCIMIWAddToBlacklistCallback? callback});
Parameter Description
Parameter | Type | Description |
---|---|---|
userId | String | User ID |
callback | IRCIMIWAddToBlacklistCallback | Event 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 Value | Description |
---|---|
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
Parameter | Type | Description |
---|---|---|
code | int | Status code of the callback. 0 indicates success, non-zero indicates an exception. |
userId | String | User 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
Parameter | Type | Description |
---|---|---|
userId | String | User ID |
callback | IRCIMIWRemoveFromBlacklistCallback | Event 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 Value | Description |
---|---|
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
Parameter | Type | Description |
---|---|---|
code | int | Status code of the callback. 0 indicates success, non-zero indicates an exception. |
userId | String | User 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
Parameter | Type | Description |
---|---|---|
userId | String | User ID |
callback | IRCIMIWGetBlacklistStatusCallback | Event 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 Value | Description |
---|---|
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
Parameter | Type | Description |
---|---|---|
code | int | Status code of the callback. 0 indicates success, non-zero indicates an exception. |
userId | String | User ID |
status | RCIMIWBlacklistStatus | Current 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
Parameter | Type | Description |
---|---|---|
callback | IRCIMIWGetBlacklistCallback | Event 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
Parameter | Type | Description |
---|---|---|
code | int | Status code of the callback. 0 indicates success, non-zero indicates an exception. |
userIds | List<String> | List of user IDs |
Code Example
engine?.onBlacklistLoaded = (int? code, List<String>? userIds) {
//...
};