Send templates, session text and media with the same API keys as SMS. Base URL: https://connect.xcodefixglobal.com/api/v2
Authorization: Bearer YOUR_API_KEY
(or api_key). Manage keys in
API Management.
Each successful send uses 1 WhatsApp credit.
message and media_url only work
when the recipient messaged you in the last 24 hours. Outside that window, send an approved
template first.
Send a template, session text, or media message.
| Parameter | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient with country code, e.g. 919876543210 |
template | string | One of* | Approved template name |
params | array | No | Ordered values for {{1}}, {{2}}… |
language | string | No | Template language (defaults to template language) |
message | string | One of* | Free-form text (open 24h session only) |
media_url | string | One of* | Public https URL (open 24h session only) |
media_type | string | No | image, video, document, audio |
caption | string | No | Media caption |
header_media_url | string | No† | Public https URL for a template approved with an image/video/document header |
header_media_type | string | No | image (default), video, document |
header_filename | string | No | Filename shown for a document header |
header_params | array | No | Single value for a template with a text header variable |
*Provide exactly one of template, message, or media_url.
†Required when the template was approved with a media header — Meta rejects the send otherwise.
curl -X POST "https://connect.xcodefixglobal.com/api/v2/whatsapp/send" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to":"919876543210","template":"smsc_biz_otp_v1","params":["482913"]}'
curl -X POST "https://connect.xcodefixglobal.com/api/v2/whatsapp/send" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to":"919876543210","template":"quote_summary_card","params":["Arun","Alcazar 2024","21651","31 Aug 2026"],
"header_media_url":"https://example.com/quote-card.png","header_media_type":"image"}'
curl -X POST "https://connect.xcodefixglobal.com/api/v2/whatsapp/send" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to":"919876543210","message":"Thanks — we are on it."}'
curl -X POST "https://connect.xcodefixglobal.com/api/v2/whatsapp/send" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to":"919876543210","media_url":"https://example.com/invoice.pdf","media_type":"document","caption":"Your invoice"}'
$ch = curl_init('https://connect.xcodefixglobal.com/api/v2/whatsapp/send');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'to' => '919876543210',
'template' => 'smsc_biz_otp_v1',
'params' => ['482913'],
]),
CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($ch);
const res = await fetch('https://connect.xcodefixglobal.com/api/v2/whatsapp/send', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
to: '919876543210',
template: 'smsc_biz_otp_v1',
params: ['482913'],
}),
});
console.log(await res.json());
{
"status": "success",
"data": {
"message_id": "wamid.HBgMOTE5...",
"id": 51,
"to": "919876543210"
}
}
List approved templates for your connected WhatsApp Business account.
curl "https://connect.xcodefixglobal.com/api/v2/whatsapp/templates" \
-H "Authorization: Bearer YOUR_API_KEY"
Each item includes name, category, language, body text, parameter count, and:
is_sendable — can be sent from the current senderis_test_only — restricted to test numberssend_disabled_reason — human-readable block reason when not sendableDelivery status by numeric id or Meta wamid. Typical path:
sent → delivered → read, or failed.
curl "https://connect.xcodefixglobal.com/api/v2/whatsapp/status/51" \
-H "Authorization: Bearer YOUR_API_KEY"
Connect your own chatbot or AI assistant to your WhatsApp number. SMSC posts customer messages to your
HTTPS webhook; your bot answers with POST /whatsapp/send and can hand a chat to a person in the
SMSC inbox. On a shared number, customers reach your bot by sending your start code
(for example https://wa.me/918248808042?text=YOURCODE); on your own number every message is forwarded.
GET calls need Allow GET on the API key.
| Method and path | What it does |
|---|---|
GET /whatsapp/account | Your number, whether it is shared, your subscription |
POST /whatsapp/webhooks | Create or replace your webhook: url (public https), start_code (3–20 letters/digits; required on a shared number), events, label. Returns the signing secret once. |
GET /whatsapp/webhooks | Your subscriptions and their delivery health |
DELETE /whatsapp/webhooks/{id} | Switch a subscription off |
GET /whatsapp/conversation?phone= | Routing, 24-hour window and hand-off state for one customer |
POST /whatsapp/handoff | {to, reason?, summary?, department?}: hand the chat to a live agent (nothing is sent to the customer) |
POST /whatsapp/resume | {to}: hand the chat back to your bot |
POST /ai/usage | Report one AI call (tokens / audio seconds) for metering; idempotent on reference |
POST /whatsapp/read | {message_id, typing?}: blue ticks, and the typing indicator while your bot writes |
GET /whatsapp/media/{media_id} | Download a customer's photo, voice note, video or document |
Events (JSON POST to your URL; {event, id, created_at, subscription_id, data}):
message.inbound, message.status, thread.resumed, and on request
message.agent, thread.taken, contact.opted_out, contact.opted_in,
subscription.paused, subscription.resumed.
Each request carries X-SMSC-Event, X-SMSC-Delivery, X-SMSC-Timestamp and
X-SMSC-Signature: sha256=HMAC-SHA256(secret, "<timestamp>.<raw body>"). Verify the signature,
reject timestamps older than 5 minutes, and answer 2xx quickly; failures are retried (10 s, 60 s, 5 min).
curl -X POST "https://connect.xcodefixglobal.com/api/v2/whatsapp/webhooks" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://bot.example.com/smsc","start_code":"MYSHOP","label":"My shop bot"}'
Interactive messages and replies on POST /whatsapp/send (inside the 24-hour window):
curl -X POST "https://connect.xcodefixglobal.com/api/v2/whatsapp/send" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: reply-wamid.HBgM-1" \
-H "Content-Type: application/json" \
-d '{"to":"919876543210","message":"Pick a range","context_message_id":"wamid.HBgM...",
"list":{"button":"View ranges","sections":[{"title":"Wedding","rows":[{"id":"w1","title":"Classic"},{"id":"w2","title":"Premium"}]}]}}'
Also "cta_url":{"button_text":"Open catalogue","url":"https://…"}. A repeated
Idempotency-Key (24 h) returns the first answer and sends nothing again.
| HTTP | Code / meaning | What to do |
|---|---|---|
| 401 | Unauthorized | Create or rotate an API key |
| 402 | Insufficient WhatsApp credits | Top up WhatsApp credits |
| 403 | WhatsApp module disabled | Ask your account manager to enable WhatsApp |
| 404 | Template not found / not approved | Call GET /whatsapp/templates |
| 409 | No WABA connected | Finish WhatsApp onboarding in the dashboard |
| 422 | template_required | 24h window closed — send a template first |
| 422 | template_not_sendable | Template blocked for this sender |
| 422 | invalid_recipient | Fix the to number format |
| 502 | Upstream send failed | Retry; check Meta / provider status |