Skip to main content

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 the groupCreate method to create a new WhatsApp group with a title and initial participants.

Function Signature

Parameters:
  • subject - The name/title of the group
  • participants - Array of participant JIDs (must be in format number@s.whatsapp.net)
Returns: A GroupMetadata object containing the newly created group’s information

Basic Example

1

Create the group

2

Access group information

The returned GroupMetadata object contains:
  • id - The group JID
  • subject - The group name
  • participants - Array of group participants
  • creation - Unix timestamp of creation
  • And more metadata fields
3

Send a welcome message

Complete Example

Group Metadata Structure

The GroupMetadata interface returned by groupCreate contains:

Best Practices

Participant Format: Always ensure participant JIDs are in the correct format: number@s.whatsapp.net
Minimum Participants: WhatsApp may require a minimum number of participants to create a group. Always include at least 1 other participant besides yourself.
Error Handling: The groupCreate method will throw an error if the operation fails. Always wrap it in a try-catch block.

Tips

  1. Validate phone numbers before adding them as participants
  2. Check if numbers are registered on WhatsApp using onWhatsApp method
  3. Handle errors gracefully - some numbers may not be valid WhatsApp accounts
  4. 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