REST API

WhatsApp Business API — Send Rich Messages & Templates | BulkSMS.ca

Complete REST API for WhatsApp Business. Send template messages, rich media, interactive buttons, and manage conversations at scale.

Base URL: https://api.bulksms.ca

What is the WhatsApp Business API?

The WhatsApp Business API is an official messaging channel that allows businesses to send and receive messages at scale. Unlike the WhatsApp Business App, the API supports template messages, rich media (images, video, documents), interactive buttons, chatbots, and multi-agent support. Messages are sent via REST API with API key authentication, and webhook notifications provide real-time delivery and read receipts.

Authentication

Authorization Header
Authorization: Bearer YOUR_API_KEY Content-Type: application/json

Include your API key in the Authorization header of every request. API keys are available in your BulkSMS.ca dashboard under Settings > API Keys.

API Endpoints

POST/v2/whatsapp/send

Send a WhatsApp template message.

Auth: API Key
Request Body
{ "to": "9198XXXXXXXX", "template": "order_confirmation", "language": "en", "params": ["John", "ORD12345"] }
Response (200 OK)
{ "status": "success", "message_id": "wa_msg_001", "conversation_id": "conv_abc" }
POST/v2/whatsapp/send-text

Send a text message (within 24h session).

Auth: API Key
Request Body
{ "to": "9198XXXXXXXX", "message": "Hello! How can we help you today?" }
Response (200 OK)
{ "status": "success", "message_id": "wa_msg_002" }
POST/v2/whatsapp/send-media

Send an image, video, or document.

Auth: API Key
Request Body
{ "to": "9198XXXXXXXX", "type": "image", "url": "https://example.com/image.jpg", "caption": "Check out our new collection!" }
Response (200 OK)
{ "status": "success", "message_id": "wa_msg_003", "media_id": "media_001" }
POST/v2/whatsapp/send-buttons

Send an interactive button message.

Auth: API Key
Request Body
{ "to": "9198XXXXXXXX", "body": "Would you like to proceed?", "buttons": [ { "id": "yes", "title": "Yes" }, { "id": "no", "title": "No" } ] }
Response (200 OK)
{ "status": "success", "message_id": "wa_msg_004" }
GET/v2/whatsapp/templates

List approved WhatsApp templates.

Auth: API Key
Response (200 OK)
{ "templates": [ { "name": "order_confirmation", "status": "approved", "language": "en" } ] }
POST/v2/whatsapp/webhook

Configure webhook URL for incoming messages.

Auth: API Key
Request Body
{ "url": "https://your-app.com/webhook", "events": ["message.received", "message.read"] }
Response (200 OK)
{ "status": "success", "webhook_id": "wh_001" }

SDK Code Examples

cURL
curl (built-in)
curl -X POST https://api.bulksms.ca/v2/whatsapp/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "9198XXXXXXXX",
    "template": "order_confirmation",
    "language": "en",
    "params": ["John", "ORD12345"]
  }'
Node.js
npm install axios
const axios = require('axios');

// Send template
await axios.post('https://api.bulksms.ca/v2/whatsapp/send', {
  to: '9198XXXXXXXX',
  template: 'order_confirmation',
  language: 'en',
  params: ['John', 'ORD12345']
}, { headers: { Authorization: 'Bearer YOUR_API_KEY' }});

// Handle incoming webhook
app.post('/webhook', (req, res) => {
  console.log('Message from:', req.body.from);
  console.log('Text:', req.body.message);
  res.sendStatus(200);
});
Python
pip install requests
import requests

response = requests.post("https://api.bulksms.ca/v2/whatsapp/send",
  headers={"Authorization": "Bearer YOUR_API_KEY"},
  json={
    "to": "9198XXXXXXXX",
    "template": "order_confirmation",
    "language": "en",
    "params": ["John", "ORD12345"]
  }
)
print(response.json())
PHP
composer require guzzlehttp/guzzle
$client = new GuzzleHttp\Client();
$response = $client->post('https://api.bulksms.ca/v2/whatsapp/send', [
  'headers' => ['Authorization' => 'Bearer YOUR_API_KEY'],
  'json' => [
    'to' => '9198XXXXXXXX',
    'template' => 'order_confirmation',
    'language' => 'en',
    'params' => ['John', 'ORD12345']
  ]
]);
echo $response->getBody();

Webhooks

Configure webhooks in your dashboard to receive real-time event notifications.

Supported Events

message.receivedmessage.readmessage.deliveredmessage.sentbutton.clicked
Webhook Payload Example
{
  "event": "message.received",
  "from": "9198XXXXXXXX",
  "message_id": "wa_msg_005",
  "type": "text",
  "body": "I want to place an order",
  "timestamp": "2026-06-15T14:30:22+05:30"
}

Error Codes

Code
Description
200
Success — Message sent
400
Bad Request — Invalid template or parameters
401
Unauthorized — Invalid API key
403
Forbidden — Template not approved or expired
409
Session Expired — Outside 24h window, use template
429
Rate Limited — Conversation limit reached
470
Number Not on WhatsApp — Recipient does not use WhatsApp

FAQs

What is a WhatsApp template message?

Template messages are pre-approved message formats that businesses can send to customers who have opted in. They can include variables, media headers, and interactive buttons.

Can I send free-form messages?

Free-form (session) messages can only be sent within a 24-hour window after the customer last messaged you. Outside this window, you must use approved templates.

What media types are supported?

WhatsApp API supports images (JPEG, PNG), video (MP4), audio (MP3, OGG), documents (PDF), and stickers.

How do I get templates approved?

Submit templates through your BSP dashboard. Meta reviews templates within 24-48 hours. Templates must follow WhatsApp guidelines.

What is conversation-based pricing?

WhatsApp charges per conversation (24-hour session), not per message. User-initiated conversations cost less than business-initiated ones.

Ready to Integrate?

Get your API key and start building.

All APIs