Skip to main content

Create a Group

Use createGroup() to create a new group. Pass a Group object with the group details.
On success, returns a Group object with the created group’s details.
GUID can be alphanumeric with underscore and hyphen. Spaces, punctuation and other special characters are not allowed.

Add Members While Creating a Group

Use createGroupWithMembers() to create a group and add members in one operation. Parameters:
  • group — The Group object
  • members — Array of GroupMember objects to add
  • bannedMembers — Array of UIDs to ban (can be empty)
Create a GroupMember with: new CometChat.GroupMember(UID, scope)
Returns an object with two keys:
  • group — The created Group object
  • members — Object with UIDs as keys and "success" or error message as values

Group Class

The Group object has the following fields. Fields marked “Yes” in the Editable column can be modified after creation using updateGroup().

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