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.
Check here for response format
#
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.
Check here for response format
#
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.
Check here for response format
#
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. An groupProfileListener callback will be triggered and response will be received.
#
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.
Check here for response format for both TypingStatus and GoneStatus 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 group, 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 MessageStatus | Description | Type | Required |
---|---|---|---|
TO_GROUP_JID | JID of the Group | JID String | true |
MESSAGE_BODY | Text Message Body | String | true |
#
Image MessageStatus | Description | Type | Required |
---|---|---|---|
IMAGE_FILE | Image File - Should be of type png , jpg , jpeg , svg & gif | File | true |
FILE_OPTIONS | File Option Params | Object | true |
FILE_OPTIONS.caption | Image Caption | String | false |
FILE_OPTIONS.thumbImage | Thumbnail Image - Base64 | String | false |
FILE_OPTIONS.msgId | Message Id | String | false |
caution
If Image attachment feature is unavailable for your plan, then it will throw 403 exception
#
Audio MessageStatus | Description | Type | Required |
---|---|---|---|
AUDIO_FILE | Image File - Should be of type mp3 , mpeg & wav | File | true |
FILE_OPTIONS | File Option Params | Object | true |
FILE_OPTIONS.caption | Audio Caption | String | false |
FILE_OPTIONS.duration | Audio Duration - "mm:ss" | String | false |
FILE_OPTIONS.msgId | Message Id | String | false |
caution
If Audio attachment feature is unavailable for your plan, then it will throw 403 exception
#
Video MessageStatus | Description | Type | Required |
---|---|---|---|
VIDEO_FILE | Image File - Should be of type mp4 | File | true |
FILE_OPTIONS | File Option Params | Object | true |
FILE_OPTIONS.caption | Video Caption | String | false |
FILE_OPTIONS.duration | Video Duration - "mm:ss" | String | false |
FILE_OPTIONS.thumbImage | Thumbnail Image for Video - Base64 | String | false |
FILE_OPTIONS.msgId | Message Id | String | false |
caution
If Video attachment feature is unavailable for your plan, then it will throw 403 exception
#
Document MessageStatus | Description | Type | Required |
---|---|---|---|
DOCUMENT_FILE | Document File - Accepted files are pdf , doc , xls , csv , ppt & txt | File | true |
FILE_OPTIONS | File Option Params | Object | true |
FILE_OPTIONS.caption | Document Caption | String | false |
FILE_OPTIONS.msgId | Message Id | String | false |
caution
If Document attachment feature is unavailable for your plan, then it will throw 403 exception
#
Media Message DataSend Media message as a meta data, here media will be uploaded externally (client side) and media information will be sent.
Status | Description | Type | Required |
---|---|---|---|
MSG_TYPE | Message Type - Accepted types are image , video , audio & file | File | true |
FILE_OPTIONS | File Option Params | Object | true |
FILE_OPTIONS.fileName | File Name | String | true |
FILE_OPTIONS.fileURL | File Url | String | true |
FILE_OPTIONS.fileSize | File Size | String | true |
FILE_OPTIONS.duration | Media Duration - "mm:ss" | String | true if MSG_TYPE is "audio"/"video" |
FILE_OPTIONS.thumbImg | Thumbnail Image - Base64 | String | true if MSG_TYPE is "video" |
FILE_OPTIONS.caption | Media Caption | String | false |
#
Example Requests#
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 |
#
Download MediaThis method is used to get the media file url when we download the media.In this download media same as described in the single chat section.
#
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.