Creating a group
Create a new group with a name and initial participants:The group name/title
Array of participant JIDs to add to the group (must use
@s.whatsapp.net format)GroupMetadata object containing the new group’s information, including its JID.
The user creating the group automatically becomes the owner/superadmin.
Leaving a group
Leave a group you’re currently participating in:Invite codes
Invite codes allow users to join groups via a link without needing to be added by an admin.Getting the invite code
Retrieve the current invite code for a group:Only group admins can retrieve invite codes.
Revoking invite codes
Revoke the current invite code and generate a new one:- The invite link was shared publicly and you want to restrict access
- You suspect unauthorized users have the link
- You want to temporarily disable link-based joining
Joining groups
There are multiple ways to join a group using Baileys.Join using invite code
Join a group using its invite code:The invite code (without the
https://chat.whatsapp.com/ prefix)The code parameter should be just the code itself, not the full URL. For example, use
'ABC123DEF456' instead of 'https://chat.whatsapp.com/ABC123DEF456'.Join using GroupInviteMessage
Accept a group invite from aGroupInviteMessage:
- Accepts the invite and joins the group
- Updates the invite message to mark it as expired
- Generates a group add notification message
The message key or JID of the person who sent the invite
The group invite message object containing
groupJid, inviteCode, and inviteExpirationGet group info from invite code
Retrieve group information before joining:Revoke a v4 invite
Revoke a specific invite sent to a user:Join requests
When a group has join approval mode enabled, users who try to join via invite link must be approved by an admin.Getting join requests
Retrieve the list of pending join requests:jid- The user’s JIDrequest_method- How they requested to joinrequest_time- Timestamp of the request
Approving or rejecting requests
Process join requests by approving or rejecting them:The group JID
Array of participant JIDs to approve or reject
Whether to approve or reject the join requests
Handling join request workflows
Handling join request workflows
A typical join request workflow:
Only group admins can approve or reject join requests.
Updating group subject and description
Change group name
Change group description
- Fetches the current metadata to get the previous description ID
- Sends the update with proper tracking
- Handles description deletion if no description is provided