Skip to main content
Quick Reference for AI Agents & Developers
  • Join group: CometChat.joinGroup(GUID:groupType:password:onSuccess:onError:)
  • Public groups: No password required
  • Password groups: Password required
  • Private groups: Cannot join directly — must be added by admin/owner
  • Related: Create Group · Leave Group · Groups Overview

Join a Group

In order to start participating in group conversations, you will have to join a group. You can do so using the joinGroup() method.

Join Group Parameters

Group Type Behavior

Request Parameters:Success Response (Group Object):Success Response Properties After Join:Error Response (CometChatException):
Request Parameters:Success Response (Group Object):Error Response - Wrong Password:
Request Parameters:Error Response:
Private groups cannot be joined directly. Users must be added by an admin or owner.
Once you have joined a group successfully, you can send and receive messages in that group.
CometChat keeps a track of the groups joined and you do not need to join the group every time you want to communicate in the group. You can identify if a group is joined using the hasJoined parameter in the Group object.

Real-time Group Member Joined Events

In other words, as a recipient, how do I know when someone joins a group? To receive Real-Time Events for the same, you need to implement the onGroupMemberJoined() method of the CometChatGroupDelegate.
Event Trigger: Received via CometChatGroupDelegate.onGroupMemberJoined(action:joinedUser:joinedGroup:)ActionMessage Object:joinedUser (User Object):joinedGroup (Group Object):

Missed Group Member Joined Events

In other words, as a member of a group, how do I know if someone joins the group when my app is not running? When you retrieve the list of previous messages if a member has joined any group that the logged-in user is a member of, the list of messages will contain an Action message. An Action message is a sub-class of BaseMessage class. For the group member joined event, in the Action object received, the following fields can help you get the relevant information:

GroupType Enum

MemberScope Enum

Common Error Codes