Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/wppconnect-team/wa-js/llms.txt

Use this file to discover all available pages before exploring further.

The WPP.community module provides access to WhatsApp Communities — a meta-group structure that links multiple groups under a single umbrella. Every community has one auto-generated announcement group that broadcasts updates to all members, plus any number of subgroups that members join individually. Community IDs use the same @g.us format as regular groups.
Communities are distinct from groups. A community’s ID (@g.us) is the parent container. Its subgroups and announcement group each have their own @g.us IDs. Functions in WPP.group continue to work on community subgroups — WPP.community adds the cross-group coordination layer.

WPP.community.create(name, desc, subGroupsIds)

Creates a new community with a name and description, then immediately links the given groups as subgroups.
create(
  name: string,
  desc: string,
  subGroupsIds: (string | Wid) | (string | Wid)[]
): Promise<{
  wid: Wid;
  subGroups: {
    failedGroups: { error: string; jid: string }[];
    linkedGroupJids: string[];
  };
}>
name
string
required
The community name shown to all members.
desc
string
required
A description for the community.
subGroupsIds
string | string[]
required
One or more existing group @g.us WIDs to link as subgroups at creation time.
Return value
object
// Create a community and link two existing groups
const result = await WPP.community.create(
  'Engineering Team',
  'Central hub for the engineering organisation',
  [
    '120363000000000001@g.us', // Frontend
    '120363000000000002@g.us', // Backend
  ]
);

console.log('Community ID:', result.wid.toString());
console.log('Linked:', result.subGroups.linkedGroupJids);
console.log('Failed:', result.subGroups.failedGroups);
Groups must already exist before linking. Create them first with WPP.group.create, then pass their IDs here — or use WPP.community.addSubgroups to link groups after the community is created.

WPP.community.deactivate(communityId)

Permanently deactivates (deletes) a community. Subgroups continue to exist as standalone groups after deactivation.
deactivate(communityId: string | Wid): Promise<any>
communityId
string | Wid
required
The @g.us WID of the community to deactivate.
await WPP.community.deactivate('120363000000000001@g.us');
Deactivating a community cannot be undone. Members will no longer see the community in their Communities tab, though the underlying subgroups remain intact.

WPP.community.addSubgroups(parentGroupId, subgroupIds)

Links one or more existing groups into a community.
addSubgroups(
  parentGroupId: string | Wid,
  subgroupIds: (string | Wid) | (string | Wid)[]
): Promise<{
  failedGroups: { error: string; jid: string }[];
  linkedGroupJids: string[];
}>
parentGroupId
string | Wid
required
The @g.us WID of the community (parent group).
subgroupIds
string | string[]
required
One or more @g.us WIDs of groups to link.
const result = await WPP.community.addSubgroups(
  '120363000000000001@g.us',
  ['120363000000000003@g.us', '120363000000000004@g.us']
);

console.log('Linked successfully:', result.linkedGroupJids);
if (result.failedGroups.length > 0) {
  console.warn('Failed to link:', result.failedGroups);
}

WPP.community.removeSubgroups(parentGroupId, subgroupIds)

Unlinks one or more subgroups from a community. The groups themselves are not deleted — they become standalone groups again.
removeSubgroups(
  parentGroupId: string | Wid,
  subgroupIds: (string | Wid) | (string | Wid)[]
): Promise<{
  failedGroups: { error: string; jid: string }[];
  linkedGroupJids: string[];
}>
parentGroupId
string | Wid
required
The @g.us WID of the community.
subgroupIds
string | string[]
required
One or more @g.us WIDs of subgroups to unlink.
await WPP.community.removeSubgroups(
  '120363000000000001@g.us',
  '120363000000000003@g.us'
);

WPP.community.getSubgroups(communityId)

Returns the WIDs of all subgroups (including the announcement group) linked to a community. You can pass either the community’s own ID or the ID of any subgroup within it.
getSubgroups(communityId: string | Wid): Wid[]
communityId
string | Wid
required
The @g.us WID of the community or any of its linked subgroups.
Note: this function is synchronous — it reads from the local GroupMetadataStore and throws WPPError('group_not_exist') if the community metadata is not loaded.
const subgroupIds = WPP.community.getSubgroups('120363000000000001@g.us');
subgroupIds.forEach(id => console.log('Subgroup:', id.toString()));

WPP.community.getAnnouncementGroup(communityId)

Returns the WID of the community’s announcement group, or undefined if it cannot be found in the local store.
getAnnouncementGroup(communityId: string | Wid): Wid | undefined
communityId
string | Wid
required
The @g.us WID of the community or any of its linked subgroups.
The announcement group is the group with groupType === 'LINKED_ANNOUNCEMENT_GROUP'. Only admins can post to it; all community members receive its messages.
const announcementId = WPP.community.getAnnouncementGroup('120363000000000001@g.us');
if (announcementId) {
  console.log('Announcement group:', announcementId.toString());
  // You can use WPP.chat.sendTextMessage to post announcements here
}

WPP.community.getParticipants(communityId)

Returns all participants across the entire community (aggregated from the announcement group).
getParticipants(communityId: string | Wid): Promise<any>
communityId
string | Wid
required
The @g.us WID of the community.
const members = await WPP.community.getParticipants('120363000000000001@g.us');
console.log('Total community members:', members.length);

WPP.community.promoteParticipants(communityId, participantsIds)

Promotes one or more community members to community admin.
promoteParticipants(
  communityId: string | Wid,
  participantsIds: (string | Wid) | (string | Wid)[]
): Promise<any>
communityId
string | Wid
required
The @g.us WID of the community.
participantsIds
string | string[]
required
One or more @c.us WIDs to promote.
await WPP.community.promoteParticipants(
  '120363000000000001@g.us',
  '15550001234@c.us'
);

WPP.community.demoteParticipants(communityId, participantsIds)

Removes admin status from one or more community participants.
demoteParticipants(
  communityId: string | Wid,
  participantsIds: (string | Wid) | (string | Wid)[]
): Promise<{
  participants: string | string[];
  success: boolean;
  error?: any;
}>
communityId
string | Wid
required
The @g.us WID of the community.
participantsIds
string | string[]
required
One or more @c.us WIDs to demote.
const result = await WPP.community.demoteParticipants(
  '120363000000000001@g.us',
  '15550001234@c.us'
);

if (result.success) {
  console.log('Demoted successfully');
} else {
  console.error('Demotion failed:', result.error);
}

How communities differ from groups

A community is a parent container with a mandatory announcement group and optional linked subgroups. Regular groups are flat — no hierarchy.
Joining a community’s announcement group makes you a community member. You can additionally join individual subgroups within the community. Subgroup membership is independent — you do not need to be in all subgroups to be a community member.
Community admins (set via WPP.community.promoteParticipants) have admin rights across the entire community structure. Subgroup admins (set via WPP.group.promoteParticipants) only have admin rights in their specific group.
Only community admins can post to the announcement group. All community members — even those not in a particular subgroup — receive announcement-group messages.

Full workflow example

// 1. Create two subgroups
const frontend = await WPP.group.create('Frontend', ['15550001234@c.us']);
const backend  = await WPP.group.create('Backend',  ['15550005678@c.us']);

// 2. Create the community and link both groups immediately
const community = await WPP.community.create(
  'Engineering Org',
  'All engineering teams',
  [frontend.gid.toString(), backend.gid.toString()]
);
console.log('Community:', community.wid.toString());

// 3. Find the announcement group
const announcementId = WPP.community.getAnnouncementGroup(community.wid.toString());

// 4. Promote a member to community admin
await WPP.community.promoteParticipants(community.wid.toString(), '15550001234@c.us');

// 5. Add another team later
const design = await WPP.group.create('Design', ['15550009999@c.us']);
await WPP.community.addSubgroups(community.wid.toString(), design.gid.toString());

Build docs developers (and LLMs) love