Overview
Baileys provides simple methods to create WhatsApp groups programmatically. To modify group properties, you need to be a group admin.Creating a Group
Use thegroupCreate method to create a new WhatsApp group with a title and initial participants.
Function Signature
subject- The name/title of the groupparticipants- Array of participant JIDs (must be in formatnumber@s.whatsapp.net)
GroupMetadata object containing the newly created group’s information
Basic Example
1
Create the group
2
Access group information
GroupMetadata object contains:id- The group JIDsubject- The group nameparticipants- Array of group participantscreation- Unix timestamp of creation- And more metadata fields
3
Send a welcome message
Complete Example
Group Metadata Structure
TheGroupMetadata interface returned by groupCreate contains:
Best Practices
Participant Format: Always ensure participant JIDs are in the correct format:
number@s.whatsapp.netError Handling: The
groupCreate method will throw an error if the operation fails. Always wrap it in a try-catch block.Tips
- Validate phone numbers before adding them as participants
- Check if numbers are registered on WhatsApp using
onWhatsAppmethod - Handle errors gracefully - some numbers may not be valid WhatsApp accounts
- Store the group ID for future operations like sending messages or updating settings
Common Use Cases
Creating a group with verified participants
Creating a group and configuring initial settings
Related Methods
- Managing Participants - Add, remove, promote, and demote members
- Group Settings - Configure announcement mode, locked settings, and more
- Group Metadata - Fetch and understand group information