Callback listeners

Add all following callback methods while initializing the SDK. Callback listeners are functions that will be called whenever the specified event happens.

Example Request#

const connectionListener = (res) => {};
const presenceListener = (res) => {};
const friendsListListener = (res) => {};
const userProfileListener = (res) => {};
const messageListener = (res) => {};
const editMessageListener = (res) => {};
const replyMessageListener = (res) => {};
const favouriteMessageListener = (res) => {};
const groupProfileListener = (res) => {};
const groupMsgInfoListener = (res) => {};
const mediaUploadListener = (res) => {};
const mediaDownloadListener = (res) => {};
const blockUserListener = (res) => {};
const singleMessageDataListener = (res) => {};
const muteChatListener = (res) => {};
const archiveChatListener = (res) => {};
const userDeletedListener = (res) => {};
const adminBlockListener = (res) => {};
const initializeObj = {
licenseKey: "XXXXXXXXXXXXXXXXX",
callbackListeners: {
connectionListener,
presenceListener,
friendsListListener,
userProfileListener,
messageListener,
editMessageListener,
replyMessageListener,
favouriteMessageListener,
groupProfileListener,
groupMsgInfoListener,
mediaUploadListener,
mediaDownloadListener,
blockUserListener,
singleMessageDataListener,
muteChatListener,
archiveChatListener,
userDeletedListener
adminBlockListener
},
};
await SDK.initializeSDK(initializeObj);

Note: Callback Listener name should be the same as described below.

Connection Listener#

Handles Connection Status, triggered whenever connection status changes.

function connectionListener(response) {
if (response.status === "CONNECTED") {
console.log("SDK has connected to the server successfully.");
} else if (response.status === "DISCONNECTED") {
console.log("SDK has disconnected and lost the session. Reconnection was automatically called by the SDK.");
} else if (response.status === "CONNECTIONFAILED") {
console.log("SDK has failed to connect to the server.");
} else if (response.status === "RECONNECTING") {
console.log("SDK has started reconnecting to the server.");
} else if (response.status === "AUTHFAIL") {
console.log("SDK has invalid credentials.");
}
}

Sample Response:

{
status: "CONNECTED";
}

Possible Status:

StatusDescription
CONNECTEDConnection Established
DISCONNECTEDDisconnected
CONNECTIONTIMEOUTConnection Timeout
CONNECTIONFAILEDConnection Failed
AUTHFAILAuthentication Failed
ERROROCCUREDError

Presence Listener#

Handles Presence Status of Friends, triggered whenever users online/offline status changes.

function presenceListener(response) {
console.log("Presence Listener", response);
}

Sample Response:

{
fromUserJid: "", // String - Jid of the User
status: "", // String - "online"/"unavailable" Status
}

FriendsList Listener#

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

function friendsListListener(response) {
console.log("Friends List", response);
}

Sample Response:

{
users: [{
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
},
...
],
permission: "true" // To denote whether you have enabled contact permission in your mobile application or not
};

User Profile Listener#

Handles User Profile Stanzas, used to get the profile detail of the user. Triggered when Get User Profile method called. Receives object values.

function userProfileListener(response) {
console.log("User Profile Details Listener", response);
}

Sample Response:

{
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
status: "", // String - Use Profile Status
userId : "" // String - From User Id (Without Domain)
}

Message Listener#

Handles Message Stanzas, triggered whenever new message related events are received in single/group chat.

function messageListener(response) {
console.log("Message Listener", response);
}

Receive Message#

Handles when new message received.

Sample Response for Single Chat:

{
msgType: "", // String - value "receiveMessage"
chatType: "", // String - Chat Type - "chat" - Single
publisherJid: "", // String - Jid - One Who Sends the Message
publisherId: "", // String - Id - One Who Sends the Message
fromUserJid: "", // String - From User Jid -
// Will Be Same as PublisherJid in Case of Single Chat
fromUserId: "", // String - From User Id
toUserJid: "", // String - Jid - One Who Receives the Message
toUserId: "", // String - To User Id - One Who Receives the Message
metaData: {}, //Object - Meta data for the message
msgBody: {
message: "", // String - Message Body
message_type: "", // String - Message Type text, image, video, audio, file & meet
nickName: "", // String - User Nickname
mentionedUsersIds: [] // Array - Mentioned Ids In case of Group
media: { // For Media Message Only
androidHeight: 0,
androidWidth: 0,
audioType: "" // String - "file" or "recording"
caption: "", // String - Media Caption
duration: "", // String - Duration - For Audio/Videos
fileName: "", // String - File Name
file_key: "", // String - File Key
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
msgId: "", // String - Message Id
originalHeight: 0, // Number
originalWidth: 0, // Number
thumb_image: "", // Base64 - Thumb Image
webHeight: 0, // Number
webWidth: 0, // Number
},
meet: {
ย  ย  ย  title: "", // String - Title
ย  ย  ย  scheduledDateTime: 1695202750020, // Number - Timestamp - Milliseconds
ย  ย  ย  link: "ehl-niyc-wcc" // String - Link
ย  ย  }
},
msgId: "", // String - Message Id
topicId: "", //String - Topic Id for the message
msgStatus: "", // Number - Message Status
timestamp: 1681185232284, // Number - TimeStamp - Milliseconds
}

Sample Response for Group Chat:

{
msgType: "", // String - value "receiveMessage"
chatType: "", // String - Chat Type - "groupchat" - Group
publisherJid: "", // String - Jid - One Who Sends the Message
publisherId: "", // String - Id - One Who Sends the Message
fromUserJid: "", // String - From User Jid - GroupJid
fromUserId: "", // String - From User Id
toUserJid: "", // String - Jid - One Who Receives the Message
toUserId: "", // String - To User Id - One Who Receives the Message
msgBody: {
message: "", // String - Message Body
message_type: "", // String - Message Type text, image, video, audio, file & meet
nickName: "", // String - User Nickname
mentionedUsersIds: [] // Array - Group Mentioned Ids
media: { // For Media Message Only
androidHeight: 0,
androidWidth: 0,
audioType: "" // String - "file" or "recording"
caption: "", // String - Media Caption
duration: "", // String - Duration - For Audio/Videos
fileName: "", // String - File Name
file_key: "", // String - File Key
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
msgId: "", // String - Message Id
originalHeight: 0, // Number
originalWidth: 0, // Number
thumb_image: "", // Base64 - Thumb Image
webHeight: 0, // Number
webWidth: 0, // Number
},
meet: {
ย  ย  ย  title: "", // String - Title
ย  ย  ย  scheduledDateTime: 1695202750020, // Number - Timestamp - Milliseconds
ย  ย  ย  link: "ehl-niyc-wcc" // String - Link
ย  ย  }
},
msgId: "", // String - Message Id
msgStatus: "", // Number - Message Status
timestamp: 1681185232284, // Number - TimeStamp - Milliseconds
editedStatus: 0, // Number - Edited status - 0 or 1
}

For group, message status will be updated only if all the participants sent the delivery/seen status.

Acknowledgement#

An acknowledgement will be sent from the server whenever you sent a message stanzas to the server. For example, when you sent a delivery status to the message that you received, you will get an acknowledgment from the same.

Sample Response:

{
msgType: "", // String - value "acknowledge"
type: "", // String - value "delivery"
fromUserJid: "", // String - From User Jid (With Domain & Resource)
fromUserId: "", // String - From User Id (Without Domain)
msgId: "", // String - Message Id
msgStatus : "", // Number - Message Status
publisherId: "", //โ€‹ String - Publisher Id - One Who Sends the Message
timestamp: 1681185232284 // Number - TimeStamp - Milliseconds
}

Delivered Status#

Handles delivery status received from receipient user.

{
fromUserId: "", // String - From User Id/ Group Id (Without Domain)
fromUserJid: "", // String - From User Jid/ Group Jid (With Domain & Resource)
msgId: "", // String - Message Id
msgStatus: 1, // Number - Message Status
msgType: "", // String - value "delivered"
publisherId: "", // String - Publisher Id - One Who Sends the Message
publisherJid: "", // String - Publisher User Jid (With Domain)
timestamp: 1681185232284 // Number - TimeStamp - Milliseconds
}

Seen Status#

Handles seen status received from receipient user.

{
fromUserId: "", // String - From User Id/ Group Id (Without Domain)
fromUserJid: "", // String - From User Jid/ Group Jid (With Domain & Resource)
msgId: "", // String - Message Id
msgStatus: 1, // Number - Message Status
msgType: "", // String - value "seen"
publisherId: "", // String - Publisher Id - One Who Sends the Message
publisherJid: "", // String - Publisher User Jid (With Domain)
timestamp: 1681185232284 // Number - TimeStamp - Milliseconds
}

Typing/Gone Status#

Received when user starts/stops typing text message.

Sample Response:

{
msgType: "", // String - value "composing", "gone"
fromUserId: "", // String - From User Id
groupId: "" // String - Group Id / In case of Single Chat - Will be null
}

Deleted Message#

Received when message is delete (Delete For Me).

{
msgType: "", // String - value "deleteMessage"
chatType: "", // String - Chat Type - "chat" - Single - "groupchat" - Group
msgIds: [], // Array - Message Ids
lastMsgId : "" //String
}

Received when message is delete (Delete For Everyone).

{
msgType: "", // String - value "recallMessage"
fromUserJid: "", // String - From User Jid (With Domain & Resource)
timestamp: 1681185232284, // Number - TimeStamp - Milliseconds
msgId: "", // String - Message Id
fromUserId: "", // String - From User Id (Without Domain)
chatType: "" // String - Chat Type "chat"/"groupchat"
}

Clear/Delete Chat#

Received when clear/delete chat method is called.

{
msgType: "", // String - value "clearChat"/"deleteChat"
chatType: "", // String - Chat Type - "chat" - Single - "groupchat" - Group
fromUserId: "" // String - From User Id (Without Domain)
lastMsgId: "" // String - Last Message Id for ClearChat. In case of deleteChat means, it will be null
favourite: "" //String - value "0" or "1"
}

Clear/Delete All Chat#

Received when clear all/delete all chat method is called.

{
msgType: "", // String - value "clearAllChat"/"deleteAllChat"
}

Delete Group Chat#

Received when delete group method is called.

{
msgType: "", // String - value "deleteChat"
chatType: "", // String - "groupchat" - Group
fromUserId: "" // String - From User Id (Without Domain)
}

Logout#

When user tries to log in with another device using same credentials, then the 1st user receives logout message. (In order to logout the user).

Note: This is applicable for Same resource (Web) only. User can log in simultaneously with Web and Mobile.

{
msgType: "", // String - value "logout"/"carbonLogout"
}

Carbon Messages#

When user is connected to more than one device, Mobile and Web resources. In order to keep all messages upto date, carbon messsages are used. If the target user is online with multiple resources when the original message is sent, the device with highest priority receives the message and sends a carbon message to other resources. By default carbon will be enabled when SDK is initialized

Carbon Receive Message Sample Response:

{
msgType: "", // String - value "carbonReceiveMessage"
msgStatus: "", // Number - Message Status
msgId: "" // String - Message Id
fromUserJid: "", // String - From User Jid (With Domain & Resource)
fromUserId: "", // String - From User Id (Without Domain)
timestamp: 1681185232284, // Number - TimeStamp - Milliseconds
chatType: "", // String - Chat Type "chat"/"groupchat"
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
}
mediaResolvedKey: "", // String - Media Key
message: "", // String - Message
message_type: "" // String - Message Type
mid: "" // String - Message Id
},
topicId: "", //String - Topic Id for the message
publisherId: "", // String - Publisher Id - One Who Sends the Message
publisherJid: "", // String - Publisher User Jid (With Domain)
editedStatus: 0, // Number - Edited status - 0 or 1
}

Carbon Sent Acknowledgment Sample Response:

{
msgType: "", // String - value "carbonSentAcknowledge"
type: "", // String - value "delivery"
fromUserJid: "", // String - From User Jid (With Domain & Resource)
fromUserId: "", // String - From User Id (Without Domain)
msgId: "", // String - Message Id
msgStatus: 0, // Number - Message Status
publisherId: "", // String - Publisher Id
}

Carbon Typing/Gone Status Sample Response:

{
msgType: "", // String - value "carbonComposing" & "carbonGone"
fromUserJid: "", // String - From User Jid (With Domain & Resource)
displayName: "", // String - DisplayName(while composing)
groupid: "" // String - Only if it is group, otherwise null
}

Carbon Delivered Sample Response:

{
msgType: "", // String - value "carbonDelivered"
fromUserJid: "", // String - From User Jid (With Domain & Resource)
fromUserId: "", // String - From User Id (Without Domain)
msgId: "" // String - Message Id
timestamp: 1681185232284, // Number - TimeStamp - Milliseconds
msgStatus: 1, // Number - Message Status
publisherId: "", // String - Publisher Id
publisherJid: "", // String - Publisher Jid
}

Carbon Seen Sample Response:

{
msgType: "", // String - value "carbonSeen"
fromUserJid: "", // String - From User Jid (With Domain & Resource)
fromUserId: "", // String - From User Id (Without Domain)
msgId: "", // String - Message Id
timestamp: 1681185232284, // Number - TimeStamp - Milliseconds
msgStatus: 2, // Number - Message Status
publisherId: "", // String - Publisher Id
publisherJid: "", // String - Publisher Jid
}

Carbon Sent Message Sample Response:

{
msgType: "", // String - value "carbonSentMessage"
fromUserJid: "", // String - From User Jid (With Domain & Resource)
fromUserId: "", // String - From User Id (Without Domain)
msgId: "" // String - Message Id
toUserJid:"", // String - Jid - One Who Receives the Message
toUserId:"", // String - Id - One Who Receives the Message
timestamp: 1681185232284, // Number - TimeStamp - Milliseconds
msgBody: {
message: "", // String - Message
message_type: "", // String - Message Type
mid: "", // String - Message Id
mediaResolvedKey: "", // String - Media Key
media: { // For Media Message Only
androidHeight: 125, // Number
androidWidth: 250, // Number
caption: "", // String - Media Caption
dataTransferred: 0 // Number
duration: "", // String - Duration - For Audio/Videos
fileName: "", // String - File Name
file_key: "", // String - File Key
file_size: "", // Number - File Size
file_url: "", // String - File Url
isMultipleShare: "", // String
local_path: "", // String - File path
mediaDownloadStatus: 0, // Number - Download Status
mediaUploadStatus: 2, // Number - Upload Status
mid: "", // String - Message Id
progressStatus: 100 // Number - Progress Status
thumb_image: "", // Base64 - Thumb Image
webHeight: 165, // Number
webWidth: 330 // Number
}
chatType:"" // String - Chat Type - "chat"/"groupchat"
msgStatus: 0 // Number - Message Status
publisherId: "", // String - Publisher Id - One Who Sends the Message
publisherJid: "", // String - Publisher User Jid (With Domain)
editedStatus: 0, // Number - Edited status - 0 or 1
}

Carbon Clear/Delete Message Sample Response:

{
msgType: "", // String - value "carbonClearChat"/"carbonDeleteChat"
fromUserId: "", // String - From User Id (Without Domain)
chatType: "", // String - Chat Type - "chat"/"groupchat"
favourite: "", // String - favourite - "0" / "1"
lastMsgId: "" // String - Last Message Id (if carbonDeleteChat, it is null)
}

Carbon Clear/Delete All Sample Response:

{
msgType: "", // String - value "carbonClearAllChat"/"carbonDeleteAllChat"
}

Carbon Delete Message Sample Response: (Delete For Me)

{
msgType: "", // String - value "carbonDeleteMessage"
msgIds: "", // Array - Message Id's that are deleted
chatType: "", // String - Chat Type - "chat"/"groupchat"
fromUserId: "", // String - From User Id (Without Domain)
lastMsgId: "", // String - Last Message Id
}

Carbon Delete Message Sample Response: (Delete For Everyone)

{
msgType: "", // String - value "carbonRecallMessage"
fromUserJid: "", // String - From User Jid (With Domain & Resource)
timestamp: 1681185232284, // Number - TimeStamp - Milliseconds
msgId: "", // String - Message Id
fromUserId: "", // String - From User Id (Without Domain)
chatType: "" // String - Chat Type "chat"/"groupchat"
}

Carbon Group Delete Sample Response:

{
msgType: "", // String - value "carbonGroupDelete"
groupId: "", // String - Deleted Group Id
}

Carbon SentSeen Sample Response:

{
msgType: "", // String - value "carbonSentSeen"
fromUserJid: "", // String - From User Jid (With Domain & Resource)
fromUserId: "", // String - From User Id (Without Domain)
msgId: "", // String - Message Id
timestamp: 1681185232284, // Number - TimeStamp - Milliseconds
groupId: "", // String - Group Id(Only if groupChat, Otherwise empty)
toUserId:"", // String - Id - One Who Send the Message
toUserJid:"", // String - Jid - One Who Send the Message
}

Carbon SentRecall Sample Response:

{
msgType: "", // String - value "carbonSentRecall"
fromUserJid: "", // String - From User Jid (With Domain & Resource)
fromUserId: "", // String - From User Id (Without Domain)
msgId: "", // String - Message Id
timestamp: 1681185232284, // Number - TimeStamp - Milliseconds
chatType: "" // String - Chat Type - "chat"/"groupchat"
}

Edit Message Listener#

Receives Edited Messages, triggered whenever Edit Message related events are received in single/group chat.

function editMessageListener(response) {
console.log("Edit Message Listener", response);
}

Receive Edited Message#

Handles when the edited message received in the receiver.

Edited Sample Response for Single/Group Chat:

{
chatType: "", // String - Chat Type - "chat"/"groupchat"
editMessageId: "", // String - Unique EditMessageId
editedStatus: 1, // Number - Edited Status - 1
fromUserJid: "", // String - From User Jid -
// Will Be Same as PublisherJid in Case of Single Chat
fromUserId: "", // String - From User Id
metaData: {}, //Object - Meta data for the message
msgBody: {
mentionedUsersIds: [] // Array of edited mentioned users - For groupChat
message: "", // String - Edited Message
message_type: "", // String - Message Type
nickname: "", // String - nick name,
media: { // For Media Message Only
androidHeight: 0, // Number
androidWidth: 0, //Number
audioType: "" // String - "file" or "recording"
caption: "", // String - Edited Media Caption
duration: 0, // Number - Duration - For Audio/Videos
fileName: "", // String - File Name
file_key: "", // String - File Key
file_size: 1234, // 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 - Original MessageId of the message
originalHeight: 0, // Number
originalWidth: 0, // Number
thumb_image: "", // Base64 - Thumb Image
webHeight: 0, // Number
webWidth: 0, // Number
},
},
msgId: "", // String - Original MessageId of the message
msgStatus: 1, // Number - Messsage Status
msgType: "", // String - value "receiveMessage"
publisherId: "", // String - Id - One Who Sends the Message
publisherJid: "", // String - Jid - One Who Sends the Message
timestamp: 1705310998000, // Number - TimeStamp - Milliseconds
toUserId: "", // String - To User Id - One Who Receives the editedMessage - toUserId/groupId
toUserJid: "", // String - Jid - One Who Receives the editedMessage - toUserJid/groupJid
topicId: "", //String - Topic Id for the message
}

Edited Carbon Sent Message#

Handles when the edited message received in the carbonUsers.

Edited Sample Response for Single/Group Chat:

{
chatType: "", // String - Chat Type - "chat"/"groupchat"
editedStatus: 1, // Number - Edited Status - 1
fromUserId: "", // String - From User Id
fromUserJid: "", // String - From User Jid -
msgBody: {
mentionedUsersIds: [] // Array of edited mentioned users
message: "", // String - Edited Message
message_type: "", // String - Message Type
nickname: "", // String - nick name,
media: { // For Media Message Only
androidHeight: 0, // Number
androidWidth: 0, //Number
audioType: "" // String - "file" or "recording"
caption: "", // String - Edited Media Caption
duration: 0, // Number - Duration - For Audio/Videos
fileName: "", // String - File Name
file_key: "", // String - File Key
file_size: 1234, // Number - File Size
file_url: "", // String - File Url
isLargeFile: true, //Boolean - Is LargeFile
is_downloaded: 0, // Number - Downloaded Status
is_uploading: 2, // Number - Uploading Status
local_path: "", // String - Local Path
msgId: "", // String - Original MessageId of the message
originalHeight: 0, // Number
originalWidth: 0, // Number
thumb_image: "", // Base64 - Thumb Image
webHeight: 0, // Number
webWidth: 0, // Number
},
},
msgId: "", // String - Original MessageId of the message
msgStatus: 0, // Number - Messsage Status
msgType: "", // String - value "carbonSentMessage"
publisherId: "", // String - Id - One Who Sends the Message
publisherJid: "", // String - Jid - One Who Sends the Message
timestamp: 1705310998000, // Number - TimeStamp - Milliseconds
toUserId: "", // String - To User Id - One Who Receives the editedMessage - toUserId/groupId
toUserJid: "", // String - Jid - One Who Receives the editedMessage - toUserJid/groupJid
topicId: "", //String - Topic Id for the message
}

Reply Message Listener#

Handles Reply Message IQs, triggered when Get Reply Message method called. Receives an array of object values.

function replyMessageListener(response) {
console.log("replyMessageListener", response);
}

Sample Response:

[
{
chatType: "", // String - Chat Type - "chat"/"groupchat"
deleteStatus: "", // Number - Delete Status
deletedBy: "", // String - Deleted By
fromUserId: "", // String - Reply From User Id
groupId: "",
oldMsgId: "", // String - Old Message Id
replyMsgContent: "", // String - Reply Message Content
replyMsgId: "", // String - Reply Message Id
},
//...
];

Favourite Message Listener#

Handles Favourites Message lists, triggered when favourites status updated. Receives an array of object values.

function favouriteMessageListener(response) {
console.log("favouriteMessageListener", response);
}

Sample Response:

[
{
msgId: "", // String - Message Id
userId: "", // String - User Id
timestamp: 1681185232284, // Number - TimeStamp - Milliseconds
msgTo: "", // String - Message To
msgBody: "", // String - Message Body
msgStatus: "", // Number - Message Status
favMsgId: "", // String - Favourite Message Id
favDate: "", // String - Favourite Date
chatType: "", // String - Chat Type - "chat"/"groupchat"
fromNotification: "", // String - From Notification
editedStatus: 0, // Number - Edited status - 0 or 1
},
//...
];

Group Profile Listener#

Handles Group Profile Listener, triggered when group activities are requested/updated.

function groupProfileListener(response) {
console.log("Group Profile Listener", response);
}

Group Message Info Listener#

Handles Group Msg Info Listener, triggered when get group message info method triggered.

function groupMsgInfoListener(response) {
console.log("Group Message Info Listener", response);
}

New Participant Added#

Whenever new participant is added to group, groupProfileListener callback will be triggered and the following response will be received.

Sample Response:

{
newUserJid: "", // String - New User Jid (With Domain & Resource)
groupJid:"", // String - Group Jid
groupId:"", // String - Group Id
groupName: "", // String - Group Name
msgType: "", // String - Message Type - value ""userAdded""
userProfile: {
image: "", // String - User Image
thumbImage: "", // String - User ThumbImage
nickName: "", // String - User Nick Name
email: "", // String - User Email
status: "", // String - User Status
mobileNumber: "" // String - User Mobile Number
},
newUserId: "", // String - New User Id
publisherProfile: {
image: "", // String - User Image
thumbImage: "", // String - User ThumbImage
nickName: "", // String - User Nick Name
email: "", // String - User Email
status: "", // String - User Status
mobileNumber: "" // String - User Mobile Number
},
timestamp: 1681185232284, // Number - TimeStamp - Milliseconds
publisherJid: "", // String - Publisher User Jid (With Domain & Resource)
}

Group Profile Updated#

Handles Group Profile Data Stanzas, triggered when Set Group Profile method called or new group created. Receives an object values.

Sample Response:

{
publisherJid: "", // String - Publisher User Jid
groupJid: "", // String - Group Jid
msgType: "", // String - Message Type - value "profileUpdated"
timestamp: 1681185232284, // Number - TimeStamp - Milliseconds
groupProfile: {
nickName: "", // String - Group Nick Name
image: "", // String - Group Image
thumbImage: "" // String - Group ThumbImage
}
}

Participant Removed#

Whenever new participant is removed from group, groupProfileListener callback will be triggered and the following response will be received.

Same response will be handled for Exit Group method as well.

Sample Response:

{
userJid: "", // String - Removed/Left User Jid
groupJid: "", // String - Group Jid
itemId: "", // String - Item Id - Unique Id for the Group Participant
msgType: "", // String - Message Type - value "userRemoved"/"userLeft"
publisherJid: "", // String - Publisher User Jid
timestamp: 1681185232284, // Number - TimeStamp - Milliseconds
}

Make Admin#

Received when an member becomes admin of the group.

Sample Response:

{
doneBy: "", // String - Id of the User Who Made Member as a Admin
msgType: "", // String - Message Type - value "madeAdmin"
groupJid: "", // String - Group Jid
newAdminJid: "" // String - Member Id Who Became Admin
}

Group Deleted#

Received when an user deletes the group.

Sample Response:

{
msgType: "", // String - Message Type - value "groupDelete"
groupId: "", // String - Group Id
}

Media Upload Listener#

Handles Media Message upload progress, triggered when media message is sent. Receives an object values.

function mediaUploadListener(response) {
console.log("Media Upload Listener", response);
}

Sample Response:

{
msgId: "", // String - Message Id
progress: "", // Number - Upload Progress Percentage
}

Media Download Listener#

Handles Media Message download progress triggered when media message is dwonloading. Receives an Object values.

function mediaDownloadListener(response) {
console.log("Media Download Listener", response);
}

Sample Response:

{
msgId: "", // String - Message Id
progress: "", // Number - Download Progress Percentage
}

Block User Listener#

Handles User Block/Unblock Status, when user connected with 2 resource if one of the resource blocking/unblocking the user, other resource will be notified with this event.

function blockUserListener(response) {
console.log("blockUserListener", response);
}

Sample Response:

[
{
blockedUserId: "", // String - Blocked/Unblocked User Id
msgType: "", // String - Messge Type - "userBlockStatus"
type: "", // String - Block Type - "block_user"/"unblock_user"
},
//...
];

Single Message Data Listener#

Handles User Block/Unblock Status, when user connected with 2 resource if one of the resource blocking/unblocking the user, other resource will be notified with this event.

function singleMessageDataListener(response) {
console.log("singleMessageDataListener", response);
}

Mute Chat Listener#

Handles Chat Mute Status, triggered when the particular single/group chat is muted/unmuted.

function muteChatListener(response) {
console.log("Mute Chat Listener", response);
}

Sample Response:

{
fromUserJid: "", // String - From User Jid (With Domain & Resource)
fromUserId: "", // String - From User Id (Without Domain)
isMuted: false // Boolean
type: "" // String - To identify the response recevied from another resource or not
}

Archive Chat Listener#

Handles Chat Archive Status, triggered when the particular single/group chat is archived/unarchived.

function archiveChatListener(response) {
console.log("Archive Chat Listener", response);
}

Sample Response:

{
fromUserJid: "", // String - From User Jid (With Domain & Resource)
fromUserId: "", // String - From User Id (Without Domain)
isArchived: true // Boolean
type: "" // String - To identify the response recevied from another resource or not
}

User Deleted Listener#

Handles User Deleted Status, triggered when the particular user deleted his/her account.

function userDeletedListener(userJid) {
console.log("User Deleted Listener", userJid);
}

Admin User/Group Block/Unblock Listener#

This feature is used to get the users/groups admin blocked status. So that you can check the user/group avail status and communicate them.

function adminBlockListener(response) {
console.log("Archive Chat Listener", response);
}

Sample Response:

{
toUserJid: "", // String - To User Jid (With Domain)
toUserId: "", // String - To User Id (Without Domain)
blockStatus: "1" // "1" - Blocked, "0" - Unblocked
chatType: "" // String - Chat Type - "chat"/"groupchat"
type: "" // String
}

Own User Blocked/Unblocked#

The block/unblock status of own user (Logged In) by Admin will be received, so that you can navigate the user to show stopper screen. Once user blocked by admin, they cannot use the application.

Contact User Blocked/Unblocked#

The block/unblock status of other user by Admin will be received, so that you can show the status as user not available. And you cannot send messages to the blocked users.

Group Chat Blocked/Unblocked#

The block/unblock status of group chat by Admin will be received, so that you will be notified the group profile status. So that we cannot restrict the access to the group.