API Reference v1.0

Send Template Message

Send a pre-approved WhatsApp template message to any user, regardless of the 24-hour service window. Template messages are the primary way to initiate conversations with customers.

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

Sends a pre-approved template message to a recipient. Templates can include dynamic variables in the header, body, and buttons. This is the only message type that can be sent outside the 24-hour customer service window.

No 24-Hour Restriction: Template messages are the only message type that can be sent outside the 24-hour customer service window. Templates must be pre-approved by Meta before use. You can manage templates from your dashboard or via the Templates API.

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 as registered with Meta. Case-sensitive.
template_language required string Language code of the template. Common values: en, en_US, hi, es, pt_BR.
components optional array Array of component objects to fill template variables. Required if your template contains dynamic placeholders (1, 2, etc.).

Component Format

The components array allows you to pass dynamic values into your template's header, body, and button placeholders. Each component targets a specific section of the template.

Body Variables

Replace 1, 2, etc. in the template body with dynamic text values.

Body Component Structure
{ "type": "body", "parameters": [ { "type": "text", "text": "John" }, { "type": "text", "text": "Order #12345" } ] }

Header Image

Provide a dynamic image for templates with an image header.

Header Image Component
{ "type": "header", "parameters": [ { "type": "image", "image": { "link": "https://example.com/image.jpg" } } ] }

Button Variables

Provide dynamic values for URL buttons that contain a variable suffix (e.g., a tracking URL).

Button Component Structure
{ "type": "button", "sub_type": "url", "index": "0", "parameters": [ { "type": "text", "text": "order-12345" } ] }

Examples

1. Simple Template (No Variables)

Send a template that has no dynamic placeholders, such as a static greeting or opt-in confirmation.

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

2. Template with Body Variables

Send a template that contains dynamic placeholders in the body, such as a customer name and order number.

Example template body: Hi 1, your 2 has been shipped and will arrive by 3.

cURL
curl -X POST https://whatsbizapi.com/api/wpbox/sendtemplatemessage \ -H "Content-Type: application/json" \ -d '{ "token": "YOUR_API_TOKEN", "phone": "+919876543210", "template_name": "order_shipped", "template_language": "en", "components": [ { "type": "body", "parameters": [ {"type": "text", "text": "John"}, {"type": "text", "text": "Order #12345"}, {"type": "text", "text": "March 15, 2025"} ] } ] }'
Request Body
{ "token": "YOUR_API_TOKEN", "phone": "+919876543210", "template_name": "order_shipped", "template_language": "en", "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "John" }, { "type": "text", "text": "Order #12345" }, { "type": "text", "text": "March 15, 2025" } ] } ] }
Response 200
{ "status": "success", "message_id": 457, "message_wamid": "wamid.HBgNOTE5ODc2NTQzMjEwFQIAERgSRDc5..." }

3. Template with Header Image + Body Variables + Button

Send a rich template that includes a dynamic header image, body variables, and a URL button with a variable suffix.

cURL
curl -X POST https://whatsbizapi.com/api/wpbox/sendtemplatemessage \ -H "Content-Type: application/json" \ -d '{ "token": "YOUR_API_TOKEN", "phone": "+919876543210", "template_name": "order_confirmation", "template_language": "en", "components": [ { "type": "header", "parameters": [ { "type": "image", "image": { "link": "https://example.com/products/shoe-banner.jpg" } } ] }, { "type": "body", "parameters": [ {"type": "text", "text": "John"}, {"type": "text", "text": "Order #12345"}, {"type": "text", "text": "$129.99"} ] }, { "type": "button", "sub_type": "url", "index": "0", "parameters": [ {"type": "text", "text": "order-12345"} ] } ] }'
Request Body
{ "token": "YOUR_API_TOKEN", "phone": "+919876543210", "template_name": "order_confirmation", "template_language": "en", "components": [ { "type": "header", "parameters": [ { "type": "image", "image": { "link": "https://example.com/products/shoe-banner.jpg" } } ] }, { "type": "body", "parameters": [ { "type": "text", "text": "John" }, { "type": "text", "text": "Order #12345" }, { "type": "text", "text": "$129.99" } ] }, { "type": "button", "sub_type": "url", "index": "0", "parameters": [ { "type": "text", "text": "order-12345" } ] } ] }
Response 200
{ "status": "success", "message_id": 458, "message_wamid": "wamid.HBgNOTE5ODc2NTQzMjEwFQIAERgSRjk2..." }

Error Responses

Error - Invalid Template 400
{ "status": "error", "message": "Template 'my_template' not found or not approved." }
Error - Missing Variables 400
{ "status": "error", "message": "Template requires 3 body parameters but 1 was provided." }
Error - Authentication 401
{ "status": "error", "message": "Invalid API token." }

Notes

Template Approval Required: All templates must be submitted to and approved by Meta before they can be used. Approval typically takes a few minutes to 24 hours. You can check template status in your dashboard or via the Templates API.

Variable Order Matters: The parameters in the components array are positional. The first parameter replaces 1, the second replaces 2, and so on. Ensure parameters are passed in the correct order.

Header Media: For templates with media headers, the image URL must be publicly accessible. Supported formats: JPEG and PNG. Maximum file size: 5 MB. The URL must use HTTPS.

Rate Limiting: WhatsApp applies per-template rate limits. If a template is flagged for low quality or high block rates, Meta may pause or disable it. Monitor template quality ratings in your dashboard.