Groups

Create and manage WhatsApp groups over the API

Everything under /v1/connections/{connection}/groups. Group management is on paid plans, needs a linked connection, and every change is audited.

Create a group

A group for one property's viewings
curl https://www.chatrail.dev/v1/connections/sales/groups \
  -H "Authorization: Bearer $CHATRAIL_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "name": "Riverside viewings",
    "participants": ["+447700900123", "+447700900456"]
  }'

The response is the group in full — id, name, settings and each member's role. Use the id to send to it as { "group": "…" }, and to manage it below.

A WhatsApp group named Riverside viewings created over the API with two participants
Create a group with a name and its founding participants.

Members, admins and settings

FieldTypeNotes
POST /{group}/participants{ action, participants }add, remove, promote or demote.
PATCH /{group}name, description, …messages_admins_only, info_admins_only.
GET /{group}/invite—The chat.whatsapp.com link.
POST /{group}/invite/revoke—Invalidate the link and get a new one.
POST /{group}/leave—This number leaves.

Changing settings or members needs this number to be an admin; if it is not, WhatsApp refuses and the API says so. Joins, leaves and role changes — yours or anyone's — arrive as group.participants_changed.

The member-add guardrail

Adding people who did not ask to be in a group is one of the quickest ways to get a number reported. So a connection can add at most 20 people per hour — founding members included — and the request that would pass it is refused with 429 and how many are left this hour, before WhatsApp is contacted. Removals and role changes are not counted. Invite links are the better route for a large group: people join because they chose to.

A meter showing 20 of 20 member adds used this hour, and the next add request refused with a 429
At most 20 people can be added per connection per hour, founding members included.

Automatic AI replies in groups

Most messages in a group are members talking to each other. With AI replies on, the AI answers a group message only when it is addressed to this number: it @-mentions the number, or quotes one of its messages. Set the AI policy's group_replies to "all" to answer everything, or "off" to stay out of groups entirely. Quick follow-ups from other members never cancel or merge into a question the AI was asked.

BUILD IT

Wire it against the real schemas.

Every shape on this page is the one the endpoint validates. Verify it in your own stack before production rollout.

Start free