Groups

  1. Groups help your users to converse together in a single space. You can have three types of groups - private, public, and password protected.
  2. A maximum of 100000 users can be added to a single group. The following error code would be provided ERR_PLAN_QUOTA_RESTRICTION if you're trying to add members greater than the limit.
  3. They support typing indicators, unread count, transient messages and read receipts.
  4. However, once the size of the group exceeds 300, the conversations and unread message counts are not updated.

📘

GUIDs would be automatically converted to lowercase while creating a group.

The following table lists the properties that the Group API supports.

Parameters

Type

Description

guid

string

  • (mandatory)_ Specifies group's unique ID. Maximum length is 100 characters.

Allowed characters: alpha-dash (a-z, 0-9 with -and _ ) without spaces

name

string

  • (mandatory)_ Specifies the group's name.
    Maximum length is 100 characters.\

It also supports emojis.

type

string

  • (optional)_ Specifies the type of the group.

Allowed types are:
public
private
password

If type is not passed, then by default public type is assigned.

password

string

  • (optional)_ Specifies the password required for a group.
    Only required incase of password protected group.

icon

string

  • (optional)_ Specifies the icon of the group.
    If left empty, no group icon is set for the group.\

CometChat doesn’t save the image on its servers.. There is no limit on the image resolution. It depends on the implementation.

Maximum length is 3000 characters.

description

string

  • (optional)_ Specifies the group description.

Maximum length is 255 characters.

owner

string

  • (optional)_ Specifies the owner of the group.
    If passed with the UID of an existing user, the User would be made the owner of the group.\

If not passed, the system user would be considered the owner of the group.

metadata

nested object

  • (optional)_ Specifies a JSON object to store up to 1.6K characters (JSON stringified metadata) for additional user information.

tags

array of strings

  • (optional)_ Specifies a list of tags to be associated with certain groups.

A maximum of 25 tags can be associated with a single group.

members

object

  • (optional)_ The members object allows adding members with the allowed member scopes and banning users.

It can have the below optional properties:

  • admins: A string array of UIDs of the existing users to be added as group admins.
  • moderators: A string array of UIDs of the existing users to be added as group moderators.
  • participants: A string array of UIDs of the existing users to be added as group participants.
  • usersToBan: A string array of UIDs of the existing users to be added as group participants.

Failure to adding a member or banning a user does not result into create group API failure.\ However, the individual member failure can be seen in the error objects in members.

If the same UID is added to more than one members array then the scope UID will get the scopes in the order below admin, moderator, participant.\ For example, if the UID superhero1 is part of admins, moderators and usersToBan arrays then it will appear in the only members.admins property in the response.

A maximum of 25 users can be added across all the scopes of member objects.

membersCount

integer

Specifies the number of members in the group.

createdAt

integer

UNIX Timestamp specifies the time when the user was created.

conversationId

string

Specifies the conversation ID of the group.