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 GroupJid based on Groupid#

Use the below method to generate your own or others GroupJID using the GroupId.

SDK.getGroupJid(`GROUP_ID`);

Example Request#

SDK.getGroupJid(`0f617991-08d0-4474-ae6c-f070dc63bb1a`);

Example Response#

{
statusCode: 200,
message: "Success",
userJid: "0f617991-08d0-4474-ae6c-f070dc63bb1a@mix.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 -
// 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
}
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
},
}

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:

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

{
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

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
thumbImage: "", // String - User Profile ThumbImage
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
mentionedUsersIds: [], // Array - Mentioned Ids For groupChat
nickName: "Rizwan" // String - User Name
},
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: 1681185232000, // Number - TimeStamp - Milliseconds
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: 1681185232000, // Number - TimeStamp - Milliseconds
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: 1681185232000, // Number - TimeStamp - Milliseconds
},
//...
];

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.1

Response Format:#

data: [
{
itemId: "", // String - Item Id - Unique Id for the Group Member
groupId: "", // String - Group Id
groupJid: "", // String - Group Jid
groupName: "", // String - Group Name
groupImage: "", // String - Group Image
thumbImage: "", // String - Group ThumbImage
timestamp: 1681185232000, // Number - Group Created Timestamp -Milliseconds
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: {
groupJid: "" // String Group Jid
participants: [
{
isAdminBlocked: false // Boolean - Admin Blocked or not
itemId: "", // String - Item Id - Unique Id for the Participant for Group
userId: "", // String - User Id (Without Domain)
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
name: "", // String - User Name
email: "", // String - User Email
status: "", // String - User Status
mobileNumber: "", // String - User Mobile Number
thumbImage: "" // String - User ThumbImage
},
timestamp: 1681185232000 // Number TimeStamp - Milliseconds
},
]
};

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: 1681185232000, // Number - TimeStamp - Milliseconds
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
}

Get MetaData For User#

Use the below method to get your own metaData.

await SDK.getMetaData();

Example Response#

{
statusCode: 200,
message: "Data Retrieved Successfully",
metaData:
{
type:"test",
phone:"1234567890"
}
}

Update MetaData For User#

Use the below method to update your own metaData.

await SDK.updateMetaData(`Update_MetaData`);

Request Param#

StatusDescriptionTypeRequired
Update_MetaDataUpdate_MetaData is an optional parameter to update MetaData of user. Maximum size is 3Objectfalse

Request Input for Update_MetaData#

ArgumentsDescriptionType
keyName of the KeyString
valueName of the valueString or Boolean or Number

Example Response#

{
statusCode: 200,
message: "User Successfully Updated",
metaData:
{
method:"update"
}
}
note

You didn't pass param (Update_MetaData) to updateMetaData SDK method, it should be considered as a null and updated user MetaData as a null.