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
CometChatGroupType.public | CometChatGroupType.password | CometChatGroupType.private
Member scopes: GroupMemberScope.admin | GroupMemberScope.moderator | GroupMemberScope.participantcreateGroup(), or create one and add members in a single call with createGroupWithMembers(). See the Group Class reference at the bottom for all available fields.
Create a Group
In other words, as a logged-in user, how do I create a public, private or password-protected group? UsecreateGroup() to create a new group. Pass a Group object with the group details.
| Group Type | Constant | Description |
|---|---|---|
| Public | CometChatGroupType.public | Any user can join |
| Password | CometChatGroupType.password | Users must provide the correct password |
| Private | CometChatGroupType.private | Users must be added by an admin/moderator |
Parameters
| Parameter | Type | Description |
|---|---|---|
group | Group | An instance of the Group class containing group details (guid, name, type, password) |
onSuccess | Function(Group group)? | Callback triggered on successful group creation |
onError | Function(CometChatException excep)? | Callback triggered on error |
- Dart
Response
Response
On Success — A
Group object containing all details of the newly created group:Group Object:| Parameter | Type | Description | Sample Value |
|---|---|---|---|
guid | string | Unique identifier for the group | "cometchat-guid-1" |
name | string | Display name of the group | "Hello Group!" |
icon | string | URL of the group icon | null |
description | string | Description of the group | null |
membersCount | number | Number of members in the group | 1 |
metadata | object | Custom metadata attached to the group | {} |
joinedAt | number | Epoch timestamp when the logged-in user joined the group | 1745554729 |
hasJoined | boolean | Whether the logged-in user has joined the group | true |
createdAt | number | Epoch timestamp when the group was created | 1745554729 |
owner | string | UID of the group owner | "cometchat-uid-1" |
updatedAt | number | Epoch timestamp when the group was last updated | 1745554729 |
tags | array | List of tags associated with the group | [] |
type | string | Type of the group (public, private, password) | "public" |
scope | string | Scope of the logged-in user in the group | "admin" |
password | string | Password for password-protected groups | null |
isBannedFromGroup | boolean | Whether the logged-in user is banned from the group | false |
Error
Error
| Parameter | Type | Description | Sample Value |
|---|---|---|---|
code | string | Error code identifier | "ERR_GUID_NOT_FOUND" |
message | string | Human-readable error message | "The specified group does not exist." |
details | string | Additional technical details | "Please provide a valid GUID for the group." |
Group object with the created group’s details.
Add Members While Creating a Group
UsecreateGroupWithMembers() to create a group and add members in one operation.
Parameters
| Parameter | Type | Description |
|---|---|---|
group | Group | The Group object with group details (guid, name, type, password) |
groupMembers | List<GroupMember> | List of GroupMember objects to add during creation |
bannedUserIds | List<String> | List of UIDs to ban upon creation (defaults to empty) |
onSuccess | Function(Group group)? | Callback triggered on successful creation |
onError | Function(CometChatException excep)? | Callback triggered on error |
GroupMember with: GroupMember(uid: "UID", scope: GroupMemberScope.participant)
- Dart
Response
Response
On Success — A
Group object containing all details of the newly created group:Group Object:| Parameter | Type | Description | Sample Value |
|---|---|---|---|
guid | string | Unique identifier for the group | "cometchat-guid-11" |
name | string | Display name of the group | "Hello Group!" |
icon | string | URL of the group icon | null |
description | string | Description of the group | null |
membersCount | number | Number of members in the group | 2 |
metadata | object | Custom metadata attached to the group | {} |
joinedAt | number | Epoch timestamp when the logged-in user joined the group | 1745554729 |
hasJoined | boolean | Whether the logged-in user has joined the group | true |
createdAt | number | Epoch timestamp when the group was created | 1745554729 |
owner | string | UID of the group owner | "cometchat-uid-1" |
updatedAt | number | Epoch timestamp when the group was last updated | 1745554729 |
tags | array | List of tags associated with the group | [] |
type | string | Type of the group (public, private, password) | "public" |
scope | string | Scope of the logged-in user in the group | "admin" |
password | string | Password for password-protected groups | null |
isBannedFromGroup | boolean | Whether the logged-in user is banned from the group | false |
Error
Error
| Parameter | Type | Description | Sample Value |
|---|---|---|---|
code | string | Error code identifier | "ERR_GUID_NOT_FOUND" |
message | string | Human-readable error message | "The specified group does not exist." |
details | string | Additional technical details | "Please provide a valid GUID for the group." |
Group Class
TheGroup object has the following fields. Fields marked “Yes” in the Editable column can be modified after creation using updateGroup().
| 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. |
Next Steps
Join a Group
Join public, private, or password-protected groups
Add Members
Add users to an existing group
Retrieve Groups
Fetch and filter group lists
Groups Overview
Overview of all group management features