Communities

Join, create and administer WhatsApp communities with Unipile API.

A WhatsApp community is managed with the Communities API. Its messages are not its own: they are posted in its chats, the announcement chat and the other group chats linked to it, which are regular group chats of the Messaging API.


How messages arrive

  1. Joining a community joins its announcement chat. Its messages then arrive like those of any group chat: List all Chats, List all Messages from a Chat and the same webhooks.
  2. Get a Community lists the IDs of the community's known chats in chat_ids, its announcement chat included. Send to the announcement chat with Send a Message (as an admin).
  3. Each other chat of the community is joined with its own invite code (Join a Chat), then behaves like any group chat.

The community itself is not a chat: it does not appear in the chats list. The chats of a community carry specifics.community: its id and the chat's role (announcement_group or group_chat).


Join and find communities

  • Join a Community takes the invite code as community_id: the end of a https://chat.whatsapp.com/{CODE} link, or the URL-encoded link. The answer gives the community's ID in community_id, or pending when its admins approve new members. An unknown or revoked code gets a 404.
  • An invite to a group chat that is not a community is joined with Join a Chat, with the code in invite_code. Each method answers 400 to the other kind of invite.
  • Get a Community with an invite code previews the community before joining it.
  • Perform Communities Search searches the account's communities by name.
curl --request POST \
     --url https://api.unipile.com/v2/{ACCOUNT_ID}/communities/{INVITE_CODE}/join \
     --header 'X-API-KEY: {YOUR_API_KEY}'

Create and administer a community

ActionMethodGood to know
CreateCreate a CommunityAlso creates the announcement chat and a "General" chat. A name has 1 to 100 characters, a description at most 2048.
Rename, describeUpdate a Communityjoin_approval makes admins approve new members.
MembersList all Community's MembersEvery member, with is_admin.
Add a memberAdd a Member to a CommunityBy an admin of the community (403 otherwise). Already a member: 409; not on WhatsApp: 422; privacy settings forbid it: 403, send the invite link instead.
Make adminUpdate a Member of a Communityis_admin: true or false.
Remove a memberRemove a Member from a CommunityAlso removes them from the community's chats.
Invite linkGet / Reset a Community's Invite LinkResetting invalidates the previous link.
Join requestsList, Accept, RefuseRequests exist when join_approval is on.
ChatsList, Add, RemoveAdd links an existing group chat (chat_id, the account must administer it) or creates one (name). Removing a chat keeps it and its members. The announcement chat cannot be removed.
LeaveLeave a CommunityAlso leaves its chats. The account that created a community cannot leave it (403).

A member an admin removed can no longer join with the invite link (403): add them back with Add a Member to a Community. A group chat that is not a community is administered with the Messaging API's chat and participant methods.


Not supported

Deactivating a community, and joining a community chat from the community's list without its invite code, are not supported.


What’s Next

Continue with WhatsApp unsupported features.

Did this page help you?