Skip to main content

Overview

Baileys provides comprehensive methods for managing group participants, including adding/removing members and changing admin roles. Only group admins can perform these operations.

Group Participants Update

The main method for managing participants is groupParticipantsUpdate, which handles multiple actions.

Function Signature

Parameters:
  • jid - The group JID
  • participants - Array of participant JIDs to update
  • action - One of: 'add', 'remove', 'promote', 'demote', or 'modify'
Returns: Array of results showing the status for each participant

Adding Participants

Add new members to an existing group.

Basic Example

Handling Results

Success Status: A status of '200' indicates successful operation. Other codes indicate errors.

Removing Participants

Remove members from the group.
Admin Permissions Required: You must be a group admin to remove participants. Attempting to remove participants without admin rights will result in an error.

Safely Removing Participants

Promoting Participants

Promote regular members to admin status.

Promote with Confirmation

Demoting Participants

Demote admins back to regular member status.
Super Admin: The group creator (super admin) cannot be demoted. Attempting to demote the creator will fail.

Managing Join Requests

For groups with join approval mode enabled, you can approve or reject join requests.

Get Join Request List

Approve/Reject Join Requests

Function Signature

Approve Requests

Reject Requests

Complete Join Request Handler

Participant Structure

Participants in group metadata have the following structure:

Best Practices

1

Check admin status before operations

Verify you have admin permissions before attempting to modify participants.
2

Handle errors gracefully

Always check the status codes returned from participant updates.
3

Validate participant JIDs

Ensure JIDs are properly formatted before operations.

Common Use Cases

Batch Add with Error Handling

Automatic Admin Assignment