API documentation
Everything you need to send WhatsApp messages from your website, app or automation tool.
Introduction
The REST API lets you send WhatsApp messages, media, OTP codes and campaigns, manage contacts and receive events. All requests and responses use JSON.
https://bcmagency.net/wp-json/wpbcm/v1
Authentication
Create an API key from the dashboard (API keys page) and send it with every request in the "token" header. "Authorization: Bearer <key>" and the ?token= query parameter are also accepted.
token: YOUR_API_TOKEN
Rate limit: 120 requests per minute per key.
Safe retries (Idempotency-Key)
Add an "Idempotency-Key" header with a unique value (for example a UUID or your order ID) to any POST request. If the network fails and you send the same request again with the same key within 24 hours, the API returns the first result instead of sending the message twice. The replayed response carries the header "Idempotent-Replayed: true".
Idempotency-Key: order-1045-shipped
Responses & errors
Successful responses contain "success": true. Errors return an HTTP status code with a machine readable "code" and a human readable "message".
{
"success": false,
"code": "INSTANCE_NOT_CONNECTED",
"message": "This WhatsApp number is not connected."
}
| HTTP | code | Meaning |
|---|---|---|
| 401 | TOKEN_MISSING / TOKEN_INVALID | Missing or invalid API key. |
| 402 | SUBSCRIPTION_INACTIVE | No active subscription. |
| 404 | INSTANCE_NOT_FOUND | Unknown instance ID. |
| 409 | INSTANCE_NOT_CONNECTED | The number is not linked. Scan the QR code again. |
| 409 | IDEMPOTENCY_CONFLICT | A request with the same Idempotency-Key is still being processed. |
| 422 | VALIDATION_ERROR / INVALID_PHONE | A parameter is missing or invalid. |
| 429 | RATE_LIMITED / QUOTA_EXCEEDED | Too many requests or plan limit reached. |
| 502 | GATEWAY_ERROR | WhatsApp could not deliver the request. Retry later. |
Send a text message
https://bcmagency.net/wp-json/wpbcm/v1/send-messageSend a WhatsApp text message. Supports {{variables}} and spintax {Hi|Hello}.
| Parameter | Required | Description |
|---|---|---|
instance_id | No | Instance ID (e.g. ins_xxx). Defaults to your first connected number. |
phone | Yes | Recipient in international format, e.g. 201001234567 (or a group JID). |
message | Yes | Message text (max 4096 characters). |
vars | No | Object of variables used in the message, e.g. {"name":"Ahmed"}. |
schedule_at | No | Optional ISO date/time to send later. |
curl -X POST "https://bcmagency.net/wp-json/wpbcm/v1/send-message" \
-H "token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"instance_id": "ins_xxxxxxxx",
"phone": "201001234567",
"message": "Hello {{name}} 👋",
"vars": {
"name": "Ahmed"
}
}'
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/send-message');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'instance_id' => 'ins_xxxxxxxx',
'phone' => '201001234567',
'message' => 'Hello {{name}} 👋',
'vars' => [
'name' => 'Ahmed'
]
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/send-message', {
method: 'POST',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
body: JSON.stringify({
"instance_id": "ins_xxxxxxxx",
"phone": "201001234567",
"message": "Hello {{name}} 👋",
"vars": {
"name": "Ahmed"
}
}),
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: POST
URL: https://bcmagency.net/wp-json/wpbcm/v1/send-message
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Send Body: ON → JSON
{
"instance_id": "ins_xxxxxxxx",
"phone": "201001234567",
"message": "Hello {{name}} 👋",
"vars": {
"name": "Ahmed"
}
}
Response
{
"success": true,
"message": "Message sent successfully.",
"data": {
"id": 1024,
"instance_id": "ins_xxx",
"direction": "out",
"phone": "201001234567",
"type": "text",
"status": "sent",
"provider_id": "3EB0C431C26A1916E1A8"
}
}
Send media (image, video, audio, document)
https://bcmagency.net/wp-json/wpbcm/v1/send-mediaSend a file from a public URL with an optional caption.
| Parameter | Required | Description |
|---|---|---|
instance_id | No | Instance ID (e.g. ins_xxx). Defaults to your first connected number. |
phone | Yes | Recipient in international format, e.g. 201001234567 (or a group JID). |
media_url | Yes | Public URL of the file. |
type | No | image | video | audio | document |
caption | No | Caption text. |
filename | No | File name shown for documents. |
curl -X POST "https://bcmagency.net/wp-json/wpbcm/v1/send-media" \
-H "token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"instance_id": "ins_xxxxxxxx",
"phone": "201001234567",
"media_url": "https://example.com/invoice.pdf",
"type": "document",
"caption": "Your invoice",
"filename": "invoice.pdf"
}'
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/send-media');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'instance_id' => 'ins_xxxxxxxx',
'phone' => '201001234567',
'media_url' => 'https://example.com/invoice.pdf',
'type' => 'document',
'caption' => 'Your invoice',
'filename' => 'invoice.pdf'
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/send-media', {
method: 'POST',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
body: JSON.stringify({
"instance_id": "ins_xxxxxxxx",
"phone": "201001234567",
"media_url": "https://example.com/invoice.pdf",
"type": "document",
"caption": "Your invoice",
"filename": "invoice.pdf"
}),
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: POST
URL: https://bcmagency.net/wp-json/wpbcm/v1/send-media
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Send Body: ON → JSON
{
"instance_id": "ins_xxxxxxxx",
"phone": "201001234567",
"media_url": "https://example.com/invoice.pdf",
"type": "document",
"caption": "Your invoice",
"filename": "invoice.pdf"
}
Send a saved template
https://bcmagency.net/wp-json/wpbcm/v1/send-templateSend one of your message templates with variables. For Cloud API numbers you can send approved Meta templates with cloud_template.
| Parameter | Required | Description |
|---|---|---|
instance_id | No | Instance ID (e.g. ins_xxx). Defaults to your first connected number. |
phone | Yes | Recipient in international format, e.g. 201001234567 (or a group JID). |
template_id | Yes | Template ID from GET /templates. |
vars | No | Object of variables used in the message, e.g. {"name":"Ahmed"}. |
cloud_template | No | {"name":"order_update","language":"ar","params":["Ahmed","#1001"]} |
curl -X POST "https://bcmagency.net/wp-json/wpbcm/v1/send-template" \
-H "token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"phone": "201001234567",
"template_id": 3,
"vars": {
"name": "Ahmed",
"order": "#1001"
}
}'
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/send-template');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'phone' => '201001234567',
'template_id' => 3,
'vars' => [
'name' => 'Ahmed',
'order' => '#1001'
]
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/send-template', {
method: 'POST',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
body: JSON.stringify({
"phone": "201001234567",
"template_id": 3,
"vars": {
"name": "Ahmed",
"order": "#1001"
}
}),
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: POST
URL: https://bcmagency.net/wp-json/wpbcm/v1/send-template
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Send Body: ON → JSON
{
"phone": "201001234567",
"template_id": 3,
"vars": {
"name": "Ahmed",
"order": "#1001"
}
}
Send a location
https://bcmagency.net/wp-json/wpbcm/v1/send-locationShare a map location pin.
| Parameter | Required | Description |
|---|---|---|
phone | Yes | Recipient in international format, e.g. 201001234567 (or a group JID). |
latitude | Yes | 30.0444 |
longitude | Yes | 31.2357 |
name | No | Place name. |
address | No | Address. |
curl -X POST "https://bcmagency.net/wp-json/wpbcm/v1/send-location" \
-H "token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"phone": "201001234567",
"latitude": 30.0444,
"longitude": 31.2357,
"name": "Our store"
}'
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/send-location');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'phone' => '201001234567',
'latitude' => 30.0444,
'longitude' => 31.2357,
'name' => 'Our store'
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/send-location', {
method: 'POST',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
body: JSON.stringify({
"phone": "201001234567",
"latitude": 30.0444,
"longitude": 31.2357,
"name": "Our store"
}),
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: POST
URL: https://bcmagency.net/wp-json/wpbcm/v1/send-location
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Send Body: ON → JSON
{
"phone": "201001234567",
"latitude": 30.0444,
"longitude": 31.2357,
"name": "Our store"
}
Check numbers on WhatsApp
https://bcmagency.net/wp-json/wpbcm/v1/check-numberCheck whether phone numbers have WhatsApp accounts (QR numbers only, up to 50 per request).
| Parameter | Required | Description |
|---|---|---|
phones | Yes | Array of phone numbers. |
curl -X POST "https://bcmagency.net/wp-json/wpbcm/v1/check-number" \
-H "token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"phones": [
"201001234567",
"201112223334"
]
}'
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/check-number');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'phones' => [
'201001234567',
'201112223334'
]
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/check-number', {
method: 'POST',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
body: JSON.stringify({
"phones": [
"201001234567",
"201112223334"
]
}),
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: POST
URL: https://bcmagency.net/wp-json/wpbcm/v1/check-number
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Send Body: ON → JSON
{
"phones": [
"201001234567",
"201112223334"
]
}
Message log
https://bcmagency.net/wp-json/wpbcm/v1/messagesList sent and received messages with their delivery status.
| Parameter | Required | Description |
|---|---|---|
direction | No | in | out |
status | No | pending | sent | delivered | read | failed | received |
phone | No | Filter by phone. |
page / per_page | No | 1 / 20 (max 100) |
curl -X GET "https://bcmagency.net/wp-json/wpbcm/v1/messages" \
-H "token: YOUR_API_TOKEN"
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/messages');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/messages', {
method: 'GET',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: GET
URL: https://bcmagency.net/wp-json/wpbcm/v1/messages
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Send an OTP code
https://bcmagency.net/wp-json/wpbcm/v1/otp/sendGenerates a secure one-time code and sends it on WhatsApp. The code is never returned by the API.
| Parameter | Required | Description |
|---|---|---|
phone | Yes | Recipient in international format, e.g. 201001234567 (or a group JID). |
length | No | 4 – 8 (default 6) |
expiry | No | Minutes, 1 – 60 (default 5). |
message | No | Custom text containing {{code}} and {{minutes}}. |
curl -X POST "https://bcmagency.net/wp-json/wpbcm/v1/otp/send" \
-H "token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"phone": "201001234567",
"length": 6,
"expiry": 5
}'
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/otp/send');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'phone' => '201001234567',
'length' => 6,
'expiry' => 5
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/otp/send', {
method: 'POST',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
body: JSON.stringify({
"phone": "201001234567",
"length": 6,
"expiry": 5
}),
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: POST
URL: https://bcmagency.net/wp-json/wpbcm/v1/otp/send
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Send Body: ON → JSON
{
"phone": "201001234567",
"length": 6,
"expiry": 5
}
Response
{
"success": true,
"message": "Verification code sent.",
"data": {
"otp_id": 77,
"phone": "201001234567",
"expires_in": 300
}
}
Verify an OTP code
https://bcmagency.net/wp-json/wpbcm/v1/otp/verifyReturns valid=true when the code is correct. Codes expire and allow 5 attempts.
| Parameter | Required | Description |
|---|---|---|
phone | Yes | The phone the code was sent to (or otp_id). |
code | Yes | 123456 |
curl -X POST "https://bcmagency.net/wp-json/wpbcm/v1/otp/verify" \
-H "token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"phone": "201001234567",
"code": "123456"
}'
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/otp/verify');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'phone' => '201001234567',
'code' => '123456'
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/otp/verify', {
method: 'POST',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
body: JSON.stringify({
"phone": "201001234567",
"code": "123456"
}),
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: POST
URL: https://bcmagency.net/wp-json/wpbcm/v1/otp/verify
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Send Body: ON → JSON
{
"phone": "201001234567",
"code": "123456"
}
Response
{
"success": true,
"valid": true,
"reason": "verified"
}
Create a bulk campaign
https://bcmagency.net/wp-json/wpbcm/v1/campaignsSend to many numbers with random delays between messages. Start now, schedule, or keep as draft.
| Parameter | Required | Description |
|---|---|---|
instance_ids | Yes | Array of instance IDs (messages are distributed round-robin). |
message | Yes | Default text with {{variables}}. |
messages | No | Array of rows: {"phone_number":"2010…","vars":{"name":"Amr"}}. |
numbers | No | Alternative: text with one number per line. |
group_ids | No | Contact group IDs. |
media_url | No | Optional media URL. |
wait_min / wait_max | No | Random delay between messages in seconds (default 5 – 15). |
start_now | No | true | false |
schedule_iso | No | 2026-10-05T09:00:00+02:00 |
curl -X POST "https://bcmagency.net/wp-json/wpbcm/v1/campaigns" \
-H "token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "October offer",
"instance_ids": [
"ins_xxxxxxxx"
],
"message": "Hi {{name|there}}, enjoy 20% off today!",
"messages": [
{
"phone_number": "201001234567",
"vars": {
"name": "Amr"
}
},
{
"phone_number": "201009876543"
}
],
"wait_min": 5,
"wait_max": 15,
"start_now": true
}'
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/campaigns');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'October offer',
'instance_ids' => [
'ins_xxxxxxxx'
],
'message' => 'Hi {{name|there}}, enjoy 20% off today!',
'messages' => [
[
'phone_number' => '201001234567',
'vars' => [
'name' => 'Amr'
]
],
[
'phone_number' => '201009876543'
]
],
'wait_min' => 5,
'wait_max' => 15,
'start_now' => true
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/campaigns', {
method: 'POST',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
body: JSON.stringify({
"name": "October offer",
"instance_ids": [
"ins_xxxxxxxx"
],
"message": "Hi {{name|there}}, enjoy 20% off today!",
"messages": [
{
"phone_number": "201001234567",
"vars": {
"name": "Amr"
}
},
{
"phone_number": "201009876543"
}
],
"wait_min": 5,
"wait_max": 15,
"start_now": true
}),
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: POST
URL: https://bcmagency.net/wp-json/wpbcm/v1/campaigns
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Send Body: ON → JSON
{
"name": "October offer",
"instance_ids": [
"ins_xxxxxxxx"
],
"message": "Hi {{name|there}}, enjoy 20% off today!",
"messages": [
{
"phone_number": "201001234567",
"vars": {
"name": "Amr"
}
},
{
"phone_number": "201009876543"
}
],
"wait_min": 5,
"wait_max": 15,
"start_now": true
}
List campaigns
https://bcmagency.net/wp-json/wpbcm/v1/campaignsCampaigns with progress counters.
| Parameter | Required | Description |
|---|---|---|
status | No | draft | scheduled | running | paused | completed | cancelled |
curl -X GET "https://bcmagency.net/wp-json/wpbcm/v1/campaigns" \
-H "token: YOUR_API_TOKEN"
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/campaigns');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/campaigns', {
method: 'GET',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: GET
URL: https://bcmagency.net/wp-json/wpbcm/v1/campaigns
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Start / pause / resume / cancel
https://bcmagency.net/wp-json/wpbcm/v1/campaigns/{id}/startReplace start with pause, resume or cancel.
curl -X POST "https://bcmagency.net/wp-json/wpbcm/v1/campaigns/{id}/start" \
-H "token: YOUR_API_TOKEN"
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/campaigns/{id}/start');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/campaigns/{id}/start', {
method: 'POST',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: POST
URL: https://bcmagency.net/wp-json/wpbcm/v1/campaigns/{id}/start
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Campaign recipients
https://bcmagency.net/wp-json/wpbcm/v1/campaigns/{id}/messagesStatus of every recipient of the campaign.
curl -X GET "https://bcmagency.net/wp-json/wpbcm/v1/campaigns/{id}/messages" \
-H "token: YOUR_API_TOKEN"
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/campaigns/{id}/messages');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/campaigns/{id}/messages', {
method: 'GET',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: GET
URL: https://bcmagency.net/wp-json/wpbcm/v1/campaigns/{id}/messages
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Retry the failed recipients
https://bcmagency.net/wp-json/wpbcm/v1/campaigns/{id}/retryCreates and starts a new campaign with the same content for the numbers that failed.
curl -X POST "https://bcmagency.net/wp-json/wpbcm/v1/campaigns/{id}/retry" \
-H "token: YOUR_API_TOKEN"
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/campaigns/{id}/retry');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/campaigns/{id}/retry', {
method: 'POST',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: POST
URL: https://bcmagency.net/wp-json/wpbcm/v1/campaigns/{id}/retry
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
List blocked numbers
https://bcmagency.net/wp-json/wpbcm/v1/blocklistNumbers that unsubscribed (opt-out keyword) or were blocked. Campaigns skip them automatically.
| Parameter | Required | Description |
|---|---|---|
search | No | Filter by phone. |
page / per_page | No | 1 / 30 (max 100) |
curl -X GET "https://bcmagency.net/wp-json/wpbcm/v1/blocklist" \
-H "token: YOUR_API_TOKEN"
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/blocklist');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/blocklist', {
method: 'GET',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: GET
URL: https://bcmagency.net/wp-json/wpbcm/v1/blocklist
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Block numbers
https://bcmagency.net/wp-json/wpbcm/v1/blocklistAdd one number (phone) or many (phones). Use it when a customer unsubscribes in your own system.
| Parameter | Required | Description |
|---|---|---|
phone | No | 201001234567 |
phones | No | ["201001234567","201009876543"] |
curl -X POST "https://bcmagency.net/wp-json/wpbcm/v1/blocklist" \
-H "token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"phones": [
"201001234567",
"201009876543"
]
}'
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/blocklist');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'phones' => [
'201001234567',
'201009876543'
]
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/blocklist', {
method: 'POST',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
body: JSON.stringify({
"phones": [
"201001234567",
"201009876543"
]
}),
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: POST
URL: https://bcmagency.net/wp-json/wpbcm/v1/blocklist
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Send Body: ON → JSON
{
"phones": [
"201001234567",
"201009876543"
]
}
Response
{
"success": true,
"message": "2 numbers added to the blocklist.",
"added": 2
}
Unblock a number
https://bcmagency.net/wp-json/wpbcm/v1/blocklist/{id}Remove an entry by its ID from GET /blocklist.
curl -X DELETE "https://bcmagency.net/wp-json/wpbcm/v1/blocklist/{id}" \
-H "token: YOUR_API_TOKEN"
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/blocklist/{id}');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/blocklist/{id}', {
method: 'DELETE',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: DELETE
URL: https://bcmagency.net/wp-json/wpbcm/v1/blocklist/{id}
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Create / update contacts
https://bcmagency.net/wp-json/wpbcm/v1/contactsUpsert by phone. Send one contact or an array in "contacts".
| Parameter | Required | Description |
|---|---|---|
phone | Yes | 201001234567 |
name | No | Ahmed |
email | No | ahmed@example.com |
group_ids | No | [1,2] |
fields | No | Custom fields usable as {{variables}}. |
curl -X POST "https://bcmagency.net/wp-json/wpbcm/v1/contacts" \
-H "token: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"phone": "201001234567",
"name": "Ahmed",
"group_ids": [
1
],
"fields": {
"city": "Cairo"
}
}'
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/contacts');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'phone' => '201001234567',
'name' => 'Ahmed',
'group_ids' => [
1
],
'fields' => [
'city' => 'Cairo'
]
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/contacts', {
method: 'POST',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
body: JSON.stringify({
"phone": "201001234567",
"name": "Ahmed",
"group_ids": [
1
],
"fields": {
"city": "Cairo"
}
}),
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: POST
URL: https://bcmagency.net/wp-json/wpbcm/v1/contacts
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Send Body: ON → JSON
{
"phone": "201001234567",
"name": "Ahmed",
"group_ids": [
1
],
"fields": {
"city": "Cairo"
}
}
List contacts
https://bcmagency.net/wp-json/wpbcm/v1/contactsSearch and paginate contacts.
| Parameter | Required | Description |
|---|---|---|
search | No | Name, phone or email. |
group_id | No | 1 |
curl -X GET "https://bcmagency.net/wp-json/wpbcm/v1/contacts" \
-H "token: YOUR_API_TOKEN"
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/contacts');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/contacts', {
method: 'GET',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: GET
URL: https://bcmagency.net/wp-json/wpbcm/v1/contacts
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
List contact groups
https://bcmagency.net/wp-json/wpbcm/v1/groupsGroups with contact counts.
curl -X GET "https://bcmagency.net/wp-json/wpbcm/v1/groups" \
-H "token: YOUR_API_TOKEN"
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/groups');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/groups', {
method: 'GET',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: GET
URL: https://bcmagency.net/wp-json/wpbcm/v1/groups
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
List message templates
https://bcmagency.net/wp-json/wpbcm/v1/templatesYour saved templates.
curl -X GET "https://bcmagency.net/wp-json/wpbcm/v1/templates" \
-H "token: YOUR_API_TOKEN"
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/templates');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/templates', {
method: 'GET',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: GET
URL: https://bcmagency.net/wp-json/wpbcm/v1/templates
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
List WhatsApp numbers
https://bcmagency.net/wp-json/wpbcm/v1/instancesAll instances with their connection status.
curl -X GET "https://bcmagency.net/wp-json/wpbcm/v1/instances" \
-H "token: YOUR_API_TOKEN"
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/instances');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/instances', {
method: 'GET',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: GET
URL: https://bcmagency.net/wp-json/wpbcm/v1/instances
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Response
{
"success": true,
"instances": [
{
"id": "ins_xxx",
"name": "Sales",
"driver": "gateway",
"status": "connected",
"phone": "201001234567"
}
]
}
Live instance status
https://bcmagency.net/wp-json/wpbcm/v1/instances/{instance_id}/statusRefreshes the connection state from WhatsApp.
curl -X GET "https://bcmagency.net/wp-json/wpbcm/v1/instances/ins_xxxxxxxx/status" \
-H "token: YOUR_API_TOKEN"
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/instances/ins_xxxxxxxx/status');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/instances/ins_xxxxxxxx/status', {
method: 'GET',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: GET
URL: https://bcmagency.net/wp-json/wpbcm/v1/instances/ins_xxxxxxxx/status
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Account, plan & usage
https://bcmagency.net/wp-json/wpbcm/v1/accountSubscription status, limits and usage counters.
curl -X GET "https://bcmagency.net/wp-json/wpbcm/v1/account" \
-H "token: YOUR_API_TOKEN"
<?php
$ch = curl_init('https://bcmagency.net/wp-json/wpbcm/v1/account');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['token: YOUR_API_TOKEN', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
const res = await fetch('https://bcmagency.net/wp-json/wpbcm/v1/account', {
method: 'GET',
headers: { 'token': 'YOUR_API_TOKEN', 'Content-Type': 'application/json' },
});
const data = await res.json();
console.log(data);
Node: HTTP Request
Method: GET
URL: https://bcmagency.net/wp-json/wpbcm/v1/account
Authentication: None
Send Headers: ON
• token = YOUR_API_TOKEN
Webhooks
Add a webhook URL in the dashboard and choose the events. We POST a JSON payload for every event and sign it with your webhook secret (HMAC-SHA256) in the X-WPBCM-Signature header.
| Event | Description |
|---|---|
message.received | Incoming message |
message.sent | Message sent |
message.failed | Message failed |
message.status | Delivery / read status |
instance.status | Number connected / disconnected |
campaign.completed | Campaign completed |
otp.verified | OTP verified |
Payload example
{
"event": "message.received",
"webhook_id": 4,
"timestamp": 1790000000,
"data": {
"id": 2051,
"instance_id": "ins_xxxxxxxx",
"direction": "in",
"phone": "201001234567",
"contact_name": "Ahmed",
"type": "text",
"body": "Hello",
"status": "received",
"is_group": false
}
}
Verify the signature
$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_WPBCM_SIGNATURE'] ?? '';
$expected = 'sha256=' . hash_hmac('sha256', $payload, 'YOUR_WEBHOOK_SECRET');
if (!hash_equals($expected, $signature)) { http_response_code(401); exit; }
$event = json_decode($payload, true);
// $event['event'], $event['data']['phone'], $event['data']['body'] ...
http_response_code(200);
const crypto = require('crypto');
app.post('/whatsapp-webhook', express.raw({ type: 'application/json' }), (req, res) => {
const expected = 'sha256=' + crypto.createHmac('sha256', 'YOUR_WEBHOOK_SECRET').update(req.body).digest('hex');
if (req.get('X-WPBCM-Signature') !== expected) return res.sendStatus(401);
const event = JSON.parse(req.body);
console.log(event.event, event.data);
res.sendStatus(200);
});
WooCommerce
- In the dashboard open Integrations → WooCommerce, choose the number and write a message for each order status.
- Copy your private integration URL.
- In your store go to WooCommerce → Settings → Advanced → Webhooks → Add webhook. Topic: "Order created" (and a second one for "Order updated"), Delivery URL: your integration URL, Secret: the same secret you saved in the integration (optional).
- Save. Customers now receive WhatsApp messages automatically with variables like {{first_name}}, {{order_number}}, {{total}}, {{status}} and {{items}}.
EasyOrders
- In the dashboard open Integrations → EasyOrders and create the integration.
- Copy the integration URL and add it as a webhook in your EasyOrders store settings (order created / order status changed).
- The customer phone, name, order number, total and status are detected automatically. If your payload uses another field for the phone, set its path (e.g. customer.phone).
n8n
- Add an "HTTP Request" node, method POST, URL: the endpoint you need (e.g. /send-message).
- Enable "Send Headers" and add a header named token with your API key.
- Enable "Send Body" (JSON) with phone and message — you can map values from previous nodes.
- To react to incoming messages, add a "Webhook" trigger node in n8n and paste its URL in the dashboard → Webhooks.