WhatsApp campaign without a template (JSON API)
One request creates a whole WhatsApp campaign: one text to a list of phone numbers, without a template and without a sender of your own. Before sending, every number is checked for WhatsApp, and the text goes only to numbers where WhatsApp is registered. The campaign appears in your cabinet next to the others.
- At least 2000 phone numbers in a request, at most 100 000.
- Text only, up to 1000 characters: no images, buttons, list substitutions (
{1}) or short links. WhatsApp formatting works:*bold*,_italic_,~strikethrough~,`monospace`. - One text for the whole campaign — one request is one campaign.
- The service is enabled by your manager. A client works either with this channel or with the template channel, not both.
Price. Each number costs the check (your HLR price for the number's country) plus the sending (your WhatsApp price). The full amount is charged when the campaign is created; what was not spent is returned when the result is known:
- no WhatsApp on the number — the sending price is returned, the check stays charged;
- fewer than 1000 numbers have WhatsApp — the campaign is still sent, but the sending is charged as for 1000 numbers;
- the campaign was not sent — the sending price is returned to every number.
Result. The response carries msg_id for every number. The final status comes later — usually within a day — with the message status request or in the webhook:
| Status | Meaning |
|---|---|
QUEUED, ACCEPTED | the check or the sending is in progress |
DELIVERED | WhatsApp is on the number and the message was sent |
UNDELIVERABLE | there is no WhatsApp on the number, nothing was sent |
UNKNOWN | the campaign could not be sent; the sending price is returned |
URI: https://alphasms.net/api/json.php
All requests to API are sent in JSON format using the POST method.
Header parameters
Requests must contain header Content-Type: application/json, otherwise, the request will be considered invalid even if it has valid JSON.
Request parameters
Request example
- JSON
- cURL
- PHP
- Python
- Node.js
{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "campaign/create",
"channel": "whatsapp",
"text": "*Black Friday*: 20% off everything until Sunday.",
"phones": [
447700900123,
447700900124,
447700900125
],
"name": "Black Friday",
"hook": "https://example.org/webhook/url.php",
"id": "bf-2026"
}
]
}
curl -X POST 'https://alphasms.net/api/json.php' \
-H 'Content-Type: application/json' \
--data-raw '{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "campaign/create",
"channel": "whatsapp",
"text": "*Black Friday*: 20% off everything until Sunday.",
"phones": [
447700900123,
447700900124,
447700900125
],
"name": "Black Friday",
"hook": "https://example.org/webhook/url.php",
"id": "bf-2026"
}
]
}'
<?php
$payload = json_encode([
'auth' => 'bb56a4369eb19***cfec6d1776bd25',
'data' => [
[
'type' => 'campaign/create',
'channel' => 'whatsapp',
'text' => '*Black Friday*: 20% off everything until Sunday.',
'phones' => [
447700900123,
447700900124,
447700900125,
],
'name' => 'Black Friday',
'hook' => 'https://example.org/webhook/url.php',
'id' => 'bf-2026',
],
],
], JSON_UNESCAPED_UNICODE);
$ch = curl_init('https://alphasms.net/api/json.php');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import requests
payload = {
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "campaign/create",
"channel": "whatsapp",
"text": "*Black Friday*: 20% off everything until Sunday.",
"phones": [
447700900123,
447700900124,
447700900125,
],
"name": "Black Friday",
"hook": "https://example.org/webhook/url.php",
"id": "bf-2026",
},
],
}
response = requests.post(
"https://alphasms.net/api/json.php",
json=payload,
timeout=30,
)
print(response.json())
const payload = {
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "campaign/create",
"channel": "whatsapp",
"text": "*Black Friday*: 20% off everything until Sunday.",
"phones": [
447700900123,
447700900124,
447700900125
],
"name": "Black Friday",
"hook": "https://example.org/webhook/url.php",
"id": "bf-2026"
}
]
};
const response = await fetch("https://alphasms.net/api/json.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
console.log(await response.json());
Response parameters
| successboolean Result of request execution | ||||||||
| errorstring Error text, returned if success=false | ||||||||
| datalist[object] List of objects with the results of request execution
|
Response examples
- Created
- Too few numbers
- Access denied
HTTP Status Code: 200
Content Type: JSON application/json
{
"success": true,
"data": [
{
"success": true,
"data": {
"campaign_id": 1204512,
"channel": "whatsapp",
"amount": 1050.5,
"messages": [
{ "msg_id": 23468710, "phone": 447700900123 },
{ "msg_id": 23468711, "phone": 447700900124 },
{ "msg_id": 23468712, "phone": 447700900125 }
],
"id": "bf-2026"
}
}
]
}
HTTP Status Code: 200
Content Type: JSON application/json
{
"success": true,
"data": [
{
"success": false,
"error": "ERROR_WHATSAPP_MIN_RECIPIENTS"
}
]
}
HTTP Status Code: 200
Content Type: JSON application/json
{
"success": false,
"error": "Access denied"
}