WhatsApp Business API v2

Send templates, session text and media with the same API keys as SMS. Base URL: https://connect.xcodefixglobal.com/api/v2

Auth: Authorization: Bearer YOUR_API_KEY (or api_key). Manage keys in API Management. Each successful send uses 1 WhatsApp credit.
Meta 24-hour rule: free-form message and media_url only work when the recipient messaged you in the last 24 hours. Outside that window, send an approved template first.
POSThttps://connect.xcodefixglobal.com/api/v2/whatsapp/send

Send a template, session text, or media message.

ParameterTypeRequiredDescription
tostringYesRecipient with country code, e.g. 919876543210
templatestringOne of*Approved template name
paramsarrayNoOrdered values for {{1}}, {{2}}…
languagestringNoTemplate language (defaults to template language)
messagestringOne of*Free-form text (open 24h session only)
media_urlstringOne of*Public https URL (open 24h session only)
media_typestringNoimage, video, document, audio
captionstringNoMedia caption
header_media_urlstringNo†Public https URL for a template approved with an image/video/document header
header_media_typestringNoimage (default), video, document
header_filenamestringNoFilename shown for a document header
header_paramsarrayNoSingle 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 — template
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 — template with image header
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 — session text
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 — media
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"}'
PHP
$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);
Node.js
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());
Success
{
  "status": "success",
  "data": {
    "message_id": "wamid.HBgMOTE5...",
    "id": 51,
    "to": "919876543210"
  }
}
GEThttps://connect.xcodefixglobal.com/api/v2/whatsapp/templates

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 sender
  • is_test_only — restricted to test numbers
  • send_disabled_reason — human-readable block reason when not sendable
GEThttps://connect.xcodefixglobal.com/api/v2/whatsapp/status/{messageId}

Delivery 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"

External bots: webhooks and hand-off

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 pathWhat it does
GET /whatsapp/accountYour number, whether it is shared, your subscription
POST /whatsapp/webhooksCreate 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/webhooksYour 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/usageReport 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.

Error responses

HTTPCode / meaningWhat to do
401UnauthorizedCreate or rotate an API key
402Insufficient WhatsApp creditsTop up WhatsApp credits
403WhatsApp module disabledAsk your account manager to enable WhatsApp
404Template not found / not approvedCall GET /whatsapp/templates
409No WABA connectedFinish WhatsApp onboarding in the dashboard
422template_required24h window closed — send a template first
422template_not_sendableTemplate blocked for this sender
422invalid_recipientFix the to number format
502Upstream send failedRetry; check Meta / provider status

Try in Playground Back to API docs

How can we help?

Sales
Support
Billing
Technical
CAPTCHA
Type the 4 characters shown in the image