Retrieve Messages

Get Reply Message#

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

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"

Response Format#

{
statusCode: 200,
message: "Success",
data: {
fromUserId: "", // String - Reply From User Id
oldMsgId: "", // String - Old Message Id
replyMsgId: "", // String - Reply Message Id
replyMsgContent: {
message: "", //String - Message
message_type: "", //String - Message Type
mentionedUsersIds: [], // Array - Mentioned Ids In case of Group
nickName: "", ////String - nickname
replyTo: "" , //String - Reply To
},
chatType: "", // String - Chat Type
deletedBy: "", // String - Deleted By
deleteStatus: 0 // Number - Delete Status
}
}

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.

caution

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

Without Pagination

await SDK.getMediaMessages({
toJid: ""
});

Without Pagination By Topic id

await SDK.getMediaMessages({
toJid: "",
topicId: ""
});

With Pagination

await SDK.getMediaMessages({
toJid: "",
lastMsgId: "",
topicId: ""
});

Request Param#

StatusDescriptionTypeRequired
toJidJID of the To UserJID Stringtrue
lastMsgIdLast Message ID of PaginationStringfalse
topicIdTopic id for the messagesStringfalse

Response Format#

{
statusCode: 200,
message: "Success",
data: [
{
chatype: "", // String - Chat Type - Values "chat"
media: {
androidHeight: 188, // Number - Android Height -Only For Image/Video
androidWidth: 250, // Number - Android Width -Only For Image/Video
caption: "", // String - Media Caption
duration: 29070, // Number - Duration - For Audio/Videos, Otherwise 0
file: { // Object - File
caption: "", // String - Caption - Only for Image/Video
fileDetails: {
androidHeight: 188, // Number - Android Height - For Video
androidWidth: 250, // Number - Android Width - For Video
audioType: "", // String - AudioType - Only for Audio
duration: 30800, // Number - Duration -Only for Audio/Video
fileId: "", // String - File Id
imageUrl: "", // String - Image Url - For Image/Video/Audio
msgType: "", // String - MessageType - Image/Video/Audio/File
replyTo: "", // String - MessageId - For reply message
originalHeight: 240, // Number - Original Height - For Video
originalWidth: 320, // Number - Original Width - For Video
webHeight: 248, // Number - Web Height - For Video
webWidth: 330 // Number - Web Width - For Video
}
mentionedUsersIds: [] // Array - In case of GroupChat - for Image/Video
}
fileName: "", // String - File Name
file_key: "", // String - File Key
file_size: 543879, // Number - File Size
file_url: "", // String - File Url
is_downloaded: 0, // Number - Downloaded Status
is_uploading: 2, // Number - Uploading Status
local_path: "", // String - Local Path
msgId: "", // String - MessageId
originalHeight: 240, // Number - Original Height -Only For Image/Video
originalWidth: 320, // Number - Original Width -Only For Image/Video
thumb_image: "", // Base64 - Thumb Image
webHeight: 248, // Number - Web Height -Only For Image/Video
webWidth: 330 // Number - Web Width -Only For Image/Video
},
metaData: {}, //Object - Meta data for the message
mentionedUsersIds: [], // Array - MentionedUsersIds, Incase of GroupChat
topicId: "", //String - Topic id for the message
message: "", // String - Message Object
message_type: "", // String - Message Type
msgId: "", // String - Message Id
nickName: "", // String - Nickname
timestamp: 1681185232000, // Number - TimeStamp - Milliseconds
},
//...
];
}

Get Chat Messages#

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

Without Pagination

await SDK.getChatMessages({
toJid: ""
});

Without Pagination By Topic id

await SDK.getChatMessages({
toJid: "",
topicId: ""
});

With Pagination using Row id

await SDK.getChatMessages({
toJid: "",
position: "",
lastRowId: "",
limit: "",
topicId: ""
});

With Pagination using Message id

await SDK.getChatMessages({
toJid: "",
position: "",
lastMessageId: "",
limit: "",
topicId: "",
includeMsgObj: "" // Boolean - Include passing lastMessageId message object
});

Example

await SDK.getChatMessages({
toJid: "91XXXXXXXXXX@domain.com",
position: "down",
lastRowId: "12345", // or lastMessageId = "ab123"
limit: 20,
topicId: "abcd-123"
});

Request Params#

StatusDescriptionTypeRequired
toJidJID of the To User/GroupJID Stringtrue
positionPosition for PaginationStringfalse
lastRowIdLast Row ID of PaginationStringfalse
limitPagination LimitNumberfalse
topicIdTopic id for the messagesStringfalse
lastMessageIdLast Message ID of PaginationStringfalse
includeMsgObjInclude or not passing lastMessageId message objectBooleanfalse

Note: POSITION - Accepts "down"/"up", "includeMsgObj" - Applicable only to message id with pagination method

Response Format#

{
statusCode: 200,
message: "Success",
userJid: "", // String - Requested User Jid
data: [
{
deleteStatus: "", // Number - Delete Status
favouriteBy: "", // String - Favourited By - User
favouriteStatus: "", // String - Favourite Status
fromUserId: "", // String - From User Id
metaData: {}, //Object - Meta data for the message
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
file_url: "", // String - File Url
is_downloaded: "", // Number - Downloaded Status
is_uploading: "", // Number - Uploading Status
local_path: "", // String - Local Path
thumb_image: "", // Base64 - Thumb Image
isLargeFile: "" , //Boolean - Large file upload
}
message: "", // String - Message Body
message_type: "" // String - Message Type
mentionedUsersIds: [],
nickName: ""
},
topicId: "", //String - Topic id for the message
fromUserJid: "", // String - From User Jid
msgId: "", // String - Unique Message Id
msgStatus: "", // String - Message Status
createdAt: "", // String - Message Created Time
timestamp: 1681185232000, // Number - TimeStamp - Milliseconds
rowId: "", // String - Table Row Id - Used for Fetching Next Paginated Messages
chatType: "", // String - Chat Type - "chat"
editedStatus: 0, // Number - Edited status - 0 or 1
editMessageId: "", // String - Edit MessageId
},
//...
];
}

Get Message based on MsgId#

Use the below method to get the message using the messageId which you got.

SDK.getMessageById(`MSG_ID`);

Example Request#

SDK.getMessageById(`815f37b5-1f8f-4a39-8237-247c44b1b521`);

Response Format#

{
statusCode: 200,
message: "Success",
data:{
chatType: "", // String - Chat Type - "chat" - Single - "groupchat" - Group
createdAt: "", // String - CreatedAt - "2023-04-11 09:23:52"
deleteStatus: 0, // Number - Delete Status
deletedBy: "0", // String - Deleted By
fromUserId: "", // String - From User Id
fromUserJid: "", // String - From User Jid -
// Will Be Same as PublisherJid in Case of Single Chat
// GroupJid in Case of Group Chat
msgBody: {
message: '', // String - Message Body
message_type: '', // String - Message Type text, image, video, audio & file
mentionedUsersIds: [], // Array - Mentioned Ids In case of Group
nickName: '', // String - User Nickname
}
metaData: {}, //Object - Meta data for the message
topicId: "", //String - Topic id for the message
msgId: "", // String - Message Id
msgStatus: 2, // Number - Message Status
msgType: "", // String - value ""
profileUpdatedStatus: "" // String
publisherJid: "", // String - Jid - PublisherJid
publisherId: "", // String - Id - Publisher Id
timestamp: 1681185232000, // Number - TimeStamp - Milliseconds
userId: "", // String - UserId
userJid: "", // String - UserJid
editedStatus: 0, // Number - Edited status - 0 or 1
editMessageId: "", // String - Edit MessageId
},
}

Emojis#

Our service allows you to send emojis of any kind, without any encryption.

Translate Message#

Get All Available Translate Languages#

Retrives all Available languages for the Translate from the Google API.

caution

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

SDK.getTranslateLanguages(`API_KEY`, `TARET_LANGUAGE`);

Example Request#

Retrives the Translated Text for the provided Text with Target Language.

SDK.getTranslateLanguages(`AIza******************`, `en`);

Response Format:#

{
statusCode: 200,
message: "Success",
data: {
languages: [
{
language: "af" name: "Afrikaans"
},
{
language: "sq", name: "Albanian"
},
//...
]
}
}

Translate the Message#

caution

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

SDK.translateText(`API_KEY`, `MESSAGE_TO_TRANSLATE`, `TARET_LANGUAGE`);

Example Request#

SDK.translateText(`AIza******************`, `Hello, This is Sample Text`, `ta`);

Response Format:#

{
statusCode: 200,
message: "Success",
data: {
translations: [
{
detectedSourceLanguage: "ta",
translatedText: "வணக்கம்"
}
]
}
}