Group chat
Groups is the simplest way to chat with multiple user at any given time.
caution
If GroupChat feature is unavailable for your plan, then the below methods will not be able to access and throw 403 exception
#
Create GroupTo create a new group use below method. Once the request is made successfully, an groupProfileListener callback will be triggered. Response will be of two types, one is for successfull adding of participant with both party details and other one is for group profile udpate.
#
Request ParamsStatus | Description | Type | Required |
---|---|---|---|
GROUP_NAME | Group Name | String | true |
USER_JID | Array of User JID | JID String | true |
GROUP_IMAGE | Profile Image - Upload an image file or image URL | File / String | false |
#
Get GroupJidUse the below method to generate the GroupJID using the GroupId.
#
Example Request#
Example Response#
Get All GroupsTo get the all groups that the user part of, send a request as described below.
Check here for response format
#
Set Group Profile DetailTo set the Profile detail of the group, send a request as described below. Once the request is made successfully, an groupProfileListener callback will be triggered and a updated profile response will be received for all group participants.
#
Request ParamsStatus | Description | Type | Required |
---|---|---|---|
GROUP_JID | Group JID | JID String | true |
GROUP_NAME | Nickname of the Group | String | true |
GROUP_IMAGE | Group Image - Upload an image file or image URL | File / String | false |
#
Get Group Profile DetailTo get the Profile detail of the group, send a request as described below. Once the request is made successfully, an groupProfileListener callback will be triggered and a group profile response will be received.
#
Request ParamsStatus | Description | Type | Required |
---|---|---|---|
GROUP_JID | Grouop JID | JID String | true |
#
Get Group ParticipantsTo get the all the group members, send a request as described below.
#
Request ParamsStatus | Description | Type | Required |
---|---|---|---|
GROUP_JID | Grouop JID | JID String | true |
#
Add ParticipantsTo add a participants to a existing group use below method. You can add multiple participants by passing multiple USER_JID
. Once the request is made successfully, an groupProfileListener callback will be triggered and response will be received for all group participants.
#
Request ParamsStatus | Description | Type | Required |
---|---|---|---|
GROUP_JID | Group JID | JID String | true |
GROUP_NAME | Group Name | String | true |
USER_JID | Array of To User JID | JID String | true |
#
Remove ParticipantTo remove a participant from a existing group use below method. Once the request is made successfully, an groupProfileListener callback will be triggered and response will be received for all group participants.
#
Request ParamsStatus | Description | Type | Required |
---|---|---|---|
GROUP_JID | Group JID | JID String | true |
USER_JID | User JID | JID String | true |
IS_ADMIN | Whether the To User is Admin or not | Boolean | true |
#
Make As AdminTo make a participant as a admin to the group. Once the request is made successfully, an groupProfileListener callback will be triggered and response will be received for all group participants.
#
Request ParamsStatus | Description | Type | Required |
---|---|---|---|
GROUP_JID | Group JID | JID String | true |
USER_JID | User JID | JID String | true |
#
Exit GroupTo leave a group for the participant use below method. If the user is admin pass isAdmin as a true, otherwise false. Once the request is made successfully, an groupProfileListener callback will be triggered and response will be received for all group participants.
#
Request ParamsStatus | Description | Type | Required |
---|---|---|---|
GROUP_JID | Group JID | JID String | true |
USER_JID | User JID | JID String | true |
IS_ADMIN | Whether the User is Admin or not | String | true |
#
Delete GroupTo delete the group for the user.
#
Request ParamsStatus | Description | Type | Required |
---|---|---|---|
GROUP_JID | Group JID | JID String | true |
#
Get Chat MessagesTo get the chat history of the selected user, send a request to the server as described below.
Check here for response format
Without Pagination
With Pagination
Example
#
Request ParamsStatus | Description | Type | Required |
---|---|---|---|
GROUP_JID | JID of the To Group | JID String | true |
POSITION | Position for Pagination | String | false |
LAST_ROW_ID | Last Row ID of Pagination | String | false |
LIMIT | Pagination Limit | Number | false |
Note: POSITION - Accepts "down"/"up"
#
Response ParamsArguments | Description | Type |
---|---|---|
statusCode | Status Code | Number |
message | Success/Error Message | String |
data | Array of Object datas | Array |
#
Send Typing StatusYou can able to send the typing/gone status to the group so that all group participants can aware of that the user is typing the message. If you want to send the typing status for a group, you can utilize the below method.
When the user starts typing the message in the input box of the chat window, call the below method to send the composing status, so that they can show a typing message in the header/recent chat.
Once the user stopped/finished typing the message send the gone status as described below, so that they can hide a typing message in the header/recent chat.
#
Method parameterStatus | Description | Type | Required |
---|---|---|---|
GROUP_JID | Group JID | JID String | true |
#
Send MessageTo 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.
Note: Send message to single and group chat uses same methods. SDK will identify the difference by the JID format. If the
TO_JID
has themix
in it, it is considered as a group chat otherwise single chat. Single chat send message methods are defined here.
#
Text MessageParam | Description | Type | Required |
---|---|---|---|
toJid | Group JID | JID String | true |
messageText | Text Message Body | String | true |
replyMessageId | Message ID of Original Message | String | false |
mentionedUsersIds | Array of Group Mentioned UsersIds | Array | false |
#
Response Format:#
Image Messagecaution
If Image attachment feature is unavailable for your plan, then it will throw 403 exception
Param | Description | Type | Required |
---|---|---|---|
toJid | Group JID | 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 | false |
#
Response Format:#
Audio Messagecaution
If Audio attachment feature is unavailable for your plan, then it will throw 403 exception
Param | Description | Type | Required |
---|---|---|---|
toJid | Group JID | 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 | false |
#
Response Format:#
Video Messagecaution
If Video attachment feature is unavailable for your plan, then it will throw 403 exception
Param | Description | Type | Required |
---|---|---|---|
toJid | Group JID | 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 | false |
#
Response Format:#
Document Messagecaution
If Document attachment feature is unavailable for your plan, then it will throw 403 exception
Param | Description | Type | Required |
---|---|---|---|
toJid | Group JID | 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 | false |
#
Response Format:#
Download MediaThis method is used to get the media file url when we download the media.
#
Request ParamStatus | Description | Type | Required |
---|---|---|---|
fileToken | File Url | String | true |
filekey | File key is optional param, which we get from the selected Media message Body | String | false |
#
Example Requests#
Response Format#
Get Group Media MessagesTo get the media messages for the particular groupchat. On initial request it fetches three media. Then on the pagination request by passing the last message-id, it fetches 10 next media messages.
Check here for response format
caution
If getMediaMessages feature is unavailable for your plan, then it will throw 403 exception
Without Pagination
With Pagination
#
Request ParamsStatus | Description | Type | Required |
---|---|---|---|
TO_GROUP_JID | JID of the Group | JID String | true |
LAST_MESSAGE_ID | Last Message ID of Pagination | String | false |
#
Get Group Message InfoTo get the group message info use below method. It retrieves the message info with the number of group members has received and seen the message. Once the request is made successfully, an groupMsgInfoListener callback will be triggered and response will be received;
#
Request ParamsStatus | Description | Type | Required |
---|---|---|---|
GROUP_JID | JID of the Group | JID String | true |
MESSAGE_ID | Message ID | String | true |
#
Clear & Delete MessageClear and Delete Message follows same as described in the single chat section. Instead of sending user jid, group jid will be sent to clear/delete group related chats.