Other chat features

Get Jid based on Username/Userid#

Use the below method to generate your own or others JID using the unique username got in registration response.

SDK.getJid(`USER_ID`);

Example Request#

SDK.getJid(`123456789`);

Example Response#

{
statusCode: 200,
message: "Success",
userJid: "123456789@xmppdomain"
}

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`);

Example Response#

{
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
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
}
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
},
}

Get mediadownload for media attachment#

Use the below method to return local path for media attachment .

await SDK.downloadMedia(msgId);

Example Request#

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

Example Response#

{
statusCode: '',
message: '',
data: {
msgId: '',
isDownloaded: '',
local_path: '',
},
};
note

To learn more about downloadMedia call back, go to Media Download Listener Section.

User Profile Details#

Handles User Profile Response, when Get User Profile method called. Receives object values.

Response Format:#

{
"message": "",// String - Success/Error Message
"statusCode": "" // Number - status code
"data": {
"email": "",// String - User Email
"fromUser": "",//String - from User Mobile Number
"image": "",// String - User Profile Image
"isAdminBlocked": 0,
"mobileNumber": "",// String - User Mobile Number
"nickName": "",//String - User Nickname
"status": "", // String - Use Profile Status
"thumbImage": "",
"userId": "",// String - UserId
"userJid": ""// String - UserJid
},
}

Last Seen Time#

Handles Last Seen Time Respone, when Get Last Seen method called. Receives object values.

Response Format:#

data: {
fromUserJid: "", // String - From User Jid
seconds: 0, // Number - In Seconds
}

Note: If the seconds is 0, then the requested user is Online