Groups
Every group method on the socket, with the exact signatures from the package. Group JIDs end in @g.us.
Method reference
| Method | Signature | Notes |
|---|---|---|
groupMetadata(jid) | โ Promise<GroupMetadata> | Subject, owner, participants (with admin flags), settings, creation time |
groupCreate(subject, participants) | โ Promise<GroupMetadata> | Guarded by AunuAntiBan when wrapped (default: max 2 per 10 min) |
groupLeave(id) | โ Promise<void> | Leave a group |
groupParticipantsUpdate(jid, participants, action) | action: 'add' | 'remove' | 'promote' | 'demote' | Returns a per-participant { status, jid } list โ always check statuses, adds can partially fail (privacy settings). 'add' is AntiBan-guarded (default: max 3 per group per 10 min) |
groupUpdateSubject(jid, subject) | โ Promise<void> | Rename the group (subject to group settings/admin) |
groupUpdateDescription(jid, description?) | โ Promise<void> | Set or clear the description |
groupInviteCode(jid) | โ Promise<string | undefined> | The current invite code โ full link is https://chat.whatsapp.com/<code> |
groupRevokeInvite(jid) | โ Promise<string | undefined> | Revoke and regenerate the invite code; the old link dies immediately |
groupAcceptInvite(code) | โ Promise<string | undefined> | Join via invite code; resolves to the group JID |
groupGetInviteInfo(code) | โ Promise<GroupMetadata> | Preview a group from its code without joining |
groupAcceptInviteV4(key, inviteMessage) | Accept a group invite message (the v4 invite someone sent you in chat) | |
groupRevokeInviteV4(groupJid, invitedJid) | โ Promise<boolean> | Revoke a v4 invite you sent to a specific person |
groupRequestParticipantsList(jid) | โ Promise<{ [key]: string }[]> | Pending join requests (approval mode) |
groupRequestParticipantsUpdate(jid, participants, action) | action: 'approve' | 'reject' | Decide join requests |
groupSettingUpdate(jid, setting) | 'announcement' | 'not_announcement' | 'locked' | 'unlocked' | announcement = only admins can post; locked = only admins can edit group info |
groupMemberAddMode(jid, mode) | 'admin_add' | 'all_member_add' | Who may add members |
groupJoinApprovalMode(jid, mode) | 'on' | 'off' | Require admin approval for invite-link joins |
groupToggleEphemeral(jid, ephemeralExpiration) | seconds | Disappearing messages for the group: 86400 (24h), 604800 (7d), 7776000 (90d), 0 = off |
groupFetchAllParticipating() | โ Promise<{ [jid]: GroupMetadata }> | Every group the account is in, with metadata โ one call |
Everyday operations
// Create and announce
const g = await sock.groupCreate('Launch Team', ['12125550123@s.whatsapp.net'])
await sock.sendMessage(g.id, { text: 'Group is live ๐ค' })
// Promote / demote / remove โ one call, many participants
await sock.groupParticipantsUpdate(g.id, [jidA], 'promote')
await sock.groupParticipantsUpdate(g.id, [jidB], 'remove')
// Lock the group down: admins-only posting + join approval
await sock.groupSettingUpdate(g.id, 'announcement')
await sock.groupJoinApprovalMode(g.id, 'on')
// Approve everyone waiting
const pending = await sock.groupRequestParticipantsList(g.id)
const jids = pending.map(p => p.jid).filter(Boolean)
if (jids.length) await sock.groupRequestParticipantsUpdate(g.id, jids, 'approve')
// Share the invite link
const code = await sock.groupInviteCode(g.id)
console.log('https://chat.whatsapp.com/' + code)
Reading metadata like a pro
const meta = await sock.groupMetadata(groupJid)
const admins = meta.participants.filter(p => p.admin) // 'admin' | 'superadmin'
const isBotAdmin = admins.some(p => p.id === sock.user.id.split(':')[0] + '@s.whatsapp.net')
console.log(meta.subject, meta.participants.length, 'members ยท announce mode:', !!meta.announce)
AntiBan interplay: with
wrapAntiBan active, mass-adding members will hit the guard fast (3 adds/group/10 min by default) and the call throws a 429 Boom. That's deliberate. If your flow legitimately onboards groups, raise groupAddMax consciously โ don't unwrap the guard.