Moderation

Block User#

Block User method uses to block the User from sending a message to us, it also hides our information from them. Use the below method by passing the JID of the user whom we are blocking.

await SDK.blockUser(`TO_USER_JID`);

Request Param#

StatusDescriptionTypeRequired
TO_USER_JIDJID of the To UserJID Stringtrue

Unblock User#

To unblock the User use the below method.

await SDK.unblockUser(`TO_USER_JID`);

Request Param#

StatusDescriptionTypeRequired
TO_USER_JIDJID of the To UserJID Stringtrue
info

When a blockUser or unblockUser messageListener event will be triggered with response object of user blocked me / User unblocked me. Based on this event, update the message and refresh the UI.

Get Users I Blocked#

To get the list of Users whom we blocked, send a request as described below.

await SDK.getUsersIBlocked();

Response Format#

{
statusCode: 200,
message: "Success"
data: [
{
jid: "", // String - Jid of the User
},
//...
];
}

Note: Please run this method whenever you call the connect method to update your blocked users list in the local database.

Get Users Who Blocked Me#

To get the list of Users who blocked Us, send a request as described below.

await SDK.getUsersWhoBlockedMe();

Response Format#

{
statusCode: 200,
message: "Success"
data: [
{
jid: "", // String - Jid of the User
},
//...
];
}

Note: Please run this method whenever you call the connect method to update the list of users you have blocked in the local database.

Mute Chat#

To Mute the chat use below method which disables the notification for the chat when the new messages are received or any action on chat.

await SDK.updateMuteNotification(`TO_JID`, `IS_MUTED`);
StatusDescriptionTypeRequired
TO_JIDJID of the To UserJID Stringtrue
IS_MUTEDtrue for muting the chat, false for removingBooleantrue

Get Mute Status#

To determine if a particular user is muted, use the method below. It returns the mute status of the specified user, if the user is muted return 1 else return 0.

await SDK.getMuteStatus(`TO_JID`);
StatusDescriptionTypeRequired
TO_JIDJID of the To UserJID Stringtrue