Skip to main content
Quick Reference for AI Agents & Developers
  • Create group: Group(guid:name:groupType:password:)CometChat.createGroup(group:onSuccess:onError:)
  • Create with members: CometChat.createGroupWithMembers(group:members:banMembers:onSuccess:onError:)
  • Group types: .public, .private, .password
  • Required fields: GUID, name, groupType
  • Optional: password (required for .password type), icon, description, metadata, tags
  • Related: Join Group · Retrieve Groups · Groups Overview

Group Class

The Group class represents a CometChat group with all its properties.

Group Initializers

Group Properties

* guid is specified at creation and cannot be edited later
Group Object Properties:
Creator is automatically assigned .admin scope with hasJoined = true

GUID Requirements


Create a Group

In other words, as a logged-in user, how do I create a public, private or password-protected group? You can create a group using createGroup() method. This method takes a Group object as a parameter.
GUID can be alphanumeric with underscore and hyphen. Spaces, punctuation and other special characters are not allowed.
Request Parameters:Success Response (Group Object):
Creator is automatically admin with hasJoined = true
Error Response (CometChatException):
Request Parameters:Success Response (Group Object):
Private groups require invitation to join. Creator is automatically admin.
Request Parameters:Success Response (Group Object):
Password is required for .password type groups. Creator is automatically admin.
Request Parameters:Success Response (Group Object):
Request Parameters:Metadata Properties:Success Response (Group Object):

Add Members While Creating a Group

You can create a group and add members at the same time using the createGroupWithMembers() method. This method takes the Group Object, Array of GroupMember Objects to be added & Array of UIDs to be banned.

GroupMember Class

Request Parameters:Members to Add:Success Response ([String: Any] Dictionary):Response - Created Group:Response - Added Members:Error Response (CometChatException):

GroupType Enum

MemberScope Enum

Common Error Codes