Skip to main content
This page documents all group-related methods available in the Baileys WhatsApp API.

Group Information

groupMetadata

Fetch the metadata for a group.
jid
string
required
The JID of the group
return
Promise<GroupMetadata>
Returns the group metadata including:
  • id: Group JID
  • subject: Group name
  • creation: Creation timestamp
  • owner: Group creator JID
  • participants: Array of group members
  • desc: Group description
  • announce: Whether only admins can send messages
  • restrict: Whether only admins can edit group info
  • And more properties
const metadata = await sock.groupMetadata('[email protected]')
console.log('Group name:', metadata.subject)
console.log('Participants:', metadata.participants.length)

groupFetchAllParticipating

Fetch all groups you are participating in.
return
Promise<{ [jid: string]: GroupMetadata }>
Returns an object mapping group JIDs to their metadata
const groups = await sock.groupFetchAllParticipating()
for (const [jid, metadata] of Object.entries(groups)) {
  console.log('Group:', metadata.subject)
}

Group Creation & Management

groupCreate

Create a new WhatsApp group.
subject
string
required
The name of the group
participants
string[]
required
Array of participant JIDs to add to the group
return
Promise<GroupMetadata>
Returns the metadata of the newly created group
const group = await sock.groupCreate(
  'My New Group',
  ['[email protected]', '[email protected]']
)
console.log('Created group:', group.id)

groupLeave

Leave a group.
id
string
required
The group JID to leave
await sock.groupLeave('[email protected]')

groupUpdateSubject

Update the group name/subject.
jid
string
required
The group JID
subject
string
required
The new group name
await sock.groupUpdateSubject('[email protected]', 'New Group Name')

groupUpdateDescription

Update the group description.
jid
string
required
The group JID
description
string | undefined
The new description, or undefined to remove it
// Set description
await sock.groupUpdateDescription('[email protected]', 'This is our group description')

// Remove description
await sock.groupUpdateDescription('[email protected]', undefined)

Participant Management

groupParticipantsUpdate

Add, remove, promote, or demote group participants.
jid
string
required
The group JID
participants
string[]
required
Array of participant JIDs to modify
action
ParticipantAction
required
The action to perform: 'add', 'remove', 'promote', or 'demote'
return
Promise<Array<{ status: string, jid: string }>>
Returns an array of results for each participant with status code and JID
// Add participants
const result = await sock.groupParticipantsUpdate(
  '[email protected]',
  ['[email protected]'],
  'add'
)

// Promote to admin
await sock.groupParticipantsUpdate(
  '[email protected]',
  ['[email protected]'],
  'promote'
)

// Remove participants
await sock.groupParticipantsUpdate(
  '[email protected]',
  ['[email protected]'],
  'remove'
)

groupRequestParticipantsList

Get list of users requesting to join the group (when join approval is enabled).
jid
string
required
The group JID
return
Promise<Array<{ jid: string }>>
Returns an array of participant objects with their JIDs
const requests = await sock.groupRequestParticipantsList('[email protected]')
for (const request of requests) {
  console.log('Pending request from:', request.jid)
}

groupRequestParticipantsUpdate

Approve or reject participant join requests.
jid
string
required
The group JID
participants
string[]
required
Array of participant JIDs to approve or reject
action
'approve' | 'reject'
required
Whether to approve or reject the requests
return
Promise<Array<{ status: string, jid: string }>>
Returns an array of results for each participant
// Approve requests
await sock.groupRequestParticipantsUpdate(
  '[email protected]',
  ['[email protected]'],
  'approve'
)

// Reject requests
await sock.groupRequestParticipantsUpdate(
  '[email protected]',
  ['[email protected]'],
  'reject'
)

Group Settings

groupSettingUpdate

Update group settings for announcements or edit permissions.
jid
string
required
The group JID
setting
'announcement' | 'not_announcement' | 'locked' | 'unlocked'
required
  • announcement: Only admins can send messages
  • not_announcement: All members can send messages
  • locked: Only admins can edit group info
  • unlocked: All members can edit group info
// Make announcement-only group
await sock.groupSettingUpdate('[email protected]', 'announcement')

// Lock group settings to admins only
await sock.groupSettingUpdate('[email protected]', 'locked')

groupToggleEphemeral

Enable or disable disappearing messages in a group.
jid
string
required
The group JID
ephemeralExpiration
number
required
Expiration duration in seconds (e.g., 86400 for 24 hours), or 0 to disable
// Enable 7-day disappearing messages
await sock.groupToggleEphemeral('[email protected]', 604800)

// Disable disappearing messages
await sock.groupToggleEphemeral('[email protected]', 0)

groupMemberAddMode

Control who can add members to the group.
jid
string
required
The group JID
mode
'admin_add' | 'all_member_add'
required
  • admin_add: Only admins can add members
  • all_member_add: All members can add members
// Only admins can add members
await sock.groupMemberAddMode('[email protected]', 'admin_add')

// All members can add members
await sock.groupMemberAddMode('[email protected]', 'all_member_add')

groupJoinApprovalMode

Enable or disable join approval mode for the group.
jid
string
required
The group JID
mode
'on' | 'off'
required
Whether to enable or disable join approval
// Enable join approval
await sock.groupJoinApprovalMode('[email protected]', 'on')

// Disable join approval
await sock.groupJoinApprovalMode('[email protected]', 'off')

Group Invites

groupInviteCode

Get the invite code for a group.
jid
string
required
The group JID
return
Promise<string | undefined>
Returns the group invite code
const code = await sock.groupInviteCode('[email protected]')
console.log('Invite link: https://chat.whatsapp.com/' + code)

groupRevokeInvite

Revoke the current invite code and generate a new one.
jid
string
required
The group JID
return
Promise<string | undefined>
Returns the new invite code
const newCode = await sock.groupRevokeInvite('[email protected]')

groupAcceptInvite

Join a group using an invite code.
code
string
required
The group invite code
return
Promise<string | undefined>
Returns the JID of the joined group
const groupJid = await sock.groupAcceptInvite('INVITE_CODE_HERE')
console.log('Joined group:', groupJid)

groupGetInviteInfo

Get information about a group from its invite code without joining.
code
string
required
The group invite code
return
Promise<GroupMetadata>
Returns the group metadata
const info = await sock.groupGetInviteInfo('INVITE_CODE_HERE')
console.log('Group name:', info.subject)
console.log('Participants:', info.size)

groupAcceptInviteV4

Accept a v4 group invite message.
key
string | WAMessageKey
required
The message key or JID of the person who sent the invite
inviteMessage
proto.Message.IGroupInviteMessage
required
The group invite message object
return
Promise<string>
Returns the group JID
const groupJid = await sock.groupAcceptInviteV4(
  messageKey,
  inviteMessage
)

groupRevokeInviteV4

Revoke a v4 invite for a specific person.
groupJid
string
required
The group JID
invitedJid
string
required
The JID of the person whose invite to revoke
return
Promise<boolean>
Returns true if successful
await sock.groupRevokeInviteV4(
  '[email protected]',
  '[email protected]'
)

Build docs developers (and LLMs) love