API Reference v1.0

Send Campaign

Send a campaign message to a contact using a pre-approved template. This endpoint is optimized for bulk sending workflows and integrates with the built-in campaign tracking system.

POST https://whatsbizapi.com/api/wpbox/sendcampaigns

Sends a campaign template message to a single contact. While similar to the Send Template endpoint, this endpoint is specifically designed for campaign workflows -- it integrates with campaign analytics, delivery tracking, and provides optimized throughput for bulk operations.

Campaign vs. Template Endpoint: Use this endpoint when sending messages as part of a marketing or notification campaign. It records delivery metrics (sent, delivered, read, failed) in the campaign tracking system. For one-off transactional template messages, use the Send Template endpoint instead.

Parameters

Parameter Type Description
token required string Your API authentication token.
phone required string Recipient phone number with country code. E.g., +919876543210.
template_name required string The exact name of the approved template. Must be pre-approved by Meta.
template_language required string Language code of the template. E.g., en, en_US, hi.
components optional array Array of component objects for template variables. Same format as the Send Template endpoint. See component format below.

Component Format

Components follow the same structure as the Send Template endpoint. Refer to the Send Template documentation for detailed component format reference.

Quick Reference

Body Variables
{ "type": "body", "parameters": [ {"type": "text", "text": "value for 1"}, {"type": "text", "text": "value for 2"} ] }
Header Image
{ "type": "header", "parameters": [ { "type": "image", "image": {"link": "https://example.com/banner.jpg"} } ] }

Examples

1. Simple Campaign Message

Send a campaign message using a template with no dynamic variables.

cURL
curl -X POST https://whatsbizapi.com/api/wpbox/sendcampaigns \ -H "Content-Type: application/json" \ -d '{ "token": "YOUR_API_TOKEN", "phone": "+919876543210", "template_name": "winter_sale_announcement", "template_language": "en" }'
Request Body
{ "token": "YOUR_API_TOKEN", "phone": "+919876543210", "template_name": "winter_sale_announcement", "template_language": "en" }
Response 200
{ "status": "success", "message_id": 789, "message_wamid": "wamid.HBgNOTE5ODc2NTQzMjEwFQIAERgSQTdC..." }

2. Personalized Campaign with Variables

Send a campaign message with personalized body variables such as customer name and a discount code.

Example template: Hi 1! Our biggest sale of the year is here. Use code 2 for 3 off your next order.

cURL
curl -X POST https://whatsbizapi.com/api/wpbox/sendcampaigns \ -H "Content-Type: application/json" \ -d '{ "token": "YOUR_API_TOKEN", "phone": "+919876543210", "template_name": "promotional_offer", "template_language": "en", "components": [ { "type": "body", "parameters": [ {"type": "text", "text": "Priya"}, {"type": "text", "text": "WINTER30"}, {"type": "text", "text": "30%"} ] } ] }'
Request Body
{ "token": "YOUR_API_TOKEN", "phone": "+919876543210", "template_name": "promotional_offer", "template_language": "en", "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "Priya" }, { "type": "text", "text": "WINTER30" }, { "type": "text", "text": "30%" } ] } ] }
Response 200
{ "status": "success", "message_id": 790, "message_wamid": "wamid.HBgNOTE5ODc2NTQzMjEwFQIAERgSRDhF..." }

3. Campaign with Header Image and Button

Send a rich campaign message with a promotional banner image, personalized body text, and a tracking URL button.

cURL
curl -X POST https://whatsbizapi.com/api/wpbox/sendcampaigns \ -H "Content-Type: application/json" \ -d '{ "token": "YOUR_API_TOKEN", "phone": "+919876543210", "template_name": "flash_sale", "template_language": "en", "components": [ { "type": "header", "parameters": [ { "type": "image", "image": { "link": "https://example.com/campaigns/flash-sale-banner.jpg" } } ] }, { "type": "body", "parameters": [ {"type": "text", "text": "Priya"}, {"type": "text", "text": "50%"}, {"type": "text", "text": "midnight tonight"} ] }, { "type": "button", "sub_type": "url", "index": "0", "parameters": [ {"type": "text", "text": "flash-sale-2025"} ] } ] }'
Request Body
{ "token": "YOUR_API_TOKEN", "phone": "+919876543210", "template_name": "flash_sale", "template_language": "en", "components": [ { "type": "header", "parameters": [ { "type": "image", "image": { "link": "https://example.com/campaigns/flash-sale-banner.jpg" } } ] }, { "type": "body", "parameters": [ { "type": "text", "text": "Priya" }, { "type": "text", "text": "50%" }, { "type": "text", "text": "midnight tonight" } ] }, { "type": "button", "sub_type": "url", "index": "0", "parameters": [ { "type": "text", "text": "flash-sale-2025" } ] } ] }
Response 200
{ "status": "success", "message_id": 791, "message_wamid": "wamid.HBgNOTE5ODc2NTQzMjEwFQIAERgSRjlH..." }

Bulk Sending Pattern

To send a campaign to multiple contacts, iterate over your contact list and call this endpoint for each recipient. The endpoint handles internal queuing and rate limiting automatically.

Bulk Sending Example (PHP)
$contacts = ["+919876543210", "+919876543211", "+919876543212"]; foreach ($contacts as $phone) { $response = Http::post('https://whatsbizapi.com/api/wpbox/sendcampaigns', [ 'token' => 'YOUR_API_TOKEN', 'phone' => $phone, 'template_name' => 'promotional_offer', 'template_language' => 'en', 'components' => [ [ 'type' => 'body', 'parameters' => [ ['type' => 'text', 'text' => 'Valued Customer'], ['type' => 'text', 'text' => 'SAVE20'], ['type' => 'text', 'text' => '20%'], ], ], ], ]); if ($response->json('status') === 'success') { echo "Sent to {$phone}: " . $response->json('message_wamid') . "\n"; } }

Error Responses

Error - Invalid Template 400
{ "status": "error", "message": "Template 'invalid_template' not found or not approved." }
Error - Authentication 401
{ "status": "error", "message": "Invalid API token." }
Error - Rate Limited 429
{ "status": "error", "message": "Rate limit exceeded. Please slow down your request rate." }
Error - Insufficient Plan 402
{ "status": "error", "message": "Your current plan does not support campaign sending. Please upgrade." }

Notes

Campaign Tracking: Messages sent through this endpoint are automatically tracked in your campaign analytics dashboard. You can view delivery rates, read rates, and response rates for each campaign in real time.

Rate Limits: Campaign messages are subject to WhatsApp's messaging limits, which are based on your phone number's quality rating and tier. Start with lower volumes and scale up as your quality rating improves. See Rate Limits for details.

Template Reuse: The components format is identical to the Send Template endpoint. If you have already integrated template sending, switching to the campaign endpoint requires only changing the URL from /sendtemplatemessage to /sendcampaigns.

Marketing Guidelines: WhatsApp enforces strict anti-spam policies. Only send campaign messages to users who have opted in. High block or report rates can result in your phone number being flagged, rate-limited, or banned by Meta. Always include an opt-out mechanism.

Bulk Optimization: When sending to large lists (1,000+ contacts), add a small delay (100-200ms) between requests to ensure optimal throughput without hitting rate limits. The system queues messages internally, but respecting rate limits from your end prevents 429 errors.