How to Send Messages to a WhatsApp Group via API (Python, Node.js and No-Code)

How to send messages to a WhatsApp group via API

WhatsApp groups are where a lot of business really happens: the sales team's deal room, the dispatch group at the warehouse, a customer community. Posting into them by hand doesn't scale. If a new order, a failed payment or a daily report should land in a group automatically, you need an API.

This guide shows you how to send messages to a WhatsApp group via API in three ways: with Python, with Node.js, and with no code using Zapier, Make or n8n. All three use SyncMate by Assistro, which sends from your own WhatsApp number. That means no BSP verification and no template approval. You'll also see what Meta's official Groups API allows, and why it doesn't fit most teams.

Can You Send Messages to a WhatsApp Group via API?

Yes. There are two ways to do it, and they work very differently.

The official WhatsApp Groups API

Meta added a Groups API to the WhatsApp Cloud API. It's real, but narrow:

  • It's open only to businesses with an Official Business Account.
  • It doesn't work with numbers on the WhatsApp Business app.
  • A group can have at most 8 participants, and your business number is one of them.
  • People can't be added directly. They join through an invite link that you send.
  • Some message types aren't supported in groups, including interactive messages.

So the official API suits small groups your business creates, such as a chat with one key client. It can't post into the 40-person team group you already use every day.

Sending from your own number with SyncMate

SyncMate connects your existing WhatsApp or WhatsApp Business number when you scan a QR code. Your number can then post through the API to any group it belongs to, just as if you'd typed the message on your phone. This is WhatsApp API without BSP verification: no Meta approval, no message templates, no waiting.

 

Official Groups API

SyncMate

Number type

Cloud API number with Official Business Account

Any WhatsApp or WhatsApp Business number

Verification

Meta business verification + OBA

None

Max group size

8 participants

WhatsApp's standard group limit

Which groups

Only groups created through the API

Any group your number is in and can post to

How members join

Invite link only

Normal WhatsApp group rules

Message types

Text, media, templates; no interactive

Text, images and documents

If you need the verified green badge for one-to-one messaging, SyncMate can also connect a Meta Cloud API number. For groups, though, the personal-number route is the practical one.

What You Need Before You Start

  1. A SyncMate account. You can start free with 450 messages a month. See SyncMate pricing for the plans that include API access.
  2. Your WhatsApp number connected. Follow the guide to connect your WhatsApp number. For API use, pick the cloud-based Assistro Standard connection so you don't need a browser left open.
  3. An API token. Here's how to get your API key or access token. Store it in an environment variable, never in your code.
  4. The group ID of the group you want to message. Step 1 covers this.
  5. For code: Python 3 with the requests library, or Node.js 18 or later (it has fetch built in).

Step 1: Find Your WhatsApp Group ID

Every WhatsApp group has a unique ID that ends in @g.us, for example [email protected]. The API uses this ID the way it uses a phone number for a person.

The fastest way to get it is the free WhatsApp Group ID finder. If you prefer screenshots, follow the step-by-step group ID guide.

Two things to check before you move on:

  • Copy the full ID, including @g.us.
  • Your connected number must be a member of the group. If the group is set so only admins can send messages, your number must be an admin.

Want to post to a WhatsApp Channel instead? Channels aren't supported by the API yet, but you can post to them from Zapier: see how to send a WhatsApp notification to any group or channel.

Step 2: Understand the API Request

SyncMate uses one endpoint for people and groups. The to field takes either a phone number or a group ID.

  • Endpoint: POST https://app.assistro.co/api/v1/whatsapp/messages/text
  • Headers: Authorization: Bearer YOUR_API_TOKEN, Integration: custom and Content-Type: application/json

The body looks like this:

{ "to": "[email protected]", "text": "Hello team! Today's sales report is ready." }

Field

What it is

to

A group ID (ends in @g.us), or a person's number with country code, digits only (919876543210).

text

The text to send. Write line breaks as \n.

mentions

Optional. Numbers to tag in a group; also write @ and the number in text.

quoted

Optional. A message to reply to, as {key, text}.

Files go through a separate media endpoint, shown below. The API accepts up to 60 requests a minute. Every endpoint, with samples in eight languages, is on the WhatsApp API for developers page. A successful call returns the sent message's key:

{ "success": true, "status": 1, "data": { "success": true, "data": { "key": { "remoteJid": "[email protected]", "fromMe": true, "id": "3EB0C4F1A2B3C4D5E6F7" }, "messageTimestamp": 1761800000 } } }

Send a WhatsApp Group Message with Python

Install the requests library first:

pip install requests

Then save your token as an environment variable, SYNCMATE_API_TOKEN, and run this script:

import os import requests API_URL = "https://app.assistro.co/api/v1/whatsapp/messages/text" API_TOKEN = os.environ["SYNCMATE_API_TOKEN"] GROUP_ID = "[email protected]" # your group ID HEADERS = {"Authorization": f"Bearer {API_TOKEN}", "Integration": "custom"} def send_group_message(text): response = requests.post( API_URL, json={"to": GROUP_ID, "text": text}, headers=HEADERS, timeout=30, ) response.raise_for_status() # stops here on 401, 404, 500... return response.json() if __name__ == "__main__": print(send_group_message("Hello team! Today's sales report is ready."))

Passing json=payload makes requests set the Content-Type: application/json header for you. raise_for_status() turns any failed response into an error, so a wrong token doesn't fail silently.

Attach an image or PDF

To send a file, host it at a public link and call the media endpoint. Set kind to image, video, audio or document:

def send_group_file(file_url, file_name, mime_type, caption=""): response = requests.post( "https://app.assistro.co/api/v1/whatsapp/messages/media", json={ "to": GROUP_ID, "kind": "document", # image, video, audio or document "media": {"url": file_url, "file_name": file_name, "mime_type": mime_type}, "caption": caption, }, headers=HEADERS, timeout=90, ) response.raise_for_status() return response.json() send_group_file("https://example.com/reports/today.pdf", "report.pdf", "application/pdf", "Here's today's report.")

Keep the file extension in file_name (report.pdf, banner.jpg) so WhatsApp shows the right preview. Media sends can take up to a minute, so allow a longer timeout. File size limits depend on your plan; current plans allow 2 MB to 8 MB per file.

Send a WhatsApp Group Message with Node.js

Node.js 18 and later include fetch, so you don't need any packages. Save this as send-group.mjs:

const API_URL = "https://app.assistro.co/api/v1/whatsapp/messages/text"; const API_TOKEN = process.env.SYNCMATE_API_TOKEN; const GROUP_ID = "[email protected]"; // your group ID async function sendGroupMessage(text) { const res = await fetch(API_URL, { method: "POST", headers: { Authorization: `Bearer ${API_TOKEN}`, Integration: "custom", "Content-Type": "application/json", }, body: JSON.stringify({ to: GROUP_ID, text }), }); if (!res.ok) { throw new Error(`SyncMate API error ${res.status}: ${await res.text()}`); } return res.json(); } const result = await sendGroupMessage("New order #1042 received."); console.log(result.data.data.key.id); // the sent message's ID

Run it with node send-group.mjs. To attach a file, call /api/v1/whatsapp/messages/media with the same headers and the body shown in the Python example.

In a real app, call sendGroupMessage() from the event that matters: a new row in your database, a payment webhook from Stripe or Razorpay, or a failed job alert. To receive WhatsApp events back in your app, set up webhooks for WhatsApp events. For a wider walkthrough, see how to connect a custom app to the WhatsApp API.

Quick test with cURL

Before writing any code, you can check your token and group ID from the terminal:

curl -X POST "https://app.assistro.co/api/v1/whatsapp/messages/text" \ -H "Authorization: Bearer $SYNCMATE_API_TOKEN" \ -H "Integration: custom" \ -H "Content-Type: application/json" \ -d '{"to":"[email protected]","text":"Test from cURL"}'

If the message appears in the group, everything is set up correctly.

No-Code: Send Group Messages with Zapier, Make or n8n

Not a developer? You can do the same thing with no code. SyncMate has ready-made group actions in the three most popular automation tools, and the group ID works exactly the same way.

Tool

Where to find the group action

Setup guide

Zapier

SyncMate action for groups and channels

Zapier group notifications guide

Make

"Send a message to a group" module

Make.com WhatsApp automation

n8n

SyncMate community node (n8n-nodes-syncmate), "Send Group Message" operation

Send WhatsApp messages from n8n

The flow is the same in each tool. Here's how it looks in Zapier:

  1. Pick a trigger. For example, a new row in Google Sheets, a new deal in HubSpot or a new Shopify order.
  2. Add the SyncMate action and connect it with your API token.
  3. Paste your group ID and build the message. Map fields from the trigger into it, such as "New order #{{order_id}} from {{customer_name}}".
  4. Test, then publish. Check the message lands in the group before you switch the Zap on.

A popular setup is a sales alert group: every new HubSpot deal posts its name, value and owner to the team's WhatsApp group within seconds. Learn more about the WhatsApp Zapier integration and the WhatsApp n8n integration. SyncMate also connects through Pabbly Connect and Integrately.

Troubleshooting Common Errors

Most failed group messages come down to one of these six causes.

Problem

Likely cause

Fix

401 or 403 error

Token is wrong, expired or was regenerated

Copy the token again, or regenerate your token

Request succeeds but nothing arrives

Group ID is incomplete, or your number isn't in the group

Use the full ID ending in @g.us; confirm the number is a member

Message fails for one group only

Group is set so only admins can send

Make your connected number an admin, or change the group setting

Messages stuck or very slow

WhatsApp is disconnected

Check if WhatsApp is connected and see messages stuck in queue

Sends stop partway through the day

Plan's message limit reached

Read messages failed due to daily limit

File doesn't show in the group

Missing file extension or file too large

Keep the extension in file_name; check your plan's size limit

Best Practices to Keep Your Number Safe

SyncMate sends from your real WhatsApp number, so WhatsApp treats your automated messages like any other messages from you. Follow these habits to stay well clear of spam flags:

  • Post only where members expect it. Team groups and opted-in customer groups are ideal. Avoid groups that never asked for your updates.
  • Don't blast many groups at once. Space messages out instead of firing the same text into dozens of groups in one second.
  • Keep volume steady. A sudden jump from 10 to 1,000 messages a day looks like spam.
  • Send one clear message, not five short ones. Combine updates where you can.
  • Retry with a delay. If a send fails, wait before retrying instead of looping instantly.
  • Protect your token. Keep it in environment variables, never in Git. Regenerate it if it leaks.

For the full checklist, read how to keep your WhatsApp account safe and avoid bans.

Start Sending WhatsApp Group Messages

You now have three ways to post to a WhatsApp group automatically: a Python script, a Node.js function, or a no-code workflow. Each takes minutes to set up, and none needs BSP verification or template approval.

Connect your number, grab your group ID and send your first message today.

Start free with SyncMate

Connect the WhatsApp number you already use, link your store or CRM, and send your first automated message today.
Read the developer guide

Start your 7-day free trial

Frequently Asked Questions

Can I send messages to a WhatsApp group with the official WhatsApp Business API?

Only through Meta's Groups API. It needs an Official Business Account and a Cloud API number, groups are capped at 8 participants, and members join by invite link. It can't post into groups you already have.

Do I need to be a group admin to send messages via API?

Only if the group is set so that only admins can send messages. In a normal group, any member's number can post.

Can I send images and PDFs to a WhatsApp group via API?

Yes. Host the file at a public link and send it to the media endpoint with kind set to image, video, audio or document. The maximum file size depends on your plan.

Can I send messages to a WhatsApp Channel the same way?

Not through the API yet. To post to a channel, use the Zapier integration's group and channel action.

Is there a free way to test this?

Yes. SyncMate's free plan includes 450 messages a month, with Assistro branding added to messages. See SyncMate pricing for what each plan includes, and compare it with official WhatsApp API pricing.

Can my number get banned for sending group messages via API?

Any automation can draw attention if it looks like spam. Messaging groups that expect your updates, at a steady pace, keeps the risk low.

Leave a Reply

Your email address will not be published. Required fields are marked *