Send WhatsApp message
A WhatsApp message goes out in one of two forms:
- an approved template — at any time. Templates are created in your cabinet and approved by Meta; what each of them needs besides its values is returned by List WhatsApp templates;
- a free-form message — text, a file, a location or a card with a button. WhatsApp delivers it only within 24 hours after the subscriber's last message to you.
The request is synchronous at /api/json.php: the gateway answers with msg_id for each message.
The same request can be queued asynchronously at /v1/json.
- The recipient has to write to you first or agree to receive messages. A cold mailing to a purchased base is not possible in WhatsApp.
- The sender (
whatsapp_signature) has to be connected to your account, and Meta has to approve its display name. - Outside the 24-hour window only an approved template is accepted.
URI: https://api.interconnect.solutions/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
- Sync
- Async
- JSON
- cURL
- PHP
- Python
- Node.js
{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100500,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_language": "en",
"whatsapp_var": [
"Anna",
"A-1024"
],
"whatsapp_image": "https://url.com/storage/images/order.png",
"hook": "https://example.org/webhook/url.php"
}
]
}
curl -X POST 'https://api.interconnect.solutions/api/json.php' \
-H 'Content-Type: application/json' \
--data-raw '{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100500,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_language": "en",
"whatsapp_var": [
"Anna",
"A-1024"
],
"whatsapp_image": "https://url.com/storage/images/order.png",
"hook": "https://example.org/webhook/url.php"
}
]
}'
<?php
$payload = json_encode([
'auth' => 'bb56a4369eb19***cfec6d1776bd25',
'data' => [
[
'type' => 'whatsapp',
'id' => 100500,
'phone' => 447700900123,
'whatsapp_signature' => 'WhatsAppTest',
'whatsapp_template' => 'order_ready',
'whatsapp_language' => 'en',
'whatsapp_var' => [
'Anna',
'A-1024',
],
'whatsapp_image' => 'https://url.com/storage/images/order.png',
'hook' => 'https://example.org/webhook/url.php',
],
],
], JSON_UNESCAPED_UNICODE);
$ch = curl_init('https://api.interconnect.solutions/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": "whatsapp",
"id": 100500,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_language": "en",
"whatsapp_var": [
"Anna",
"A-1024",
],
"whatsapp_image": "https://url.com/storage/images/order.png",
"hook": "https://example.org/webhook/url.php",
},
],
}
response = requests.post(
"https://api.interconnect.solutions/api/json.php",
json=payload,
timeout=30,
)
print(response.json())
const payload = {
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100500,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_language": "en",
"whatsapp_var": [
"Anna",
"A-1024"
],
"whatsapp_image": "https://url.com/storage/images/order.png",
"hook": "https://example.org/webhook/url.php"
}
]
};
const response = await fetch("https://api.interconnect.solutions/api/json.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
console.log(await response.json());
- JSON
- cURL
- PHP
- Python
- Node.js
{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100500,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_language": "en",
"whatsapp_var": [
"Anna",
"A-1024"
],
"whatsapp_image": "https://url.com/storage/images/order.png",
"hook": "https://example.org/webhook/url.php"
}
]
}
curl -X POST 'https://api-async.interconnect.solutions/v1/json' \
-H 'Content-Type: application/json' \
--data-raw '{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100500,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_language": "en",
"whatsapp_var": [
"Anna",
"A-1024"
],
"whatsapp_image": "https://url.com/storage/images/order.png",
"hook": "https://example.org/webhook/url.php"
}
]
}'
<?php
$payload = json_encode([
'auth' => 'bb56a4369eb19***cfec6d1776bd25',
'data' => [
[
'type' => 'whatsapp',
'id' => 100500,
'phone' => 447700900123,
'whatsapp_signature' => 'WhatsAppTest',
'whatsapp_template' => 'order_ready',
'whatsapp_language' => 'en',
'whatsapp_var' => [
'Anna',
'A-1024',
],
'whatsapp_image' => 'https://url.com/storage/images/order.png',
'hook' => 'https://example.org/webhook/url.php',
],
],
], JSON_UNESCAPED_UNICODE);
$ch = curl_init('https://api-async.interconnect.solutions/v1/json');
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": "whatsapp",
"id": 100500,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_language": "en",
"whatsapp_var": [
"Anna",
"A-1024",
],
"whatsapp_image": "https://url.com/storage/images/order.png",
"hook": "https://example.org/webhook/url.php",
},
],
}
response = requests.post(
"https://api-async.interconnect.solutions/v1/json",
json=payload,
timeout=30,
)
print(response.json())
const payload = {
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100500,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_language": "en",
"whatsapp_var": [
"Anna",
"A-1024"
],
"whatsapp_image": "https://url.com/storage/images/order.png",
"hook": "https://example.org/webhook/url.php"
}
]
};
const response = await fetch("https://api-async.interconnect.solutions/v1/json", {
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
- Successful
- Access denied
- Template not approved
- Header content missing
HTTP Status Code: 200
Content Type: JSON application/json
{
"success": true,
"data": [
{
"success": true,
"data": {
"id": 100500,
"msg_id": 123456789,
"data": 1,
"parts": 1
}
}
]
}
HTTP Status Code: 200
Content Type: JSON application/json
{
"success": false,
"error": "Access denied"
}
HTTP Status Code: 200
Content Type: JSON application/json
{
"success": true,
"data": [
{
"success": false,
"error": "WhatsApp template is not approved for sending",
"data": {
"id": 100500
}
}
]
}
HTTP Status Code: 200
Content Type: JSON application/json
{
"success": true,
"data": [
{
"success": false,
"error": "WhatsApp template has a media, location or text-with-placeholder header: pass its content",
"data": {
"id": 100500
}
}
]
}
What a template needs
Besides the values in whatsapp_var, a template may take a file, a text, a location or a button value. List WhatsApp templates returns this as shape:
shape of the template | Pass in the request |
|---|---|
header: image, video or document | whatsapp_image, whatsapp_video or whatsapp_document; for a document also whatsapp_filename |
header: location | whatsapp_location |
header: text and header_var: true | whatsapp_header |
url_button: true | whatsapp_button_var |
copy_code: true | whatsapp_coupon |
authentication: true | whatsapp_code — and nothing else |
A value the template needs but the request lacks, or a value the template does not take, is refused at acceptance, before the message is charged: WhatsApp itself would refuse such a message only after sending.
More examples
Template with a link button and a coupon
- Sync
- Async
- JSON
- cURL
- PHP
- Python
- Node.js
{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100501,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "spring_sale",
"whatsapp_var": [
"Anna"
],
"whatsapp_button_var": "spring-24",
"whatsapp_coupon": "SPRING15",
"hook": "https://example.org/webhook/url.php"
}
]
}
curl -X POST 'https://api.interconnect.solutions/api/json.php' \
-H 'Content-Type: application/json' \
--data-raw '{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100501,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "spring_sale",
"whatsapp_var": [
"Anna"
],
"whatsapp_button_var": "spring-24",
"whatsapp_coupon": "SPRING15",
"hook": "https://example.org/webhook/url.php"
}
]
}'
<?php
$payload = json_encode([
'auth' => 'bb56a4369eb19***cfec6d1776bd25',
'data' => [
[
'type' => 'whatsapp',
'id' => 100501,
'phone' => 447700900123,
'whatsapp_signature' => 'WhatsAppTest',
'whatsapp_template' => 'spring_sale',
'whatsapp_var' => [
'Anna',
],
'whatsapp_button_var' => 'spring-24',
'whatsapp_coupon' => 'SPRING15',
'hook' => 'https://example.org/webhook/url.php',
],
],
], JSON_UNESCAPED_UNICODE);
$ch = curl_init('https://api.interconnect.solutions/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": "whatsapp",
"id": 100501,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "spring_sale",
"whatsapp_var": [
"Anna",
],
"whatsapp_button_var": "spring-24",
"whatsapp_coupon": "SPRING15",
"hook": "https://example.org/webhook/url.php",
},
],
}
response = requests.post(
"https://api.interconnect.solutions/api/json.php",
json=payload,
timeout=30,
)
print(response.json())
const payload = {
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100501,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "spring_sale",
"whatsapp_var": [
"Anna"
],
"whatsapp_button_var": "spring-24",
"whatsapp_coupon": "SPRING15",
"hook": "https://example.org/webhook/url.php"
}
]
};
const response = await fetch("https://api.interconnect.solutions/api/json.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
console.log(await response.json());
- JSON
- cURL
- PHP
- Python
- Node.js
{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100501,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "spring_sale",
"whatsapp_var": [
"Anna"
],
"whatsapp_button_var": "spring-24",
"whatsapp_coupon": "SPRING15",
"hook": "https://example.org/webhook/url.php"
}
]
}
curl -X POST 'https://api-async.interconnect.solutions/v1/json' \
-H 'Content-Type: application/json' \
--data-raw '{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100501,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "spring_sale",
"whatsapp_var": [
"Anna"
],
"whatsapp_button_var": "spring-24",
"whatsapp_coupon": "SPRING15",
"hook": "https://example.org/webhook/url.php"
}
]
}'
<?php
$payload = json_encode([
'auth' => 'bb56a4369eb19***cfec6d1776bd25',
'data' => [
[
'type' => 'whatsapp',
'id' => 100501,
'phone' => 447700900123,
'whatsapp_signature' => 'WhatsAppTest',
'whatsapp_template' => 'spring_sale',
'whatsapp_var' => [
'Anna',
],
'whatsapp_button_var' => 'spring-24',
'whatsapp_coupon' => 'SPRING15',
'hook' => 'https://example.org/webhook/url.php',
],
],
], JSON_UNESCAPED_UNICODE);
$ch = curl_init('https://api-async.interconnect.solutions/v1/json');
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": "whatsapp",
"id": 100501,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "spring_sale",
"whatsapp_var": [
"Anna",
],
"whatsapp_button_var": "spring-24",
"whatsapp_coupon": "SPRING15",
"hook": "https://example.org/webhook/url.php",
},
],
}
response = requests.post(
"https://api-async.interconnect.solutions/v1/json",
json=payload,
timeout=30,
)
print(response.json())
const payload = {
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100501,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "spring_sale",
"whatsapp_var": [
"Anna"
],
"whatsapp_button_var": "spring-24",
"whatsapp_coupon": "SPRING15",
"hook": "https://example.org/webhook/url.php"
}
]
};
const response = await fetch("https://api-async.interconnect.solutions/v1/json", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
console.log(await response.json());
Verification code (authentication template)
- Sync
- Async
- JSON
- cURL
- PHP
- Python
- Node.js
{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100502,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "login_code",
"whatsapp_code": "481516",
"hook": "https://example.org/webhook/url.php"
}
]
}
curl -X POST 'https://api.interconnect.solutions/api/json.php' \
-H 'Content-Type: application/json' \
--data-raw '{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100502,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "login_code",
"whatsapp_code": "481516",
"hook": "https://example.org/webhook/url.php"
}
]
}'
<?php
$payload = json_encode([
'auth' => 'bb56a4369eb19***cfec6d1776bd25',
'data' => [
[
'type' => 'whatsapp',
'id' => 100502,
'phone' => 447700900123,
'whatsapp_signature' => 'WhatsAppTest',
'whatsapp_template' => 'login_code',
'whatsapp_code' => '481516',
'hook' => 'https://example.org/webhook/url.php',
],
],
], JSON_UNESCAPED_UNICODE);
$ch = curl_init('https://api.interconnect.solutions/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": "whatsapp",
"id": 100502,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "login_code",
"whatsapp_code": "481516",
"hook": "https://example.org/webhook/url.php",
},
],
}
response = requests.post(
"https://api.interconnect.solutions/api/json.php",
json=payload,
timeout=30,
)
print(response.json())
const payload = {
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100502,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "login_code",
"whatsapp_code": "481516",
"hook": "https://example.org/webhook/url.php"
}
]
};
const response = await fetch("https://api.interconnect.solutions/api/json.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
console.log(await response.json());
- JSON
- cURL
- PHP
- Python
- Node.js
{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100502,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "login_code",
"whatsapp_code": "481516",
"hook": "https://example.org/webhook/url.php"
}
]
}
curl -X POST 'https://api-async.interconnect.solutions/v1/json' \
-H 'Content-Type: application/json' \
--data-raw '{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100502,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "login_code",
"whatsapp_code": "481516",
"hook": "https://example.org/webhook/url.php"
}
]
}'
<?php
$payload = json_encode([
'auth' => 'bb56a4369eb19***cfec6d1776bd25',
'data' => [
[
'type' => 'whatsapp',
'id' => 100502,
'phone' => 447700900123,
'whatsapp_signature' => 'WhatsAppTest',
'whatsapp_template' => 'login_code',
'whatsapp_code' => '481516',
'hook' => 'https://example.org/webhook/url.php',
],
],
], JSON_UNESCAPED_UNICODE);
$ch = curl_init('https://api-async.interconnect.solutions/v1/json');
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": "whatsapp",
"id": 100502,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "login_code",
"whatsapp_code": "481516",
"hook": "https://example.org/webhook/url.php",
},
],
}
response = requests.post(
"https://api-async.interconnect.solutions/v1/json",
json=payload,
timeout=30,
)
print(response.json())
const payload = {
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100502,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "login_code",
"whatsapp_code": "481516",
"hook": "https://example.org/webhook/url.php"
}
]
};
const response = await fetch("https://api-async.interconnect.solutions/v1/json", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
console.log(await response.json());
Free-form document within the 24-hour window
- Sync
- Async
- JSON
- cURL
- PHP
- Python
- Node.js
{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100503,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_message": "Your invoice for September",
"whatsapp_document": "https://url.com/storage/files/invoice.pdf",
"whatsapp_filename": "Invoice A-1024.pdf",
"hook": "https://example.org/webhook/url.php"
}
]
}
curl -X POST 'https://api.interconnect.solutions/api/json.php' \
-H 'Content-Type: application/json' \
--data-raw '{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100503,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_message": "Your invoice for September",
"whatsapp_document": "https://url.com/storage/files/invoice.pdf",
"whatsapp_filename": "Invoice A-1024.pdf",
"hook": "https://example.org/webhook/url.php"
}
]
}'
<?php
$payload = json_encode([
'auth' => 'bb56a4369eb19***cfec6d1776bd25',
'data' => [
[
'type' => 'whatsapp',
'id' => 100503,
'phone' => 447700900123,
'whatsapp_signature' => 'WhatsAppTest',
'whatsapp_message' => 'Your invoice for September',
'whatsapp_document' => 'https://url.com/storage/files/invoice.pdf',
'whatsapp_filename' => 'Invoice A-1024.pdf',
'hook' => 'https://example.org/webhook/url.php',
],
],
], JSON_UNESCAPED_UNICODE);
$ch = curl_init('https://api.interconnect.solutions/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": "whatsapp",
"id": 100503,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_message": "Your invoice for September",
"whatsapp_document": "https://url.com/storage/files/invoice.pdf",
"whatsapp_filename": "Invoice A-1024.pdf",
"hook": "https://example.org/webhook/url.php",
},
],
}
response = requests.post(
"https://api.interconnect.solutions/api/json.php",
json=payload,
timeout=30,
)
print(response.json())
const payload = {
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100503,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_message": "Your invoice for September",
"whatsapp_document": "https://url.com/storage/files/invoice.pdf",
"whatsapp_filename": "Invoice A-1024.pdf",
"hook": "https://example.org/webhook/url.php"
}
]
};
const response = await fetch("https://api.interconnect.solutions/api/json.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
console.log(await response.json());
- JSON
- cURL
- PHP
- Python
- Node.js
{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100503,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_message": "Your invoice for September",
"whatsapp_document": "https://url.com/storage/files/invoice.pdf",
"whatsapp_filename": "Invoice A-1024.pdf",
"hook": "https://example.org/webhook/url.php"
}
]
}
curl -X POST 'https://api-async.interconnect.solutions/v1/json' \
-H 'Content-Type: application/json' \
--data-raw '{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100503,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_message": "Your invoice for September",
"whatsapp_document": "https://url.com/storage/files/invoice.pdf",
"whatsapp_filename": "Invoice A-1024.pdf",
"hook": "https://example.org/webhook/url.php"
}
]
}'
<?php
$payload = json_encode([
'auth' => 'bb56a4369eb19***cfec6d1776bd25',
'data' => [
[
'type' => 'whatsapp',
'id' => 100503,
'phone' => 447700900123,
'whatsapp_signature' => 'WhatsAppTest',
'whatsapp_message' => 'Your invoice for September',
'whatsapp_document' => 'https://url.com/storage/files/invoice.pdf',
'whatsapp_filename' => 'Invoice A-1024.pdf',
'hook' => 'https://example.org/webhook/url.php',
],
],
], JSON_UNESCAPED_UNICODE);
$ch = curl_init('https://api-async.interconnect.solutions/v1/json');
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": "whatsapp",
"id": 100503,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_message": "Your invoice for September",
"whatsapp_document": "https://url.com/storage/files/invoice.pdf",
"whatsapp_filename": "Invoice A-1024.pdf",
"hook": "https://example.org/webhook/url.php",
},
],
}
response = requests.post(
"https://api-async.interconnect.solutions/v1/json",
json=payload,
timeout=30,
)
print(response.json())
const payload = {
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100503,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_message": "Your invoice for September",
"whatsapp_document": "https://url.com/storage/files/invoice.pdf",
"whatsapp_filename": "Invoice A-1024.pdf",
"hook": "https://example.org/webhook/url.php"
}
]
};
const response = await fetch("https://api-async.interconnect.solutions/v1/json", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
console.log(await response.json());
Free-form location within the 24-hour window
- Sync
- Async
- JSON
- cURL
- PHP
- Python
- Node.js
{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100504,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_location": {
"latitude": 50.4501,
"longitude": 30.5234,
"name": "Pickup point",
"address": "1 Main St"
},
"hook": "https://example.org/webhook/url.php"
}
]
}
curl -X POST 'https://api.interconnect.solutions/api/json.php' \
-H 'Content-Type: application/json' \
--data-raw '{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100504,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_location": {
"latitude": 50.4501,
"longitude": 30.5234,
"name": "Pickup point",
"address": "1 Main St"
},
"hook": "https://example.org/webhook/url.php"
}
]
}'
<?php
$payload = json_encode([
'auth' => 'bb56a4369eb19***cfec6d1776bd25',
'data' => [
[
'type' => 'whatsapp',
'id' => 100504,
'phone' => 447700900123,
'whatsapp_signature' => 'WhatsAppTest',
'whatsapp_location' => [
'latitude' => 50.4501,
'longitude' => 30.5234,
'name' => 'Pickup point',
'address' => '1 Main St',
],
'hook' => 'https://example.org/webhook/url.php',
],
],
], JSON_UNESCAPED_UNICODE);
$ch = curl_init('https://api.interconnect.solutions/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": "whatsapp",
"id": 100504,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_location": {
"latitude": 50.4501,
"longitude": 30.5234,
"name": "Pickup point",
"address": "1 Main St",
},
"hook": "https://example.org/webhook/url.php",
},
],
}
response = requests.post(
"https://api.interconnect.solutions/api/json.php",
json=payload,
timeout=30,
)
print(response.json())
const payload = {
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100504,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_location": {
"latitude": 50.4501,
"longitude": 30.5234,
"name": "Pickup point",
"address": "1 Main St"
},
"hook": "https://example.org/webhook/url.php"
}
]
};
const response = await fetch("https://api.interconnect.solutions/api/json.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
console.log(await response.json());
- JSON
- cURL
- PHP
- Python
- Node.js
{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100504,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_location": {
"latitude": 50.4501,
"longitude": 30.5234,
"name": "Pickup point",
"address": "1 Main St"
},
"hook": "https://example.org/webhook/url.php"
}
]
}
curl -X POST 'https://api-async.interconnect.solutions/v1/json' \
-H 'Content-Type: application/json' \
--data-raw '{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100504,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_location": {
"latitude": 50.4501,
"longitude": 30.5234,
"name": "Pickup point",
"address": "1 Main St"
},
"hook": "https://example.org/webhook/url.php"
}
]
}'
<?php
$payload = json_encode([
'auth' => 'bb56a4369eb19***cfec6d1776bd25',
'data' => [
[
'type' => 'whatsapp',
'id' => 100504,
'phone' => 447700900123,
'whatsapp_signature' => 'WhatsAppTest',
'whatsapp_location' => [
'latitude' => 50.4501,
'longitude' => 30.5234,
'name' => 'Pickup point',
'address' => '1 Main St',
],
'hook' => 'https://example.org/webhook/url.php',
],
],
], JSON_UNESCAPED_UNICODE);
$ch = curl_init('https://api-async.interconnect.solutions/v1/json');
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": "whatsapp",
"id": 100504,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_location": {
"latitude": 50.4501,
"longitude": 30.5234,
"name": "Pickup point",
"address": "1 Main St",
},
"hook": "https://example.org/webhook/url.php",
},
],
}
response = requests.post(
"https://api-async.interconnect.solutions/v1/json",
json=payload,
timeout=30,
)
print(response.json())
const payload = {
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp",
"id": 100504,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_location": {
"latitude": 50.4501,
"longitude": 30.5234,
"name": "Pickup point",
"address": "1 Main St"
},
"hook": "https://example.org/webhook/url.php"
}
]
};
const response = await fetch("https://api-async.interconnect.solutions/v1/json", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
console.log(await response.json());
WhatsApp with an SMS fallback
- Sync
- Async
- JSON
- cURL
- PHP
- Python
- Node.js
{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp+sms",
"id": 100505,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_var": [
"Anna",
"A-1024"
],
"sms_signature": "SMSTest",
"sms_message": "Anna, your order A-1024 is ready",
"hook": "https://example.org/webhook/url.php"
}
]
}
curl -X POST 'https://api.interconnect.solutions/api/json.php' \
-H 'Content-Type: application/json' \
--data-raw '{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp+sms",
"id": 100505,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_var": [
"Anna",
"A-1024"
],
"sms_signature": "SMSTest",
"sms_message": "Anna, your order A-1024 is ready",
"hook": "https://example.org/webhook/url.php"
}
]
}'
<?php
$payload = json_encode([
'auth' => 'bb56a4369eb19***cfec6d1776bd25',
'data' => [
[
'type' => 'whatsapp+sms',
'id' => 100505,
'phone' => 447700900123,
'whatsapp_signature' => 'WhatsAppTest',
'whatsapp_template' => 'order_ready',
'whatsapp_var' => [
'Anna',
'A-1024',
],
'sms_signature' => 'SMSTest',
'sms_message' => 'Anna, your order A-1024 is ready',
'hook' => 'https://example.org/webhook/url.php',
],
],
], JSON_UNESCAPED_UNICODE);
$ch = curl_init('https://api.interconnect.solutions/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": "whatsapp+sms",
"id": 100505,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_var": [
"Anna",
"A-1024",
],
"sms_signature": "SMSTest",
"sms_message": "Anna, your order A-1024 is ready",
"hook": "https://example.org/webhook/url.php",
},
],
}
response = requests.post(
"https://api.interconnect.solutions/api/json.php",
json=payload,
timeout=30,
)
print(response.json())
const payload = {
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp+sms",
"id": 100505,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_var": [
"Anna",
"A-1024"
],
"sms_signature": "SMSTest",
"sms_message": "Anna, your order A-1024 is ready",
"hook": "https://example.org/webhook/url.php"
}
]
};
const response = await fetch("https://api.interconnect.solutions/api/json.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
console.log(await response.json());
- JSON
- cURL
- PHP
- Python
- Node.js
{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp+sms",
"id": 100505,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_var": [
"Anna",
"A-1024"
],
"sms_signature": "SMSTest",
"sms_message": "Anna, your order A-1024 is ready",
"hook": "https://example.org/webhook/url.php"
}
]
}
curl -X POST 'https://api-async.interconnect.solutions/v1/json' \
-H 'Content-Type: application/json' \
--data-raw '{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp+sms",
"id": 100505,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_var": [
"Anna",
"A-1024"
],
"sms_signature": "SMSTest",
"sms_message": "Anna, your order A-1024 is ready",
"hook": "https://example.org/webhook/url.php"
}
]
}'
<?php
$payload = json_encode([
'auth' => 'bb56a4369eb19***cfec6d1776bd25',
'data' => [
[
'type' => 'whatsapp+sms',
'id' => 100505,
'phone' => 447700900123,
'whatsapp_signature' => 'WhatsAppTest',
'whatsapp_template' => 'order_ready',
'whatsapp_var' => [
'Anna',
'A-1024',
],
'sms_signature' => 'SMSTest',
'sms_message' => 'Anna, your order A-1024 is ready',
'hook' => 'https://example.org/webhook/url.php',
],
],
], JSON_UNESCAPED_UNICODE);
$ch = curl_init('https://api-async.interconnect.solutions/v1/json');
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": "whatsapp+sms",
"id": 100505,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_var": [
"Anna",
"A-1024",
],
"sms_signature": "SMSTest",
"sms_message": "Anna, your order A-1024 is ready",
"hook": "https://example.org/webhook/url.php",
},
],
}
response = requests.post(
"https://api-async.interconnect.solutions/v1/json",
json=payload,
timeout=30,
)
print(response.json())
const payload = {
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "whatsapp+sms",
"id": 100505,
"phone": 447700900123,
"whatsapp_signature": "WhatsAppTest",
"whatsapp_template": "order_ready",
"whatsapp_var": [
"Anna",
"A-1024"
],
"sms_signature": "SMSTest",
"sms_message": "Anna, your order A-1024 is ready",
"hook": "https://example.org/webhook/url.php"
}
]
};
const response = await fetch("https://api-async.interconnect.solutions/v1/json", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
console.log(await response.json());
Errors
An error comes in one of two places:
- The whole request is refused when a field has a wrong type or format:
success: falseand the text inerrorat the top of the response. Nothing is created. - One message is refused when its content does not fit the sender or the template:
success: falseand the text indata[].errorof that message. It is not created and not charged; the other messages of the request go on.
Request
| Error | Meaning |
|---|---|
Whatsapp signature parameter is required | No whatsapp_signature |
Whatsapp message parameter is required | Neither a template nor a free-form message (text, file or location) |
WhatsApp template parameter must match [a-z0-9_] | The template name is not in Meta's format |
Whatsapp var value must not exceed 1024 characters | A value in whatsapp_var is too long |
Whatsapp header must not exceed 60 characters | whatsapp_header is too long |
Whatsapp button_var must not exceed 2000 characters | whatsapp_button_var is too long |
Whatsapp filename must not exceed 240 characters | whatsapp_filename is too long |
Whatsapp button caption must not exceed 20 characters | whatsapp_button is too long |
Whatsapp lifetime must be in range from 60 to 86400 | whatsapp_lifetime out of range |
Message
| Error | Meaning |
|---|---|
WhatsApp is not confirmed for user | WhatsApp is not connected to your account |
Error in WhatsApp sender | The sender is not connected to your account or has no WhatsApp route |
WhatsApp sender display name is not approved | Meta has not approved the display name of the sender yet |
WhatsApp template not found | No template with this name and language for this sender |
WhatsApp template is not approved | The template is in review, rejected or paused |
Wrong number of WhatsApp template parameters | The number of values in whatsapp_var differs from params of the template |
WhatsApp template header content is required | The template has a media, location or text-with-placeholder header and its content is missing — see the table above |
WhatsApp template header takes no value | The text header of the template is static: do not pass whatsapp_header |
WhatsApp template header type mismatch | For example, a video for a template with an image header |
WhatsApp template has no header | Do not pass a file, a location or whatsapp_header |
WhatsApp template has one header | Pass one of: a file, whatsapp_location or whatsapp_header |
WhatsApp template button value is required | The template has a dynamic link or copy-code button: pass whatsapp_button_var or whatsapp_coupon |
WhatsApp template has no such button | The template has no button for the value passed |
WhatsApp authentication template needs a code | An authentication template without whatsapp_code |
WhatsApp authentication template takes only a code | Nothing but the code goes with an authentication template |
WhatsApp code is only for authentication templates | whatsapp_code for a template that is not an authentication one |
WhatsApp code is too long | whatsapp_code is longer than 15 characters |
WhatsApp coupon is too long | whatsapp_coupon is longer than 15 characters |
One kind of WhatsApp content per message | A free-form message carries one of: a file, a location, a card with a button |
Only one WhatsApp media file per message | Two files in one message |
WhatsApp location and audio carry no text | A location or an audio file goes without whatsapp_message |
WhatsApp location coordinates are out of range | Latitude outside −90…90 or longitude outside −180…180 |
Subscriber replies
A reply of the subscriber opens the 24-hour window for free-form messages to them.
- If the reply answers a message sent with
hook, the webhook of that message is sent again with the listreplies. - Otherwise the gateway sends a
POSTwith form fields to the notification address in the API settings:
| Field | Value |
|---|---|
action | whatsapp/inbound |
phone | Number of the subscriber |
message | Text of the reply or the caption of a file |
type | Type of the reply: text, image, video, audio, document, location, button and others |
datetime | Time of the reply, YYYY-MM-DDThh:mm:ss±hh:mm |
button | The button the subscriber pressed |
media[url], media[type] | Link to the file and its MIME type |
location[latitude], location[longitude], location[name], location[address] | The location the subscriber sent |
msg_id | Your message the reply answers, when it is known |
A link to a file is valid for 24 hours: download the file when the notification arrives. For a reply with a file the notification comes once the file is stored with us, usually within seconds.