Skip to main content
Add users to a group programmatically. Only admins and moderators can add members. The added users receive a notification and are immediately part of the group.

Add Members to Group

Available via: SDK | REST API | UI Kits
Use addMembersToGroup() to add members to a Group. In order to add members, you need to create an object of the GroupMember class. The UID and the scope of the GroupMember are mandatory.
On Success — A Map<String?, String?> where each key is the UID of the user and the value is either "success" or an error message:
In the onSuccess() callback, you will receive a Map which will contain the UID of the users and the value will either be success or an error message describing why the operation to add the user to the group failed.

Real-Time Group Member Added Events

When a group member is added by another member, this event is triggered. When a user joins a group on their own, the joined event is triggered.
Implement onMemberAddedToGroup() in GroupListener to receive real-time notifications when members are added.
Always remove group listeners when they’re no longer needed (e.g., in dispose()). Failing to remove listeners can cause memory leaks and duplicate event handling.

Missed Member Added Events

When you retrieve the list of previous messages, if a member has been added to 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 added event, in the Action object received, the following fields can help you get the relevant information:

Next Steps

Kick & Ban Members

Remove or ban members from a group

Change Member Scope

Promote or demote group members

Retrieve Group Members

Fetch the list of members in a group

Join a Group

Allow users to join public or password-protected groups