Messaging API
Send Message to a WhatsApp Group API
Send a WhatsApp text, image or document to a WhatsApp group that your connected number is a member of. Use it for team announcements, community updates and broadcast notifications.
https://wbiztool.com/api/v1/send_msg/group/Body: JSON, form fields, or multipart/form-data when uploading a file
The message is queued and sent to the group from your WhatsApp number. The response gives you a msg_id you can use to check its status.
Quick example#
curl -X POST https://wbiztool.com/api/v1/send_msg/group/ \
-H "Content-Type: application/json" \
-d '{
"client_id": 12345,
"api_key": "YOUR_API_KEY",
"whatsapp_client": 678,
"msg_type": 0,
"group_name": "Sales Team Mumbai",
"msg": "Reminder: *weekly review* starts at 4 PM today."
}'import requests
response = requests.post(
"https://wbiztool.com/api/v1/send_msg/group/",
json={
"client_id": 12345,
"api_key": "YOUR_API_KEY",
"whatsapp_client": 678,
"msg_type": 0,
"group_name": "Sales Team Mumbai",
"msg": "Reminder: *weekly review* starts at 4 PM today.",
},
timeout=60,
)
result = response.json() # read the body even when the HTTP code is 400
if result.get("status") == 1:
print("Queued with msg_id", result["msg_id"])
else:
print("Failed:", result.get("message"))// Node.js 18+ (built-in fetch). Save as .mjs to use top-level await.
const response = await fetch("https://wbiztool.com/api/v1/send_msg/group/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
client_id: 12345,
api_key: "YOUR_API_KEY",
whatsapp_client: 678,
msg_type: 0,
group_name: "Sales Team Mumbai",
msg: "Reminder: *weekly review* starts at 4 PM today.",
}),
});
const result = await response.json(); // read the body even when the HTTP code is 400
if (result.status === 1) {
console.log("Queued with msg_id", result.msg_id);
} else {
console.error("Failed:", result.message);
}<?php
$payload = [
'client_id' => 12345,
'api_key' => 'YOUR_API_KEY',
'whatsapp_client' => 678,
'msg_type' => 0,
'group_name' => 'Sales Team Mumbai',
'msg' => 'Reminder: *weekly review* starts at 4 PM today.',
];
$ch = curl_init('https://wbiztool.com/api/v1/send_msg/group/');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($result['status'] ?? 0) === 1) {
echo 'Queued with msg_id ' . $result['msg_id'];
} else {
echo 'Failed: ' . ($result['message'] ?? 'no response');
}Replace 12345, YOUR_API_KEY and 678 with your own values. See Authentication for where to find them.
Request parameters#
Authentication
client_idintegerrequiredYour API Client ID from Settings → API keys.
api_keystringrequiredYour API key from the same page.
whatsapp_clientintegerRequired if the owner has more than one connected numberID of the WhatsApp number to send from, from WhatsApp settings. It must be a number that belongs to the workspace owner. If you leave it out and the owner has exactly one connected number, that number is used.
Group and message
group_namestringrequiredName of the WhatsApp group, written exactly as it appears in WhatsApp. Send it as a string. A JSON number such as
2024returns an HTML error page (HTTP500). See How the group is found.msg_typeintegeroptional0text (default),1image,2file or document.msgstringRequired when msg_type is 0Message text. For images and files it's the caption and can be empty. WhatsApp formatting works:
*bold*,_italic_,~strikethrough~.messageis accepted as an alias.
Images and files
img_urlstringRequired when msg_type is 1 and no file is uploadedPublic
httporhttpsURL of the image.file_urlstringRequired when msg_type is 2 and no file is uploadedPublic
httporhttpsURL the file can be downloaded from directly.filefileoptionalUpload the image or file instead of giving a URL. Send the request as
multipart/form-datawith the field namedfile.file_namestringoptionalFile name the group sees, such as
price-list.pdf. Its extension decides how the file is sent, so include one. It's sent in lower case, characters such as& : ? * $ ;are replaced with_, and it's cut to 150 characters. If you leave it out, the name comes from the URL or the uploaded file.
Delivery options
expire_after_secondsintegeroptionalMark the message as expired (status
4) if it hasn't been sent within this many seconds, for example3600for one hour. A background job does this at least 30 seconds after the deadline, so don't rely on it for deadlines shorter than a minute.webhookstringoptionalURL that receives a
POSTwhen the message is sent or fails. The payload is the same as for Send message.
Images and files follow the same rules as Send message: URLs are downloaded when you call the API (up to 100 MB). When the message is sent, images over 16 MB and videos over 64 MB fail, WAV and OGG audio isn't supported, and files (msg_type 2) without a supported extension get .pdf added, uploaded ones included. File names are sent in lower case. See Sending images and files for the full list of extensions and errors.
To upload a file, use the multipart examples on Send message, replacing the URL with /api/v1/send_msg/group/ and phone/country_code with group_name.
curl -X POST https://wbiztool.com/api/v1/send_msg/group/ \
-H "Content-Type: application/json" \
-d '{
"client_id": 12345,
"api_key": "YOUR_API_KEY",
"whatsapp_client": 678,
"msg_type": 1,
"group_name": "Sales Team Mumbai",
"img_url": "https://example.com/reports/weekly-sales.png",
"msg": "This week'\''s sales summary"
}'import requests
response = requests.post(
"https://wbiztool.com/api/v1/send_msg/group/",
json={
"client_id": 12345,
"api_key": "YOUR_API_KEY",
"whatsapp_client": 678,
"msg_type": 1,
"group_name": "Sales Team Mumbai",
"img_url": "https://example.com/reports/weekly-sales.png",
"msg": "This week's sales summary",
},
timeout=60,
)
print(response.json())// Node.js 18+ (built-in fetch). Save as .mjs to use top-level await.
const response = await fetch("https://wbiztool.com/api/v1/send_msg/group/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
client_id: 12345,
api_key: "YOUR_API_KEY",
whatsapp_client: 678,
msg_type: 1,
group_name: "Sales Team Mumbai",
img_url: "https://example.com/reports/weekly-sales.png",
msg: "This week's sales summary",
}),
});
console.log(await response.json());<?php
$ch = curl_init('https://wbiztool.com/api/v1/send_msg/group/');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'client_id' => 12345,
'api_key' => 'YOUR_API_KEY',
'whatsapp_client' => 678,
'msg_type' => 1,
'group_name' => 'Sales Team Mumbai',
'img_url' => 'https://example.com/reports/weekly-sales.png',
'msg' => "This week's sales summary",
]),
CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($ch);
curl_close($ch);How the group is found#
Wbiztool doesn't check the group name when you call the API. When the message is being sent, Wbiztool searches your WhatsApp chats for group_name and opens the first result. Because of this:
- Your connected WhatsApp number must be a member of the group.
- Use the full group name exactly as WhatsApp shows it, including emoji and punctuation. Spaces at the start and end are ignored.
- Make the name unique. A short or partial name can match a different chat that appears first in search.
- If nothing matches, only admins can send messages in the group and your number isn't an admin, or only community admins can post, the message fails with the error
Group not found. - If your number has left the group, the message fails with the error
Group member blocked.
Group problems don't show up in the API response. Use a webhook or Message status to find out whether the message was sent.
Using the official client#
The Python client calls this endpoint for you.
from wbiztool_client import WbizToolClient
client = WbizToolClient(api_key="YOUR_API_KEY", client_id=12345)
result = client.send_message_to_group(
group_name="Sales Team Mumbai",
msg="Reminder: weekly review starts at 4 PM today.",
whatsapp_client=678,
)
print(result)Errors raise requests.HTTPError. Read the reason with e.response.json()["message"].
Response#
A successful request returns HTTP 200:
{
"status": 1,
"message": "Created",
"msg_id": 9817263
}
| Field | Type | Description |
|---|---|---|
status | integer | 1 if the message was queued, 0 if the request failed. |
message | string | Created on success, otherwise the error. |
msg_id | integer | ID of the queued message. Save it to check the status later. Only present on success. |
"status": 1 means the message was queued, not that it reached the group. Use a webhook or Message status to confirm it was sent.
Errors#
Errors return HTTP 400 with status set to 0:
{ "status": 0, "message": "Group Name cant be null" }
| Message | How to fix it |
|---|---|
Auth Error - Please send correct API key and Client id | Send a non-empty api_key. |
Invalid client id. | Send client_id as a number. |
Auth Error: invalid api key | Check the key exists, hasn't been deleted and belongs to this client_id. |
Group Name cant be null | Add group_name. |
Msg cant be null | Text messages (msg_type 0) need msg. |
Image Url Can't be null | For msg_type 1, send img_url or upload a file. |
File Url Can't be null | For msg_type 2, send file_url or upload a file. |
Invalid file url, Can't download / Invalid file url | The URL isn't public, timed out, or the file is over 100 MB. |
Invalid whatsapp client None | That whatsapp_client ID doesn't belong to the workspace owner. See the warning above. |
Invalid whatsapp client id. | Send whatsapp_client. It's required unless the owner has exactly one connected number. |
Not enough credits | Your plan has no messages left. |
Demo Account can not access apis | Use a regular account. |
Account Disabled | Your account is disabled. Contact support. |
Invalid JSON format: … | The JSON body isn't valid, often because of a trailing comma or an unescaped line break in msg. Use \n for new lines. |
Tips#
- Test the name first: send a short text to the group and check Message status before you automate anything.
- Renamed groups: if someone renames the group in WhatsApp, update
group_namein your integration too. - Message types: only
0,1and2are valid values formsg_type. Any value that isn't a whole number returns an HTML error page (HTTP500) instead of JSON. - Several groups at once: Send to multiple numbers accepts group names mixed with phone numbers in one request.
