Single chat

note

To generate your own or others JID using the unique username got in registration response, use the const userJid = SDK.getJid(USER_ID) method.

Get Recent Chats#

To get all the list of recent chats, send a request to the server as described below.

Check here for response format

await SDK.getRecentChats();

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString
dataArray of Object datasArray

Get Chat Messages#

To get the chat history of the selected user, send a request to the server as described below.

Check here for response format

Without Pagination

await SDK.getChatMessages(`TO_JID`);

With Pagination

await SDK.getChatMessages(`TO_JID`, `POSITION`, `LAST_ROW_ID`, `LIMIT`);

Example

await SDK.getChatMessages(
"91XXXXXXXXXX@domain.com",
"down",
"12345",
10,
);

Request Params#

StatusDescriptionTypeRequired
TO_JIDJID of the To User/GroupJID Stringtrue
POSITIONPosition for PaginationStringfalse
LAST_ROW_IDLast Row ID of PaginationStringfalse
LIMITPagination LimitNumberfalse

Note: POSITION - Accepts "down"/"up"

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString
dataArray of Object datasArray

Send Message#

To send the message to the user, use the below methods. Different messages such as text, image, audio, video & document type messages can be sent using the below methods.

MESSAGE_ID - Unique Id for each and every messages. When you given your MESSAGE_ID, SDK will take your message id otherwise SDK will generate it's own MESSAGE_ID

Text Message#

await SDK.sendTextMessage(`TO_USER_JID`, `MESSAGE_BODY`, `MESSAGE_ID`, `REPLY_TO`, `MENTIONED_USERS_IDS`);

Sample Request:#

SDK.sendTextMessage(
"123456789@xmppdomain",
"hello",
"3a2a9a83-9ee2-4385-b6ed-5e9bebca9152",
"3137c42d-cfd0-4ce6-aa29-0fc20b51ec34",
['910987654321']
)

Request Param#

StatusDescriptionTypeRequired
TO_USER_JIDJID of the To UserJID Stringtrue
MESSAGE_BODYText Message BodyStringtrue
MESSAGE_IDMessage IdStringfalse
REPLY_TOMessage ID of Original MessageStringfalse
MENTIONED_USERS_IDSArray of Group Mentioned UsersIdsArrayfalse

Response Format:#

statusCode: 200, // Number - status code
message: "", // String - Success/Error Message
data:
{
chatType: "", // String - Chat Type - "chat" or "groupchat"
createdAt: "", // String - Message Created Time
deleteStatus: 0, // Number - Delete Status
favouriteBy: "", // String - Favourited By - User
favouriteStatus: 0, //Number - Favourite status
fromUserJid: "", // String - From User Jid
msgBody: {
message: "", // String - Message Body
message_type: "", // String - Message Type
nickname: "", // String - nick name
mentionedUsersIds: [] // Array of mentioned users - Incase of Group
},
msgId: "", // String - Unique Message Id
msgType: "", // String - audio/video/image/document/location/contact Message Type
publisherId: "", // String - user Id/Group Id
timestamp: 1681185232000, // Number - TimeStamp - Milliseconds
},

Image Message#

caution

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

await SDK.sendImageMessage(`TO_USER_JID`, `IMAGE_FILE`, `FILE_OPTIONS`, `REPLY_TO`, `MENTIONED_USERS_IDS`);

Sample Request:#

SDK.sendImageMessage(
"123456789@xmppdomain",
File,
{
msgId: "7a0778d8-2c71-4dae-9cba-7110e81c3373",
caption: "hi",
duration: 0,
webWidth: 240,
webHeight: 338,
androidWidth: 210,
androidHeight: 320,
originalWidth: 0,
originalHeight: 0
},
"3137c42d-cfd0-4ce6-aa29-0fc20b51ec34",
['910987654321']
)

Request Params#

StatusDescriptionTypeRequired
TO_USER_JIDJID of the To UserJID Stringtrue
IMAGE_FILEImage File - Should be of type png, jpg, jpeg, svg & gifFiletrue
FILE_OPTIONSFile Option ParamsObjecttrue
FILE_OPTIONS.msgIdMessage IdStringfalse
FILE_OPTIONS.captionImage CaptionStringfalse
FILE_OPTIONS.thumbImageThumbnail Image - Base64Stringfalse
FILE_OPTIONS.webWidthWidth for WebStringfalse
FILE_OPTIONS.webHeightHeight for WebStringfalse
FILE_OPTIONS.androidWidthWidth for AndroidStringfalse
FILE_OPTIONS.androidHeightHeight for AndroidStringfalse
FILE_OPTIONS.thumbRatioAspect ratio for Thumb ImageStringfalse
REPLY_TOMessage ID of Original MessageStringfalse
MENTIONED_USERS_IDSArray of Group Mentioned UsersIdsArrayfalse

Note: Width and Height Params are Used to Display the Image with Original Dimenstions

Response Format:#

statusCode: 200, // Number - status code
message: "", // String - Success/Error Message
data:
{
chatType: "", // String - Chat Type - "chat" or "groupchat"
createdAt: "", // String - Message Created Time
deleteStatus: 0, // Number - Delete Status
favouriteBy: "", // String - Favourited By - User
favouriteStatus: 0, //Number - Favourite status
fromUserJid: "", // String - From User Jid
msgBody: {
media: { // For Media Message Only
caption: "", // String - Media Caption
duration: 0, // Number - Duration - For Audio/Videos, otherwise 0
fileName: "", // String - File Name
file_size: 126185, // Number - File Size
fileToken: "", // String - File Url
file_key: "", //String - File Key
is_downloaded: 0, // Number - Downloaded Status
is_uploading: 2, // Number - Uploading Status
local_path: "", // String - Local Path
thumbImage: "", // Base64 - Thumb Image
}
message_type: "", // String - Message Type
nickname: "", // String - nick name
mentionedUsersIds: [] // Array of mentioned users
},
msgId: "", // String - Unique Message Id
msgType: "", // String - audio/video/image/document/location/contact Message Type
publisherId: "", // String - user Id/Group Id
timestamp: 1681185232000, // Number - TimeStamp - Milliseconds
},

Audio Message#

caution

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

await SDK.sendAudioMessage(`TO_USER_JID`, `AUDIO_FILE`, `FILE_OPTIONS`, `REPLY_TO`, `MENTIONED_USERS_IDS`);

Sample Request:#

SDK.sendAudioMessage(
"123456789@xmppdomain",
File,
{
msgId: "2e99305e-b808-439f-bf26-985a3522c812",
caption: "",
duration: 27252,
webWidth: 0,
webHeight: 0,
androidWidth: 0,
androidHeight: 0,
originalWidth: 0,
originalHeight: 0,
audioType: "file"
},
"3137c42d-cfd0-4ce6-aa29-0fc20b51ec34",
['910987654321']
)

Request Params#

StatusDescriptionTypeRequired
TO_USER_JIDJID of the To UserJID Stringtrue
AUDIO_FILEImage File - Should be of type mp3, mpeg & wavFiletrue
FILE_OPTIONSFile Option ParamsObjecttrue
FILE_OPTIONS.msgIdMessage IdStringfalse
FILE_OPTIONS.captionAudio CaptionStringfalse
FILE_OPTIONS.durationAudio DurationNumberfalse
REPLY_TOMessage ID of Original MessageStringfalse
MENTIONED_USERS_IDSArray of Group Mentioned UsersIdsArrayfalse

Response Format:#

statusCode: 200, // Number - status code
message: "", // String - Success/Error Message
data:
{
chatType: "", // String - Chat Type - "chat" or "groupchat"
createdAt: "", // String - Message Created Time
deleteStatus: 0, // Number - Delete Status
favouriteBy: "", // String - Favourited By - User
favouriteStatus: 0, //Number - Favourite status
fromUserJid: "", // String - From User Jid
msgBody: {
media: { // For Media Message Only
caption: "", // String - Media Caption
duration: 0, // String - Duration - For Audio/Videos, Otherwise 0
fileName: "", // String - File Name
file_size: "", // Number - File Size
fileToken: "", // String - File Url
file_key: "", //String - File Key
is_downloaded: 0, // Number - Downloaded Status
is_uploading: 2, // Number - Uploading Status
local_path: "", // String - Local Path
thumbImage: "", // Base64 - Thumb Image
}
message_type: "", // String - Message Type
nickname: "", // String - nick name
mentionedUsersIds: [] // Array of mentioned users
},
msgId: "", // String - Unique Message Id
msgType: "", // String - audio/video/image/document/location/contact Message Type
publisherId: "", // String - user Id/Group Id
timestamp: 1681185232000, // Number - TimeStamp - Milliseconds
},

Video Message#

caution

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

await SDK.sendVideoMessage(`TO_USER_JID`, `VIDEO_FILE`, `FILE_OPTIONS`, `REPLY_TO`, `MENTIONED_USERS_IDS`);

Sample Request:#

SDK.sendVideoMessage(
"123456789@xmppdomain",
File,
{
msgId: "6e2ff8de-0dcb-4f60-a067-09518cae5ea5",
caption: "hi",
duration: 30800,
webWidth: 330,
webHeight: 248,
androidWidth: 250,
androidHeight: 188,
originalWidth: 320,
originalHeight: 240,
thumbImage: ""
},
"3137c42d-cfd0-4ce6-aa29-0fc20b51ec34",
['910987654321']
)

Request Params#

StatusDescriptionTypeRequired
TO_USER_JIDJID of the To UserJID Stringtrue
VIDEO_FILEImage File - Should be of type mp4Filetrue
FILE_OPTIONSFile Option ParamsObjecttrue
FILE_OPTIONS.msgIdMessage IdStringfalse
FILE_OPTIONS.captionVideo CaptionStringfalse
FILE_OPTIONS.durationVideo DurationNumberfalse
FILE_OPTIONS.thumbImageThumbnail Image - Base64Stringfalse
FILE_OPTIONS.webWidthWidthStringfalse
FILE_OPTIONS.webHeightHeight for WebStringfalse
FILE_OPTIONS.androidWidthWidth for AndroidStringfalse
FILE_OPTIONS.androidHeightHeight for AndroidStringfalse
FILE_OPTIONS.thumbRatioAspect ratio for Thumb ImageStringfalse
REPLY_TOMessage ID of Original MessageStringfalse
MENTIONED_USERS_IDSArray of Group Mentioned UsersIdsArrayfalse

Response Format:#

statusCode: 200, // Number - status code
message: "", // String - Success/Error Message
data:
{
chatType: "", // String - Chat Type - "chat" or "groupchat"
createdAt: "", // String - Message Created Time
deleteStatus: 0, // Number - Delete Status
favouriteBy: "", // String - Favourited By - User
favouriteStatus: 0, //Number - Favourite status
fromUserJid: "", // String - From User Jid
msgBody: {
media: { // For Media Message Only
caption: "", // String - Media Caption
duration: "", // String - Duration - For Audio/Videos
fileName: "", // String - File Name
file_size: "", // Number - File Size
fileToken: "", // String - File Url
file_key: "", //String - File Key
is_downloaded: 0, // Number - Downloaded Status
is_uploading: 2, // Number - Uploading Status
local_path: "", // String - Local Path
thumbImage: "", // Base64 - Thumb Image
}
message_type: "", // String - Message Type
nickname: "", // String - nick name
mentionedUsersIds: [] // Array of mentioned users
},
msgId: "", // String - Unique Message Id
msgType: "", // String - audio/video/image/document/location/contact Message Type
publisherId: "", // String - user Id/Group Id
timestamp: 1681185232000, // Number - TimeStamp - Milliseconds
},

Document Message#

caution

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

await SDK.sendDocumentMessage(`TO_USER_JID`, `DOCUMENT_FILE`, `FILE_OPTIONS`, `REPLY_TO`, `MENTIONED_USERS_IDS`);

Sample Request:#

SDK.sendDocumentMessage(
"123456789@xmppdomain",
File,
{
msgId: "91e4e2ef-3ecd-40be-8dde-15754a127216",
caption: "",
duration: 0,
webWidth: 0,
webHeight: 0,
androidWidth: 0,
androidHeight: 0,
originalWidth: 0,
originalHeight: 0
},
"3137c42d-cfd0-4ce6-aa29-0fc20b51ec34",
['910987654321']
)

Request Params#

StatusDescriptionTypeRequired
TO_USER_JIDJID of the To UserJID Stringtrue
DOCUMENT_FILEDocument File - Accepted files are pdf, doc, xls, csv, ppt & txtFiletrue
FILE_OPTIONSFile Option ParamsObjecttrue
FILE_OPTIONS.msgIdMessage IdStringfalse
FILE_OPTIONS.captionDocument CaptionStringfalse
REPLY_TOMessage ID of Original MessageStringfalse
MENTIONED_USERS_IDSArray of Group Mentioned UsersIdsArrayfalse

Response Format:#

statusCode: 200, // Number - status code
message: "", // String - Success/Error Message
data:
{
chatType: "", // String - Chat Type - "chat" or "groupchat"
createdAt: "", // String - Message Created Time
deleteStatus: 0, // Number - Delete Status
favouriteBy: "", // String - Favourited By - User
favouriteStatus: 0, //Number - Favourite status
fromUserJid: "", // String - From User Jid
msgBody: {
media: { // For Media Message Only
caption: "", // String - Media Caption
duration: 0, // Number - Duration - For Audio/Videos, Otherwise 0
fileName: "", // String - File Name
file_size: "", // Number - File Size
fileToken: "", // String - File Url
file_key: "", //String - File Key
is_downloaded: 0, // Number - Downloaded Status
is_uploading: 2, // Number - Uploading Status
local_path: "", // String - Local Path
thumbImage: "", // Base64 - Thumb Image
}
message_type: "", // String - Message Type
nickname: "", // String - nick name
mentionedUsersIds: [] // Array of mentioned users
},
msgId: "", // String - Unique Message Id
msgType: "", // String - audio/video/image/document/location/contact Message Type
publisherId: "", // String - user Id/Group Id
timestamp: 1681185232000, // Number - TimeStamp - Milliseconds
},

Media Message Data#

Send Media message as a meta data, here media will be uploaded externally (client side) and media information will be sent.

await SDK.sendMediaMessageData(`TO_USER_JID`, `MSG_TYPE`, `FILE_OPTIONS`, `MSG_ID`, `REPLY_TO`, `MENTIONED_USERS_IDS`);

Request Params#

StatusDescriptionTypeRequired
TO_USER_JIDJID of the To UserJID Stringtrue
MSG_TYPEMessage Type - Accepted types are image, video, audio & fileFiletrue
FILE_OPTIONSFile Option ParamsObjecttrue
FILE_OPTIONS.fileNameFile NameStringtrue
FILE_OPTIONS.fileURLFile UrlStringtrue
FILE_OPTIONS.fileSizeFile SizeStringtrue
FILE_OPTIONS.durationMedia Duration - "mm:ss"Stringtrue if MSG_TYPE is "audio"/"video"
FILE_OPTIONS.thumbImgThumbnail Image - Base64Stringtrue if MSG_TYPE is "video"
FILE_OPTIONS.captionMedia CaptionStringfalse
REPLY_TOMessage ID of Original MessageStringfalse
MENTIONED_USERS_IDSArray of Group Mentioned UsersIdsArrayfalse

Example Requests#

const fileOptions = {
fileName: "fileName.png",
fileSize: 1000,
fileURL: "https://imagepath.com",
};
await SDK.sendMediaMessageData("toUser@domain.com", "image", fileOptions);
const fileOptions = {
fileName: "fileName.png",
fileSize: 1000,
fileURL: "https://imagepath.com",
duration: "02:22",
thumbImg: "base64",
};
await SDK.sendMediaMessageData("toUser@domain.com", "video", fileOptions);

Download Media#

This method is used to get the media file url when we download the media.

await SDK.getMediaURL(`fileToken`, `filekey`);

Request Param#

StatusDescriptionTypeRequired
fileTokenFile UrlStringtrue
filekeyFile key is optional param, which we get from the selected Media message BodyStringfalse

Example Requests#

await SDK.getMediaURL("9178680804311682318992048B1cCBm6F6WIVI38s9r1a.mp4", "AllRgIXOXZAHxAzxxggTTQvapoxpzEfx");

Response Format#

{
"statusCode": "" // Number - status code,
"message": "", // String - Success/Error Message
"data": {
"blobUrl": "", // String - blobUrl
"blob": {
"size" : "", // Number - size
"type" : "" // String
}
}
}

Receive Message#

To receive the incoming message from other users, you need to implement the event messageListener, which will be triggered whenever a new message is received. Once the message is received it automatically send the delivery status to the user if the logged-in user is online.

Send Seen Status#

To send message read status, use the below method.

await SDK.sendSeenStatus(`TO_USER_JID`, `MESSAGE_ID`);

Request Param#

StatusDescriptionTypeRequired
TO_USER_JIDJID of the To UserJID Stringtrue
MESSAGE_IDUnique Message IDStringtrue

Send Typing Status#

You can able to send the typing/gone status to the user so that receipent user can aware of that the user is typing the message.

await SDK.sendTypingStatus(`TO_JID`);

When the user starts typing the message in the input box of the chat window, call the below method to send the composing status, so that they can show a typing message in the header/recent chat.

Once the user stopped/finished typing the message send the gone status as described below, so that they can hide a typing message in the header/recent chat.

await SDK.sendTypingGoneStatus(`TO_JID`);

Method parameter#

StatusDescriptionTypeRequired
TO_JIDJID of the UserJID Stringtrue

Get Media Messages#

To get the media messages for the particular chat, on initial request it fetches three media. Then on the pagination request by passing the last message-id, it fetches 10 next media messages.

Check here for response format

caution

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

Without Pagination

await SDK.getMediaMessages(`TO_USER_JID`);

With Pagination

await SDK.getMediaMessages(`TO_USER_JID`, `LAST_MESSAGE_ID`);

Request Param#

StatusDescriptionTypeRequired
TO_USER_JIDJID of the To UserJID Stringtrue
LAST_MESSAGE_IDLast Message ID of PaginationStringfalse

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString
dataArray of Object datasArray

Send Reply Message#

To send a reply to the original message, we are using sendTextMessage by passing in the additional parameter original message-id.

Check here for response format

await SDK.sendTextMessage(`TO_JID`, `MESSAGE_BODY`, `MESSAGE_ID`, `REPLY_TO`, `MENTIONED_USERS_IDS`);

Request Param#

StatusDescriptionTypeRequired
TO_JIDJID of the To User/GroupJID Stringtrue
MESSAGE_BODYText Message BodyStringtrue
MESSAGE_IDUnique Message IDStringtrue
REPLY_TOMessage ID of Original MessageStringtrue
MENTIONED_USERS_IDSArray of Group Mentioned UsersIdsArrayfalse

Note: MESSAGE_ID can be passed as empty/null

Get Reply Message#

To get the reply message by message id, send a request to the server as described below.

Check here for response format

await SDK.getReplyMessage(`REPLY_MESSAGE_ID`, `CHAT_TYPE`);

Request Params#

StatusDescriptionTypeRequired
REPLY_MESSAGE_IDReply Message IDStringtrue
CHAT_TYPEChat TypeStringfalse

Note: CHAT_TYPE values are "chat"/"groupchat"

Forward Messages#

To forward an message to the single/group chat, we use following methods.

Forward Single/Multiple Messages to Single/Group Chat#

await SDK.forwardMessages(`TO_JID`, `MESSAGE_IDS`, `IS_ASYNC`);

Request Param#

StatusDescriptionTypeRequired
TO_JIDJID of the To User/GroupJID Stringtrue
MESSAGE_IDSArray of To Original Message IdsArraytrue
IS_ASYNCIF Forward has to be in Asynchronous (One by One) - Default trueBooleanfalse

Forward Single/Multiple Messages to Multiple User#

await SDK.forwardMessagesToMultipleUsers(`TO_JIDS`, `MESSAGE_IDS`);

Request Param#

StatusDescriptionTypeRequired
TO_JIDSArray of To User/Group JIDsArraytrue
MESSAGE_IDSArray of To Original Message IdsArraytrue
IS_ASYNCIF Forward has to be in Asynchronous (One by One) - Default trueBooleanfalse

Favourite Messages#

The favourite message is a feature that allows users to mark some messages as favourites. So that they can see those important messages in the future without searching for them in chat.

Once you marked messages as favourite, you can get those from SDK to show them on your app's screen.

Add/Remove Favourites#

caution

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

await SDK.updateFavouriteStatus(`TO_JID`, `MESSAGE_ID`, `IS_FAVOURITE`, `MENTIONED_USERS_IDS`);

Request Param#

StatusDescriptionTypeRequired
TO_JIDJID of the To User/GroupStringtrue
MESSAGE_IDUnique Message IDStringtrue
IS_FAVOURITEtrue for adding to favourites, false for removingBooleantrue
MENTIONED_USERS_IDSArray of Group Mentioned UsersIdsArrayfalse

Get All Favourites#

caution

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

await SDK.getAllFavouriteMessages();

Once get all favourites method initiated, an callback method favouriteMessageListener will be triggered and response will be sent.

Remove All Favourites#

caution

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

await SDK.removeAllFavouriteMessages();

Clear Chat Messages#

The clear chat message is a feature that allows users to delete chat messages.

If you want to clear the messages for the entire chat, or multiple chats then you can utilize the below methods.

Clear Chat#

You can clear the messages for any chat by using the below method. The messages will not be deleted from the recipient.

caution

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

await SDK.clearChat(`TO_JID`, `FAVOURITES`, `LAST_MSG_ID`);

Method Params#

StatusDescriptionTypeRequired
TO_JIDJID of the To User/GroupJID Stringtrue
FAVOURITESWhether to Delete Favourites Messages or notBooleanfalse
LAST_MSG_IDlastMsgId which the message is sendStringfalse

Response Format:#

statusCode: 200, // Number - status code
message: "Success", // String - Success/Error Message
lastMsgId: "" // String - LastMsgId of your chat

Delete Chat#

You can delete the chat (from recent chat) by using the below method.

caution

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

await SDK.deleteChat(`TO_JID`, `FAVOURITES`);

Method Params#

StatusDescriptionTypeRequired
TO_JIDJID of the To User/GroupJID Stringtrue
FAVOURITESWhether to Delete Favourites Messages or notBooleanfalse

Response Format:#

statusCode: 200, // Number - status code
message: "Success", // String - Success/Error Message
lastMsgId: "" // String - In this case, value is empty

Clear All Chat#

You can clear all conversation by using the below method.

await SDK.clearAllChat();

Delete Messages#

Delete message is a feature that is found in modern messaging apps that allows the user to delete the message once it is sent. Once you sent the message, you can able to delete the messages by using built-in SDK methods.

Delete All Recent Chats#

To delete all recent chat messages use below method, which deletes all single and group conversation.

await SDK.deleteAllChat();

Delete for Me#

If you want to delete the messages for yourself only then you can use the below method. A callback method MessageListener will be triggered and response will be sent.

caution

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

Note: The messages will not be deleted from the recipient.

await SDK.deleteMessagesForMe(`TO_JID`, `MESSAGE_IDS`);

Delete for Everyone#

If you want to delete the messages for yourself and the receiver then you can use the below method. The messages will also be deleted from the recipient. A callback method MessageListener will be triggered and response will be sent.

caution

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

await SDK.deleteMessagesForEveryone(`TO_JID`, `MESSAGE_IDS`);

Method Params#

StatusDescriptionTypeRequired
TO_JIDJID of the To User/GroupJID Stringtrue
MESSAGE_IDSArray of To Message IdsArraytrue

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

Archive Chat#

Archive/Unarchive Chat#

To Archive the single and group chat use below method.

await SDK.updateArchiveChat(`TO_JID`, `IS_ARCHIVED`);

Method Params#

StatusDescriptionTypeRequired
TO_JIDJID of the To User/GroupJID Stringtrue
IS_ARCHIVEDtrue for archive the chat, false for removingBooleantrue

Get All Archived Chat#

Retrieves all archived chats.

await SDK.getAllArchivedChats();

Response Format:#

statusCode: 200, // Number - status code
message: "Success", // String - Success/Error Message
data: [
{
fromUserId: "", // String - From User Id/Group Id
chatType: "", // String - value as "chat" or "groupchat"
fromUserJid: "", // String - From User Jid/ Group Jid
isArchived: true // Boolean
}
]

Display Browser Notification#

Display the browser notification by providing the notification object into the showChatNotification method. Notification would display when a user receive a message while user on different screen instead of on webchat application screen.

SDK.showChatNotification(`NOTIFICATION_OBJECT`);
// Exmple
SDK.showChatNotification({
title: `NOTIFICATION_TITLE`, // Title of the notification
body: `NOTIFICATION_BODY`, // Body of the notification
onClick: `CALLBACK_METHOD`, // Callback will be triggered when user click on notification
forceShow: `BOOLEAN`, // Display the notification in all cases set this value as TRUE
});

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString