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

Recent Chat Messages#

Handles Recent Chat Respones, when Get Recent Chats method called. Receives an array of object values.

Response Format:#

{
statusCode: "", // Number - status code
message: "", // String - Success/Error Message
"data": [
{
"chatType": "chat",
"createdAt": "2023-09-06 10:52:46",
"deleteStatus": 0,
"fromUserId": "", // String - fromUserId
"msgBody": {
"nickName": "",
"mid": "",// String - user mid
"message": "",// String - User Text Mesaage
"message_type": "",// String - User Text Mesaage Type
"replyTo": "",
"mentionedUsersIds": ""
},
"msgId": "",// String - user msgId
"msgStatus": 1,
"msgType": "text",
"muteStatus": 0,
"publisherId": "",// String - user Number
"timestamp": 1693977766567,
"toUserId": "",
"unreadCount": 0,
"userId": "",// String - userId
"userJid": "",// String - userJid
"profileDetails": {
"nickName": "",// String - User Name
"image": "",// String - image
"status": "",//String - User status
"colorCode": "#7b0b88",
"userId": "",// String - userId
"userJid": "",// String - userJid
"email": "",//String - User Email-Id
"mobileNumber": "",//String - User mobile number
"isAdminBlocked": 0
}
},
]
}

Single Chat Response Format:#

Sample Response:

{
statusCode: 200,
message: "Success",
userJid: "", // String - Requested User Jid
"data": [
{
"createdAt": "",//String - Message Created Time
"chatType": "chat",
"favouriteBy": "",
"favouriteStatus": 0,
"deleteStatus": 0,
"fromUserJid": "",// string -fromUserJid
"publisherJid": "",// string -publisherJid
"publisherId": "",// string -publisherId
"timestamp": "",//number- timestamp
"msgId": "",//string - msgId
"msgStatus": 1,
"msgBody": {
"nickName": "",
"mid": "",//string - msgId
"message": "",//string - send media message
"message_type": "text",
"replyTo": "",
"mentionedUsersIds": ""
}
},
{
"createdAt": "2023-09-07 06:35:23",
"chatType": "chat",
"favouriteBy": "",
"favouriteStatus": 0,
deleteStatus: "", // Number - Delete Status
fromUserId: "", // String - From User Id
"fromUserJid": "",// String - fromUserJid
"publisherJid": "",// String - publisherJid
"publisherId": "",// String - mobile Number publisherJid
"timestamp": "",// number- timestamp
"msgId": "",// String - msgId
"msgStatus": 1,// Number - msgStatus
"msgBody": {
"nickName": "",//String - UserName
"media": {
"androidHeight": "",//Number - androidHeight
"androidWidth": "",//Number - androidWidth
"caption": "",
"duration": 0,
"fileName": "",//string fileName
"file_key": "",
"file_url": "",//string - File format file_url
"file_size": 139791,
"is_downloaded": 0,
"is_uploading": 2,
"local_path": "",//string - File format local_path
"msgId": "",//string - msgId
"originalHeight": 0,
"originalWidth": 0,
"thumb_image": "",
"webWidth": "",//Number - webWidth
"webHeight": "",//Number - webHeight
"fileType": "image/jpeg" //string -File format
},
"mid": "98b05f38-5f42-42fc-9313-be84793b3312",//string -mid
"message": "",//string - media message
"message_type": "image",
"replyTo": "",
"mentionedUsersIds": ""
}
}
]
}