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"
}

Translate Meesage#

Get All Available Translate Languages#

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

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

Example Request#

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

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

Response:

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

Translate the Message#

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

Example Request#

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

Response:

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

User Settings#

Handles User Settings for Archived Chats.

Get User Settings#

await SDK.getUserSettings();

Response Format:#

data: {
archive: 1 // Number 1 - Permanent / - 0 - Temporary
}

Update User Settings#

await SDK.updateUserSettings(`IS_PERMANENT_ACHIVE_ENABLED`);

Request Params#

StatusDescriptionTypeRequired
IS_PERMANENT_ACHIVE_ENABLEDtrue - Permanent, false - TemporaryBooleantrue

Friends List#

Handles Friends List (Contacts) Respones, when Get Friends method called. Receives an array of object values.

Response Format:#

data: [
{
name: "", // String - Name of the User
image: "", // String - Profile Image of the User
email: "", // String - User Email
status: "", // String - User Status
userJid: "", // String - Jid of the User
userId: "", // String - User Id
nickName: "", // String - Nick Name of the User
mobileNumber: "", // String - User Mobile Number
isAdminBlocked: false, // Boolean - To denote whether admin blocked this account or not
},
//...
];

User Profile Details#

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

Response Format:#

data: {
email: "", // String - User Email
image: "", // String - User Profile Image
fromUser: "", // String - From User Jid
nickName: "", // String - User Nickname
mobileNumber: "", // String - User Mobile Number
userStatus: "", // String - Use Profile Status
}

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:#

data: [
{
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
}
message: "", // String - Message Body
message_type: "" // String - Message Type
},
msgId: "", // String - Unique Message Id
toUserId: "", // String - To User Id
fromUserId: "", // String - From User Id
msgType: "", // String - Message Type
publisherId: "", // String - Publisher Id
msgStatus: "", // Number - Message Status
unreadCount: "", // Number - Unread Message Count
deleteStatus: "", // Number - Delete Status (Recall)
createdAt: "", // String - Created Time
timestamp: "", // Number - Message Timestamp
chatType: "", // String - Chat Type "chat"/"groupchat"
updatedAt: "", // String - Updated Time
userId: "", // String - Notification To
muteStatus: 0, // Number - Mute Status
archiveStatus: 0 // Number - Archive Status
},
//...
];

Single Chat Conversation History Messages#

Handles Single Chat Respones, when Get Chat Messages method called. Receives an array of object values.

Response Format:#

userJid: "", // String - Requested User Jid
data: [
{
deleteStatus: "", // Number - Delete Status
favouriteBy: "", // String - Favourited By - User
favouriteStatus: "", // String - Favourite Status
fromUserId: "", // String - From User Id
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
}
message: "", // String - Message Body
message_type: "" // String - Message Type
},
fromUserJid: "", // String - From User Jid
msgId: "", // String - Unique Message Id
msgStatus: "", // String - Message Status
createdAt: "", // String - Message Created Time
timestamp: "", // Number - TimeStamp - 16 Character length
rowId: "", // String - Table Row Id - Used for Fetching Next Paginated Messages
chatType: "", // String - Chat Type - "chat"
},
//...
];

Media Messages#

Handles Single/Group Chat Media Respones, when Get Media Messages method called. Receives an array of object values.

Response Format:#

Sample Response:

data: [
{
msgId: "", // String - Message Id
message_type: "", // String - Message Type
chatype: "", // String - Chat Type - Values "chat"/"groupchat"
message: "", // String - Message Object
media: {
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
},
timestamp: "", // Number - TimeStamp - 16 Character length
},
//...
];

Reply Message#

Handles Reply Message Respones, when Get Reply Messages method called. Receives object values.

Response Format:#

data: {
chatType: "", // String - Chat Type
deletedStatus: "", // Number - Delete Status
deletedBy: "", // String - Deleted By
fromUserId: "", // String - Reply From User Id
oldMsgId: "", // String - Old Message Id
replyMsgContent: "", // String - Reply Message Content
replyMsgId: "", // String - Reply Message Id
}

Groups List#

Handles Groups lists Respones, when Get All Groups method called. Receives an array of object values.

Response Format:#

data: [
{
itemId: "", // String - Item Id - Unique Id for the Group Member
groupId: "", // String - Group Id
groupName: "", // String - Group Name
groupImage: "", // String - Group Image
timestamp: "", // Number - Group Created Timestamp
userType: "", // Number - User Type - "o" - Admin of the Group / "n" - Member of the Group
isAdminBlocked: false // Boolean - If true - Group is blocked by Admin
},
//...
];

Group Participants List#

Handles Groups Participants list Respones, when Get Group Participant method called. Receives an array of object values.

Response Format:#

data: [
{
itemId: "", // String - Item Id - Unique Id for the Participant for Group
userJid: "", // String - User Jid (With Domain)
userType: "", // String - User Type - value "o" - Admin of the Group/ "n" -Member of the Group
userProfile: {
image: "", // String - User Image
nickName: "", // String - User Nick Name
email: "", // String - User Email
status: "", // String - User Status
mobileNumber: "", // String - User Mobile Number
},
timestamp: // Number Timestamp
},
//...
];

Group Chat Conversation History Messages#

Handles Group Chat Messages Respones, when Get Chat Messages method called. Receives an array of object values.

Response Format:#

groupJid: "", // String - Requested Group Jid
data: [
{
msgId: "", // String - Unique Message Id
groupId: "", // String - Group Id
createdAt: "", // String - Message Created Time
fromUserId: "", // String - From User Id
userId: "", // String - User Id
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
}
message: "", // String - Message Body
message_type: "" // String - Message Type
},
favouriteBy: "", // String - Favourited By - User
msgStatus: "", // String - Message Status
timestamp: "", // Number - TimeStamp - 16 Character length
deleteStatus: "", // Number - Delete Status
status: "", // String - Group Message Status
msgType: "", // String - Group Message Type
rowId: "", // String - Table Row Id - Used for Fetching Next Paginated Messages
chatType: "", // String - Chat Type - "chat"
},
//...
];

Group Message Info#

Handles Group Message Info Respones, when Get Group Message Info method called. Receives an array of object values.

Response Format:#

data: {
groupJid: "", // String - Group Jid (With Domain)
msgId: "", // String - Message Id
participants: [
{
userId: "", // String - User Id
msgStatus: "", // String - Message Status - 0 Not Delivered, 1- Delivered, 2 - Seen
deliveredTime: "", // String - Message Delivered Time "0000-00-00 00:00:00"
seenTime: "", // String - Message Seen Time "0000-00-00 00:00:00"
},
//...
]
}

Users I Blocked#

Handles Blocked List IQs (Users who are all blocked by the current user), triggered when Get Users I Blocked method called. Receives an array of object values.

Response Format:#

[
{
jid: "", // String - Jid of the User
},
//...
];

Users Who Blocked Me#

Handles Blocked Users List IQs (Users who have blocked the current user), triggered when Get Users Who Blocked Me method called. Receives an array of object values.

Response Format:#

[
{
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.

Response Format:#

{
chatType: "", // String - either Group or Single Chat
toUserJid: "", // String - Blocked User/Group's Jid
blockStatus: "", // string - User/Group's Blocked Status (either 1(true) or 0(false))
toUserId: "", // String - Blocked User/Group's User-ID
type: "" // String
}