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
- 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.
- 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). - 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 ahttps://chat.whatsapp.com/{CODE}link, or the URL-encoded link. The answer gives the community's ID incommunity_id, orpendingwhen its admins approve new members. An unknown or revoked code gets a404. - 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 answers400to 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
| Action | Method | Good to know |
|---|---|---|
| Create | Create a Community | Also creates the announcement chat and a "General" chat. A name has 1 to 100 characters, a description at most 2048. |
| Rename, describe | Update a Community | join_approval makes admins approve new members. |
| Members | List all Community's Members | Every member, with is_admin. |
| Add a member | Add a Member to a Community | By 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 admin | Update a Member of a Community | is_admin: true or false. |
| Remove a member | Remove a Member from a Community | Also removes them from the community's chats. |
| Invite link | Get / Reset a Community's Invite Link | Resetting invalidates the previous link. |
| Join requests | List, Accept, Refuse | Requests exist when join_approval is on. |
| Chats | List, Add, Remove | Add 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. |
| Leave | Leave a Community | Also 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.
Updated 1 day ago
What’s Next
Continue with WhatsApp unsupported features.