Skip to main content
Note: Only admins and moderators can add members. The result HashMap contains UID as key and “success” or error message as value.

Add Members to Group

Use addMembersToGroup() with the group GUID, a list of GroupMember objects, and an optional list of UIDs to ban.
In the onSuccess() method of the CallbackListener, you will receive a HashMap 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 or ban the user failed.

Real-Time Group Member Added Events

When a member is added to a group, existing members receive a real-time event in onMemberAddedToGroup() of the GroupListener class. The callback provides an Action object, the adding User, the added User, and the Group.
When a member is added by another user, onMemberAddedToGroup() fires. When a user joins on their own, onGroupMemberJoined() fires instead.

Member Added to Group event in Message History

When fetching message history, if a member was added to a group the logged-in user is part of, the list will contain an Action message with these fields:
  1. action - added
  2. actionOn - User object containing the details of the user who was added to the group
  3. actionBy - User object containing the details of the user who added the member to the group
  4. actionFor - Group object containing the details of the group to which the member was added
Always remove group listeners when they’re no longer needed (e.g., in onDestroy() or when navigating away). Failing to remove listeners can cause memory leaks and duplicate event handling.

GroupMember Payload Structure

The GroupMember object extends User and contains all User fields plus group-specific fields:Sample GroupMember Object:

Next Steps

Kick Member

Remove members from groups

Change Member Scope

Update member roles and permissions

Retrieve Members

Fetch list of group members

Group Listeners

Handle real-time group events