Blocklist
Feature Description
To block a user's messages, add the user to the blocklist.
Blocklist
Blocking a user
By default, a blocked user does not know that he/she is "blocked". After the user sends a message, the error code indicating that he/she has been blocked will not be returned.
To have the "You have been blocked by the user" error message returned after a blocked user sends a message, you can log in to the IM console, select Feature Configuration > Login and Message > Blocklist Check, and disable Show "Sent successfully" After Sending Messages. Then the SDK will report error code 20007 after a blocked user sends a message.
// Add a user to the blocklistconst addBlackList = await friendshipManager.addToBlackList(["user1"]);
Unblocking a user
Call
deleteFromBlackList
(Details) to remove a user from the blocklist, after which messages from the user can be received.// Remove a user from the blocklistconst deleteBlackList = await friendshipManager.deleteFromBlackList(["user1"]);
Getting the blocklist
// Get the blocklistconst blacklist = await friendshipManager.getBlackList();