Mentioning a User

To mention the user(participant) along with a message in a group, Use this below methods to pass mentionedUsersIds param provided to all kind of messages such as Text, Image, video, Audio, Document.

Text Message#

await SDK.sendTextMessage({
toJid: "",
messageText: "",
mentionedUsersIds: [],
topicId: "",
metaData: {}
});
ParamDescriptionTypeRequired
toJidJID of the GroupJID Stringtrue
messageTextText Message BodyStringtrue
mentionedUsersIdsArray of Group Mentioned UsersIdsArray of Stringsfalse
topicIdTopic Id for the MessageStringfalse
metaDataMetaData for the MessageObjectfalse

Response Format:#

statusCode: "", // Number - status code
message: "", // String - Success/Error Message
data:
{
chatType: "", // String - Chat Type - "chat"
createdAt: "", // String - Message Created Time
deleteStatus: "", // Number - Delete Status
favouriteBy: "", // String - Favourited By - User
favouriteStatus: "", //Number - Favourite status
fromUserJid: "", // String - From User Jid
metaData: {}, //Object - Meta data for the message
msgBody: {
message: "", // String - Message Body
message_type: "", // String - Message Type
nickname: "", // String - nick name
mentionedUsersIds : [] // Array of mentioned users
},
topicId: "", //String - Topic id for the message
msgId: "", // String - Unique Message Id
msgType: "", // String - Group Message Type
publisherId: "", // String - user Id
timestamp: 1681185232000, // Number - TimeStamp - Milliseconds
},

Image Message#

caution

If Image attachment feature is unavailable for your plan, then it will throw 403 exception

await SDK.sendFileMessage({
toJid: "",
messageType: "image",
fileMessageParams: {
file: FILE, // Or .fileUrl = FILE_URL (You can also send a file message with a file URL.)
caption: "",
},
replyMessageId: "",
mentionedUsersIds: [],
topicId: "",
metaData: {}
});
ParamDescriptionTypeRequired
toJidJID of the GroupJID Stringtrue
fileMessageParamsFile Message ParamsObjecttrue
fileMessageParams.fileImage File - Should be of type png, jpg, jpeg, svg & gifFiletrue
fileMessageParams.thumbImageImage File Thumb Image. When the value not given, SDK will generate thumb image for the given FILE. When using the fileUrl SDK won't generate the thumb image.Stringfalse
fileMessageParams.fileSizeImage File Size. When the value not given, SDK will detect the size of the given FILE. When using the fileUrl SDK won't detect the size.Stringfalse
fileMessageParams.fileNameImage File Name. When the value not given, SDK will detect the name of the given FILE. When using the fileUrl SDK won't detect the name.Stringfalse
fileMessageParams.captionImage CaptionStringfalse
replyMessageIdMessage ID of Original MessageStringfalse
mentionedUsersIdsArray of Group Mentioned UsersIdsArray of Stringsfalse
topicIdTopic Id for the MessageStringfalse
metaDataMetaData for the MessageObjectfalse

Response Format:#

statusCode: "", // Number - status code
message: "", // String - Success/Error Message
data:
{
chatType: "", // String - Chat Type - "chat"
createdAt: "", // String - Message Created Time
deleteStatus: "", // Number - Delete Status
favouriteBy: "", // String - Favourited By - User
favouriteStatus: "", //Number - Favourite status
fromUserJid: "", // String - From User Jid
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
fileToken: "", // String - File Url
is_downloaded: "", // Number - Downloaded Status
is_uploading: "", // Number - Uploading Status
local_path: "", // String - Local Path
thumb_image: "", // Base64 - Thumb Image
}
message_type: "", // String - Message Type
nickname: "", // String - nick name
mentionedUsersIds: [] // Array of mentioned users
},
msgId: "", // String - Unique Message Id
topicId: "", //String - Topic id for the message
msgType: "", // String - Group Message Type
publisherId: "", // String - user Id
timestamp: 1681185232000, // Number - TimeStamp - Milliseconds
},

Audio Message#

caution

If Audio attachment feature is unavailable for your plan, then it will throw 403 exception

await SDK.sendFileMessage({
toJid: "",
messageType: "audio",
fileMessageParams: {
file: FILE, // Or .fileUrl = FILE_URL (You can also send a file message with a file URL.)
caption: "",
},
replyMessageId: "",
mentionedUsersIds: [],
topicId: "",
metaData: {}
});
ParamDescriptionTypeRequired
toJidJID of the GroupJID Stringtrue
fileMessageParamsFile Message ParamsObjecttrue
fileMessageParams.fileAudio File - Should be of type mp3, mpeg & wavFiletrue
fileMessageParams.fileSizeAudio File Size. When the value not given, SDK will detect the size of the given FILE. When using the fileUrl SDK won't detect the size.Stringfalse
fileMessageParams.fileNameAudio File Name. When the value not given, SDK will detect the name of the given FILE. When using the fileUrl SDK won't detect the name.Stringfalse
fileMessageParams.durationAudio File Duration. When the value not given, SDK will detect the duration of the given FILE. When using the fileUrl SDK won't detect the duration.Stringfalse
fileMessageParams.captionAudio CaptionStringfalse
replyMessageIdMessage ID of Original MessageStringfalse
mentionedUsersIdsArray of Group Mentioned UsersIdsArray of Stringsfalse
topicIdTopic Id for the MessageStringfalse
metaDataMetaData for the MessageObjectfalse

Response Format:#

statusCode: "", // Number - status code
message: "", // String - Success/Error Message
data:
{
chatType: "", // String - Chat Type - "chat"
createdAt: "", // String - Message Created Time
deleteStatus: "", // Number - Delete Status
favouriteBy: "", // String - Favourited By - User
favouriteStatus: "", //Number - Favourite status
fromUserJid: "", // String - From User Jid
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
fileToken: "", // String - File Url
is_downloaded: "", // Number - Downloaded Status
is_uploading: "", // Number - Uploading Status
local_path: "", // String - Local Path
thumb_image: "", // Base64 - Thumb Image
}
message_type: "", // String - Message Type
nickname: "", // String - nick name
mentionedUsersIds: [] // Array of mentioned users
},
msgId: "", // String - Unique Message Id
topicId: "", //String - Topic id for the message
msgType: "", // String - Group Message Type
publisherId: "", // String - user Id
timestamp: 1681185232000, // Number - TimeStamp - Milliseconds
},

Video Message#

caution

If Video attachment feature is unavailable for your plan, then it will throw 403 exception

await SDK.sendFileMessage({
toJid: "",
messageType: "video",
fileMessageParams: {
file: FILE, // Or .fileUrl = FILE_URL (You can also send a file message with a file URL.)
caption: ""
},
replyMessageId: "",
mentionedUsersIds: [],
topicId: "",
metaData: {}
});
ParamDescriptionTypeRequired
toJidJID of the GroupJID Stringtrue
fileMessageParamsFile Message ParamsObjecttrue
fileMessageParams.fileVideo File - Should be of type mp4Filetrue
fileMessageParams.fileSizeVideo File Size. When the value not given, SDK will detect the size of the given FILE. When using the fileUrl SDK won't detect the size.Stringfalse
fileMessageParams.fileNameVideo File Name. When the value not given, SDK will detect the name of the given FILE. When using the fileUrl SDK won't detect the name.Stringfalse
fileMessageParams.durationVideo File Duration. When the value not given, SDK will detect the duration of the given FILE. When using the fileUrl SDK won't detect the duration.Stringfalse
fileMessageParams.thumbImageVideo File Thumb Image. When the value not given, SDK will generate thumb image for the given FILE. When using the fileUrl SDK won't generate the thumb image.Stringfalse
fileMessageParams.captionVideo CaptionStringfalse
replyMessageIdMessage ID of Original MessageStringfalse
mentionedUsersIdsArray of Group Mentioned UsersIdsArray of Stringsfalse
topicIdTopic Id for the MessageStringfalse
metaDataMetaData for the MessageObjectfalse

Response Format:#

statusCode: "", // Number - status code
message: "", // String - Success/Error Message
data:
{
chatType: "", // String - Chat Type - "chat"
createdAt: "", // String - Message Created Time
deleteStatus: "", // Number - Delete Status
favouriteBy: "", // String - Favourited By - User
favouriteStatus: "", //Number - Favourite status
fromUserJid: "", // String - From User Jid
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
fileToken: "", // String - File Url
is_downloaded: "", // Number - Downloaded Status
is_uploading: "", // Number - Uploading Status
local_path: "", // String - Local Path
thumb_image: "", // Base64 - Thumb Image
}
message_type: "", // String - Message Type
nickname: "", // String - nick name
mentionedUsersIds: [] // Array of mentioned users
},
msgId: "", // String - Unique Message Id
topicId: "", //String - Topic id for the message
msgType: "", // String - Group Message Type
publisherId: "", // String - user Id
timestamp: 1681185232000, // Number - TimeStamp - Milliseconds
},

Document Message#

caution

If Document attachment feature is unavailable for your plan, then it will throw 403 exception

await SDK.sendFileMessage({
toJid: GroupJID,
messageType: "file",
fileMessageParams: {
file: FILE, // Or .fileUrl = FILE_URL (You can also send a file message with a file URL.)
caption: ""
},
replyMessageId: "",
mentionedUsersIds: [],
topicId: "",
metaData: {}
});
ParamDescriptionTypeRequired
toJidJID of the GroupJID Stringtrue
fileMessageParamsFile Message ParamsObjecttrue
fileMessageParams.fileDocument File - Accepted files are pdf, doc, xls, csv, ppt & txtFiletrue
fileMessageParams.fileSizeDocument File Size. When the value not given, SDK will detect the size of the given FILE. When using the fileUrl SDK won't detect the size.Stringfalse
fileMessageParams.fileNameDocument File Name. When the value not given, SDK will detect the name of the given FILE. When using the fileUrl SDK won't detect the name.Stringfalse
fileMessageParams.captionDocument CaptionStringfalse
replyMessageIdMessage ID of Original MessageStringfalse
mentionedUsersIdsArray of Group Mentioned UsersIdsArray of Stringsfalse
topicIdTopic Id for the MessageStringfalse
metaDataMetaData for the MessageObjectfalse

Response Format:#

statusCode: "", // Number - status code
message: "", // String - Success/Error Message
data:
{
chatType: "", // String - Chat Type - "chat"
createdAt: "", // String - Message Created Time
deleteStatus: "", // Number - Delete Status
favouriteBy: "", // String - Favourited By - User
favouriteStatus: "", //Number - Favourite status
fromUserJid: "", // String - From User Jid
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
fileToken: "", // String - File Url
is_downloaded: "", // Number - Downloaded Status
is_uploading: "", // Number - Uploading Status
local_path: "", // String - Local Path
thumb_image: "", // Base64 - Thumb Image
}
message_type: "", // String - Message Type
nickname: "", // String - nick name
mentionedUsersIds: [] // Array of mentioned users
},
msgId: "", // String - Unique Message Id
topicId: "", //String - Topic id for the message
msgType: "", // String - Group Message Type
publisherId: "", // String - user Id
timestamp: 1681185232000, // Number - TimeStamp - Milliseconds
},

Send Reply Message#

To send a reply to the original message, we are using sendTextMessage by passing in the additional parameter original message-id.

await SDK.sendTextMessage({
toJid: "",
messageText: "",
replyMessageId: "",
mentionedUsersIds: [],
topicId: "",
metaData: {}
});

Request Param#

ParamDescriptionTypeRequired
toJidJID of the GroupJID Stringtrue
messageTextText Message BodyStringtrue
replyMessageIdMessage ID of Original MessageStringtrue
mentionedUsersIdsArray of Group Mentioned UsersIdsArrayfalse
topicIdTopic Id for the MessageStringfalse
metaDataMetaData for the MessageObjectfalse

Receive Message#

To receive the incoming message from other users, you need to implement the event messageListener , which will be triggered whenever a new message is received. Once the message is received it automatically send the delivery status to the user if the logged-in user is online.

When Receives message with mentioned users in group, the mentionedUserIds are received in messageListener callback response body. Click here to check the received response format for groupchat.