Send a Message
To send the message to the user, use the below methods. Different messages such as text, image, audio, video & document type messages can be sent using the below methods.
Text Message#
| Param | Description | Type | Required |
|---|---|---|---|
| toJid | JID of the To User | JID String | true |
| messageText | Text Message Body | String | true |
| mentionedUsersIds | Array of Group Mentioned UsersIds | Array of Strings | false |
| topicId | Topic Id for the Message | String | false |
| metaData | MetaData for the Message | Object | false |
Response Format:#
Image Message#
caution
If Image attachment feature is unavailable for your plan, then it will throw 403 exception
| Param | Description | Type | Required |
|---|---|---|---|
| toJid | JID of the To User | JID String | true |
| fileMessageParams | File Message Params | Object | true |
| fileMessageParams.file | Image File - Should be of type png, jpg, jpeg, svg & gif | File | true |
| fileMessageParams.thumbImage | Image 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. | String | false |
| fileMessageParams.fileSize | Image 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. | String | false |
| fileMessageParams.fileName | Image 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. | String | false |
| fileMessageParams.caption | Image Caption | String | false |
| replyMessageId | Message ID of Original Message | String | false |
| mentionedUsersIds | Array of Group Mentioned UsersIds | Array of Strings | false |
| topicId | Topic Id for the Message | String | false |
| metaData | MetaData for the Message | Object | false |
| onPending | Pending call back | function | true |
| onSuccess | Send Message success call back | function | true |
| onError | Send Message error call back | function | true |
onSuccess:#
caution
SDK.sendFileMessage() method was deprecated and will be removed in the future release. migrate to
SDK.sendMediaFileMessage() method to send Image files.
Audio Message#
caution
If Audio attachment feature is unavailable for your plan, then it will throw 403 exception
| Param | Description | Type | Required |
|---|---|---|---|
| toJid | JID of the To User | JID String | true |
| fileMessageParams | File Message Params | Object | true |
| fileMessageParams.file | Audio File - Should be of type mp3, mpeg & wav | File | true |
| fileMessageParams.fileSize | Audio 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. | String | false |
| fileMessageParams.fileName | Audio 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. | String | false |
| fileMessageParams.duration | Audio 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. | String | false |
| fileMessageParams.caption | Audio Caption | String | false |
| replyMessageId | Message ID of Original Message | String | false |
| mentionedUsersIds | Array of Group Mentioned UsersIds | Array of Strings | false |
| topicId | Topic Id for the Message | String | false |
| metaData | MetaData for the Message | Object | false |
| onPending | Pending call back | function | true |
| onSuccess | Send Message success call back | function | true |
| onError | Send Message error call back | function | true |
onSuccess:#
caution
SDK.sendFileMessage() method was deprecated and will be removed in the future release. migrate to
SDK.sendMediaFileMessage() method to send Audio files.
Video Message#
caution
If Video attachment feature is unavailable for your plan, then it will throw 403 exception
| Param | Description | Type | Required |
|---|---|---|---|
| toJid | JID of the To User | JID String | true |
| fileMessageParams | File Message Params | Object | true |
| fileMessageParams.file | Video File - Should be of type mp4 | File | true |
| fileMessageParams.fileSize | Video 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. | String | false |
| fileMessageParams.fileName | Video 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. | String | false |
| fileMessageParams.duration | Video 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. | String | false |
| fileMessageParams.thumbImage | Video 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. | String | false |
| fileMessageParams.caption | Video Caption | String | false |
| replyMessageId | Message ID of Original Message | String | false |
| mentionedUsersIds | Array of Group Mentioned UsersIds | Array of Strings | false |
| topicId | Topic Id for the Message | String | false |
| metaData | MetaData for the Message | Object | false |
| onPending | Pending call back | function | true |
| onSuccess | Send Message success call back | function | true |
| onError | Send Message error call back | function | true |
onSuccess:#
caution
SDK.sendFileMessage() method was deprecated and will be removed in the future release. migrate to
SDK.sendMediaFileMessage() method to send Video files.
Document Message#
caution
If Document attachment feature is unavailable for your plan, then it will throw 403 exception
| Param | Description | Type | Required |
|---|---|---|---|
| toJid | JID of the To User | JID String | true |
| fileMessageParams | File Message Params | Object | true |
| fileMessageParams.file | Document File - Accepted files are pdf, doc, xls, csv, ppt & txt | File | true |
| fileMessageParams.fileSize | Document 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. | String | false |
| fileMessageParams.fileName | Document 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. | String | false |
| fileMessageParams.caption | Document Caption | String | false |
| replyMessageId | Message ID of Original Message | String | false |
| mentionedUsersIds | Array of Group Mentioned UsersIds | Array of Strings | false |
| topicId | Topic Id for the Message | String | false |
| metaData | MetaData for the Message | Object | false |
| onPending | Pending call back | function | true |
| onSuccess | Send Message success call back | function | true |
| onError | Send Message error call back | function | true |
onSuccess:#
caution
SDK.sendFileMessage() method was deprecated and will be removed in the future release. migrate to
SDK.sendMediaFileMessage() method to send Document files.
Meet Message#
Before you send the meet message, you need to create the meet link using the createMeetLink method. Once the meet link has been created successfully, you can send the Meet message.
caution
If Group call feature is unavailable for your plan, then it will throw 403 exception
Response Format#
You can send the meet message by using the sendMeetMessage method. You can share the title, link and schdueled date and time using this method.
caution
If Group call feature is unavailable for your plan, then it will throw 403 exception
| Param | Description | Type | Required |
|---|---|---|---|
| toJid | JID of the To User/GROUP | JID String | true |
| link | Meet Link which we need to share | String | true |
| scheduledDateTime | Scheduled Date and Time | Number (Timestamp) | true |
| title | Meet Title which we need to share | String | false |
| mentionedUsersIds | Array of Group Mentioned UsersIds | Array of String | false |
| topicId | Topic Id for the Message | String | false |
| metaData | MetaData for the Message | String | false |
Response Format:#
Download Media#
This method is used to get the media file url when we download the media.
Request Param#
| Status | Description | Type | Required |
|---|---|---|---|
| msgId | msgId for the download message | String | true |
| onPending | Pending call back | function | true |
| onSuccess | Download Message success call back | function | true |
| onError | Download Message error call back | function | true |
onSuccess:#
Send Reply Message#
To send a reply to the original message, we are using sendTextMessage by passing in the additional parameter original message-id.
Request Param#
| Param | Description | Type | Required |
|---|---|---|---|
toJid | JID of the To User/Group | JID String | true |
messageText | Text Message Body | String | true |
replyMessageId | Message ID of Original Message | String | true |
mentionedUsersIds | Array of Group Mentioned UsersIds | Array | false |
topicId | Topic Id for the Message | String | false |
metaData | MetaData for the Message | Object | false |