Tutorial

Send Messages to Existing WhatsApp Groups with an API

Post to WhatsApp groups you already use, without recreating them. What the official Groups API allows, how an unofficial linked-device API reaches your groups, the ban risk, and working code.

November 29, 2026By Retention Stack
Open in AI

You already have WhatsApp groups with your team, suppliers or subcontractors, and you want your own system to post in them without recreating them.

Can the official API post into an existing group?

Not as far as Meta's documentation shows. The Groups API on the WhatsApp Business Platform requires an Official Business Account, caps a group at 8 participants, and has people join through an invite link. It does not work with WhatsApp Business app numbers. We found nothing in it for taking over a group you created in the app.

The other route is an unofficial API that connects to your account as a linked device, the way WhatsApp Web does. It sees the groups that account is already in. Our API works this way.

Read this before you connect a number

WhatsApp's terms do not approve this kind of connection, and it can restrict or ban the number. Low volume lowers the risk but does not remove it. A ban affects every chat and group on that number.

  • •Use a number you can afford to lose. If you use a separate one, add it to each group first.
  • •Send only to groups where people know you and expect the message.
  • •Space your sends out.

The full list is on our ban risk page.

What you need

  • •An account and one connected number. Scan the QR code from the console; WhatsApp keeps working on your phone as it does with any linked device.
  • •That number's session token, which starts with ch_live_. See authentication.
  • •Node.js 18 or later for the script below.

Put the token in your environment:

bash
export WA_SESSION_TOKEN="paste_your_token"

Step 1: find your group IDs

Every group has an ID ending in @g.us. List the groups your number can see:

bash
curl "https://wp-rapidapi.retentionstack.agency/v1/sessions/me/groups?limit=100" \
  -H "Authorization: Bearer $WA_SESSION_TOKEN"

Copy the ID of each group you want to message. If you have more than 100 groups, add &offset=100 for the next page. If a group is missing, refresh the list with POST /v1/sessions/me/groups/refresh and run the command again.

We have not tested groups inside a WhatsApp Community separately, so check that yours appear in the list before you build on this.

Step 2: send one message

Use the group ID as chatId:

bash
curl -X POST https://wp-rapidapi.retentionstack.agency/v1/sendText \
  -H "Authorization: Bearer $WA_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"chatId": "120363000000000000@g.us", "text": "New bid request: kitchen rewiring. Can you quote by Friday?"}'

Step 3: send a different message to several groups

There is no batch endpoint, so your code makes one request per group. Save this as send.mjs:

javascript
const messages = [
  { chatId: '120363000000000001@g.us', text: 'Sam, can you quote the rewiring by Friday?' },
  { chatId: '120363000000000002@g.us', text: 'Priya, can you quote the plumbing by Friday?' },
]

for (const [index, message] of messages.entries()) {
  if (index > 0) await new Promise((resolve) => setTimeout(resolve, 20000))

  const response = await fetch('https://wp-rapidapi.retentionstack.agency/v1/sendText', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.WA_SESSION_TOKEN}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(message),
  })

  if (!response.ok) {
    console.error(message.chatId, response.status, await response.text())
    process.exit(1)
  }
  console.log('Sent to', message.chatId)
}

Run it:

bash
node send.mjs

The 20 second gap is a cautious choice of ours. WhatsApp does not publish a safe rate. The script stops at the first failure so you can check that group before sending again.

Follow-ups and replies

A follow-up is the same request with new text. Trigger it from a button in your own system when a group needs a reminder. Replies arrive in WhatsApp, where you answer them as usual. To receive them in your system too, set up webhooks.

When to use the official API instead

If you can message each person one to one, the official WhatsApp Business Platform is the approved route. You need each person's opt-in, and approved templates for messages outside the 24 hour reply window.

Cost

Each message to a group is one request, so 10 groups with one follow-up each is 20 sends, plus any calls you make to list groups. See pricing for current plans, and the groups reference for the other group endpoints. To create groups and manage members from code, read the group automation guide.

Ready to Get Started?

Try the WhatsApp API free with no credit card required.

Get started free