Managing Group Participants
ThegroupParticipantsUpdate method allows you to add, remove, promote, or demote participants in a group.
Adding Participants
Removing Participants
Promoting to Admin
Demoting from Admin
Method Signature
jid- The group JIDparticipants- Array of participant JIDs to updateaction- One of:'add','remove','promote', or'demote'
status- HTTP-style status code ('200'for success, error code otherwise)jid- The participant’s JIDcontent- Raw binary node response
Handling Join Requests
When a group requires approval to join, you can manage pending requests.Getting Request List
Retrieve the list of users who have requested to join the group.Method Signature
jid- The group JID
Approving or Rejecting Requests
Approve or reject join requests from users.Method Signature
jid- The group JIDparticipants- Array of participant JIDs to approve or rejectaction- Either'approve'or'reject'
The status will be
'200' for successful operations or an error code if the operation failed.Understanding Participant Status
When you receive the response from participant operations, the status codes follow HTTP conventions:200- Operation successful403- Forbidden (e.g., user has blocked the group or you)404- User not found- Other codes indicate various error conditions
Best Practices
Check return values
Always check the
status field in the response to verify if each participant was successfully added, removed, or updated.Handle partial failures
When updating multiple participants, some operations may succeed while others fail. Process each result individually.
Validate JIDs
Use
onWhatsApp() to verify that participant JIDs exist before attempting to add them to groups.