Use this file to discover all available pages before exploring further.
Baileys exposes a full set of group management methods on the sock object. Most operations that modify a group — changing its name, description, settings, or participants — require your account to be an admin of that group.
You must be a group admin to perform most of the operations on this page. Attempting them as a regular member will throw an error.
Pass a subject (the group name) and an array of participant JIDs. The resolved value contains a gid field with the new group’s JID.
// title & participantsconst group = await sock.groupCreate('My Fab Group', ['1234@s.whatsapp.net', '4564@s.whatsapp.net'])console.log('created group with id: ' + group.gid)await sock.sendMessage(group.id, { text: 'hello there' }) // say hello to everyone on the group
groupParticipantsUpdate handles all four participant actions in a single method. Pass the group JID, an array of participant JIDs, and one of the four action strings.
// id & people to add to the group (will throw error if it fails)await sock.groupParticipantsUpdate( jid, ['abcd@s.whatsapp.net', 'efgh@s.whatsapp.net'], 'add' // replace this parameter with 'remove' or 'demote' or 'promote')
groupSettingUpdate controls two independent aspects: who can send messages, and who can change group settings.
// only allow admins to send messagesawait sock.groupSettingUpdate(jid, 'announcement')// allow everyone to send messagesawait sock.groupSettingUpdate(jid, 'not_announcement')// allow everyone to modify the group's settings -- like display picture etc.await sock.groupSettingUpdate(jid, 'unlocked')// only allow admins to modify the group's settingsawait sock.groupSettingUpdate(jid, 'locked')
const response = await sock.groupRequestParticipantsUpdate( jid, // group id ['abcd@s.whatsapp.net', 'efgh@s.whatsapp.net'], 'approve' // or 'reject')console.log(response)
Caching group metadata significantly reduces latency and the number of IQ queries sent to WhatsApp’s servers, especially in bots that handle many groups simultaneously.