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.

caution

If Block/unblock feature is unavailable for your plan, then it will throw 403 exception

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.

caution

If Block/unblock feature is unavailable for your plan, then it will throw 403 exception

await SDK.unblockUser(`TO_USER_JID`);

Request Param#

StatusDescriptionTypeRequired
TO_USER_JIDJID of the To UserJID Stringtrue

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
},
//...
];
}

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
},
//...
];
}

User/Group Blocked/Unblocked By Admin#

Handles Blocked/Unblocked response from Admin Console for the user/group. This response is triggered when the console admin particularly blocks/unblocks an user/group in Callback adminBlockListener . Receives Blocked User/groups 's UserId and Jid with blocked status.

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 group chat.

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

Report User Or Group#

To Report a User or Group by another User.

caution

If Report feature is unavailable for your plan, then it will throw 403 exception

await SDK.reportUserOrGroup(`TO_USER_JID`, `CHAT_TYPE`, `ARRAY_OF_MESSAGE_OBJECT`);

Request Params#

StatusDescriptionTypeRequired
TO_USER_JIDJID of User/Group to be reportedJID Stringtrue
CHAT_TYPEChat type either User/GroupStringtrue
ARRAY_OF_MESSAGE_OBJECTMessage data Object that has to reportedArray of Objecttrue

Sample request Format#

await SDK.reportUserOrGroup(
"12345678@xmpp.chatsystem.dev.contus.us", // JID
"chat", // chat / groupchat
[{
msgId: "54333a85-2bee-4b1d-bbc3-1b8436096da7",
message: "abc",
msgType: "text",
filename: "",
timestamp: 1707309958682,
publisherId: "919876543210"
}])

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString

Enable/Disable Media Encryption#

To enable/disable the media encryption which was storing in the storage server. By default encryption will be false.

await SDK.setMediaEncryption(`TRUE`);

Request Params#

StatusDescriptionTypeRequired
REASONtrue - enable the media encryption. false - disable the media encryptionBooleantrue

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString