Group JIDs
Groups use a special JID (Jabber ID) format to identify them in the WhatsApp network:- Group JIDs end with
@g.us(e.g.,[email protected]) - Individual user JIDs end with
@s.whatsapp.net - When creating groups or performing operations, Baileys automatically handles JID encoding
Group metadata
Group metadata contains comprehensive information about a group, including participants, settings, and descriptions.Fetching metadata
Metadata structure
TheGroupMetadata object includes:
Group JID identifier
Group name/title
JID of the user who last changed the group name
Timestamp when the group name was last changed
Group description text
JID of the user who set the description
Description ID used for updates
Timestamp when the description was last changed
Group creation timestamp
JID of the group creator
Number of participants in the group
Array of participant objects with
id, admin role, and optional phoneNumber/lidWhether the group is announcement-only (only admins can send messages)
Whether group settings are restricted to admins only
Ephemeral message duration in seconds (if enabled)
Whether all members can add participants (true) or only admins (false)
Whether join requests require admin approval
Whether the group is part of a community
JID of the parent community (if applicable)
Fetching all participating groups
You can retrieve metadata for all groups you’re participating in with a single call:- Building a group list UI
- Syncing group information on startup
- Caching group data locally
The
groupFetchAllParticipating function automatically emits a groups.update event, which you can listen to for keeping your local cache in sync.Caching and dirty bits
Bailey’s uses a “dirty bits” system to track when group data needs refreshing:- When groups are modified, WhatsApp sends a dirty bit notification
- Baileys automatically listens for these notifications on the
CB:ib,,dirtyevent - When groups are marked dirty,
groupFetchAllParticipatingis called automatically - After syncing, dirty bits are cleaned with
cleanDirtyBits('groups')
Understanding dirty bits
Understanding dirty bits
Dirty bits are WhatsApp’s way of signaling that cached data is stale. When you receive a dirty bit notification for groups, it means one or more groups you’re in have been modified (name changed, participant added/removed, settings updated, etc.). Baileys handles this automatically, but you can also manually trigger a refresh by calling
groupFetchAllParticipating().Participant roles
Group participants can have different admin roles:null- Regular member'admin'- Group admin'superadmin'- Group creator/owner (has all admin privileges)