Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
AI Integration Quick Reference
Create a Group
UsecreateGroup() with a Group object. The groupType must be one of:
CometChatConstants.GROUP_TYPE_PUBLICCometChatConstants.GROUP_TYPE_PASSWORDCometChatConstants.GROUP_TYPE_PRIVATE
- Java
- Kotlin
createGroup() method takes the following parameters:
| Parameter | Description |
|---|---|
group | An instance of Group class |
Group class which contains all the information about the particular group.
Add members while creating a group
You can create a group and add members at the same time using thecreateGroupWithMembers() method. This method takes the Group object, an array of GroupMember objects to be added, and an array of UIDs to be banned.
To create an object of the Group class, you can use either of the following constructors:
new Group(String GUID, String name, String groupType, String password)new Group(String GUID, String name, String groupType, String password, String icon, String description)
groupType needs to be one of the following values:
CometChat.GROUP_TYPE.PUBLICCometChat.GROUP_TYPE.PASSWORDCometChat.GROUP_TYPE.PRIVATE
GroupMember class, you can use the following constructor:
new GroupMember(String UID, String scope)
- Java
- Kotlin
onSuccess() block of this method provides you with 2 sets of information:
Group: The group object containing information about the group that was created.HashMap<String, String>: A HashMap that contains the UID of the user that was supposed to be added as the key andsuccessor an error message as the value.
Group Class
| Field | Editable | Information |
|---|---|---|
| guid | Needs to be specified at group creation. Cannot be edited later | A unique identifier for a group |
| name | Yes | Name of the group |
| type | No | Type of the group: Can be 1. Public 2. Password 3. Private |
| password | No | Password for the group in case the group is of type password. |
| icon | Yes | An URL to group icon |
| description | Yes | Description about the group |
| owner | Yes | UID of the owner of the group. |
| metadata | Yes | Additional data for the group as JSON |
| createdAt | No | The unix timestamp of the time the group was created |
| updatedAt | No | The unix timestamp of the time the group was last updated |
| hasJoined | No | A boolean to determine if the logged in user is a member of the group. |
| joinedAt | No | The unix timestamp of the time the logged in user joined the group. |
| scope | Yes | Scope of the logged in user. Can be: 1. Admin 2. Moderator 3. Participant |
| membersCount | No | The number of members in the groups |
| tags | Yes | A list of tags to identify specific groups. |
Group Payload Structure
Group Object
Group Object
The
Sample Group Object:
Group object returned by SDK methods contains the following fields:| Parameter | Type | Description |
|---|---|---|
guid | String | Unique identifier of the group |
name | String | Display name of the group |
type | String | Group type. Values: "public", "private", "password" |
password | String | Password for protected groups (null for public/private groups) |
icon | String | URL to group icon image |
description | String | Description of the group |
owner | String | UID of the group owner |
metadata | JSONObject | Custom data set by developer. Can contain any key-value pairs |
createdAt | long | Unix timestamp when group was created |
updatedAt | long | Unix timestamp of last group update |
hasJoined | boolean | Whether the logged-in user has joined this group |
joinedAt | long | Unix timestamp when logged-in user joined the group |
scope | String | Logged-in user’s scope in group. Values: "admin", "moderator", "participant" |
membersCount | int | Total number of members in the group |
tags | Array<String> | List of tags for group identification and filtering |
isBannedFromGroup | boolean | Whether the logged-in user is banned from this group |
Next Steps
Join Group
Join existing groups to participate in conversations
Add Members
Add members to your created groups
Update Group
Modify group details and settings
Send Messages
Start sending messages in your group