Quick Reference for AI Agents & Developers
- Create group:
CometChat.createGroup(group:onSuccess:onError:) - Join group:
CometChat.joinGroup(GUID:groupType:password:onSuccess:onError:) - Leave group:
CometChat.leaveGroup(GUID:onSuccess:onError:) - List groups:
GroupsRequest.GroupsRequestBuilder().build()→groupsRequest.fetchNext(onSuccess:onError:) - Group types:
.public,.private,.password - Related: Create Group · Retrieve Groups · Group Members
Group Data Model
TheGroup class represents a CometChat group with all its properties and settings.
Group Properties
| Property | Type | Description |
|---|---|---|
guid | String | Unique group identifier (required) |
name | String? | Group display name (required) |
icon | String? | Group icon URL |
groupDescription | String? | Group description |
owner | String? | UID of the group owner |
groupType | groupType | Type: .public, .private, .password |
password | String? | Password for protected groups |
metadata | [String: Any]? | Custom metadata dictionary |
createdAt | Int | Creation Unix timestamp |
updatedAt | Int | Last update Unix timestamp |
joinedAt | Int | When current user joined |
scope | GroupMemberScopeType | Current user’s scope in group |
hasJoined | Bool | Whether current user has joined |
membersCount | Int | Total number of members |
tags | [String] | Array of group tags |
isBannedFromGroup | Bool | Whether current user is banned |
Creating a Group Object
- Swift
Success Response Example
- Swift
Group Type Enum
GroupMemberScopeType Enum
Common Error Codes
| Error Code | Description |
|---|---|
ERR_GUID_NOT_FOUND | Group with specified GUID does not exist |
ERR_ALREADY_JOINED | User has already joined the group |
ERR_NOT_A_MEMBER | User is not a member of the group |
ERR_WRONG_PASSWORD | Incorrect password for protected group |
ERR_GROUP_NOT_JOINED | Must join group before performing action |
ERR_PERMISSION_DENIED | Insufficient permissions for action |