WhatsApp group API: read, send and stream group messages
A WhatsApp group API lets your own software list the groups a number is in, read recent group messages, post to a group and receive new messages as they happen. With AI for WhatsApp you link one number by QR code, create an API key and you are calling the group endpoints in a few minutes.
What the group API can do
The developer API and webhooks start on the Growth plan. WhatsApp group management for teams, the workflow built on top of it, is part of the Scale plan, which also has higher API rate limits.
- List the groups your linked number is in, with details and members.
- Read the recent messages of any group, up to 200 at a time.
- Send text or media to a group, or reply to a specific message.
- Rename a group, add or remove members (the number must be a group admin).
- Receive every new message and group event on your own server through webhooks.
Before you start
Every request sends the key as a Bearer token. In the examples, BASE stands for the base URL shown on your Developer API screen.
- Link a number by scanning the QR code in Linked Devices. For team groups, use a dedicated number, so it only sees the groups you add it to.
- Open the Developer API screen and create an API key. It is shown once, so store it safely.
- Add the linked number to the group you want to read. It sees only the groups it is a member of.
Test your key and list your groups
Group ids look like [email protected]. Keep the ids of the groups you care about, you will use them in every call below.
curl "$BASE/me" \
-H "Authorization: Bearer YOUR_API_KEY"curl "$BASE/groups" \
-H "Authorization: Bearer YOUR_API_KEY"Read recent messages and post to a group
Only send when the number is connected. The /me call returns a status, and it should be working before you post.
curl "$BASE/groups/[email protected]/messages?limit=50" \
-H "Authorization: Bearer YOUR_API_KEY"curl -X POST "$BASE/groups/[email protected]/messages" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "text": "Reminder: sales review at 5 PM today" }'Stream group messages in real time
Polling the messages endpoint works for a quick report. For a live dashboard, use webhooks instead. Save a webhook URL on the Developer API screen, tick message.any to receive every new message, and add the group events if you want to know when members join or leave.
Each call is a JSON POST with an event name, your session id and a payload. Group messages arrive with the group id, the one that ends in @g.us, in the from field, and the sender is identified in the payload and at the end of the message id.
{
"event": "message.any",
"session": "acct_ab12cd34ef56",
"payload": {
"id": "[email protected][email protected]",
"timestamp": 1790763300,
"from": "[email protected]",
"fromMe": false,
"body": "Met Northbridge Foods, demo done. Quote sent.",
"hasMedia": false
}
}What teams build with it
AI for WhatsApp does not ship a team dashboard today. You build it on the API, and we can also build one for your team depending on what you need to track. Email [email protected].
- A live board of what each person on a sales or operations team posted today.
- A daily report that lands in your inbox or in a manager group.
- Alerts when a group has been quiet, or when a keyword such as urgent appears.
- A CRM or sheet that fills itself from the updates people already send.
Frequently asked questions
Is this the official WhatsApp Business API?
No. AI for WhatsApp works through a linked device, like WhatsApp Web. That is not part of Meta's official API, and WhatsApp's terms restrict unofficial automation, so use a dedicated number and keep it to work groups.
Does every member of the group need AI for WhatsApp?
No. Only the number you link needs to be in the group. Everyone else keeps using WhatsApp as normal.
Can I read older messages than the last 200?
The messages endpoint returns up to 200 recent messages per call. For a full history, store messages as they arrive through webhooks.
Which plan do I need?
The developer API and webhooks start on Growth. Group management for teams is on Scale, which also has higher API rate limits.
Keep reading
Put an AI agent on your WhatsApp
Scan a QR code and it is live in about a minute. 7 days free, no card needed.
Start free trial