Skip to content
Meta Business PartnerDeveloper how-to

How to send a WhatsApp template message with the API

A template message is how a business starts a WhatsApp conversation, or restarts one after the 24-hour window has closed. You create the template once, Meta reviews it, and from then on each send names the template, its language and the values for its variables. This guide shows the JSON for each common template shape, sent through InfiQ's API.

template
Message type
The name and language.code of an approved template
Must match
body, header and button components
Variables
parameter_name with each value
Named parameters
A public HTTPS link (or a media ID)
Media headers
Position in the template, counted from 0
Button index

In short

Send type template with template.name, template.language.code and a components array that fills the variables: a body component with text parameters, a header component for an image, video or document, and button components for quick replies, URLs and copy codes. The name and language code must match an approved template exactly, and the number of parameters must match its placeholders.

When a template is required

Use a template for any message you send first and for anything sent more than 24 hours after the customer's last message. Each template belongs to a category, and Meta charges per delivered message by category: in India ₹0.94 for marketing, ₹0.19 for utility and ₹0.14 for authentication. Marketing templates also need the customer's opt-in.

Send a template with no variables

The smallest template send names the template and its language. hello_world is the sample template Meta adds to new accounts, approved in en_US:

curl -X POST https://api.infiq.in/v1/messages \
-H "X-INFIQ-API-KEY: $INFIQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "919820000001",
"type": "template",
"template": {
"name": "hello_world",
"language": {
"code": "en_US"
}
}
}'

Fill the body variables

A template with placeholders takes a body component with one parameter per placeholder, in order. If the template was created with named parameters, such as customer_name and order_id, pass parameter_name with each value instead, and the order no longer matters. Currency and date values have their own parameter types with a fallback text.

{
"messaging_product": "whatsapp",
"to": "919820000001",
"type": "template",
"template": {
"name": "order_confirmation",
"language": {
"code": "en"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Ananya"
},
{
"type": "text",
"text": "INF-3091"
}
]
}
]
}
}

Add a media header

If the template has an image, video or document header, send the file with each message as a header parameter. The link must be a public HTTPS URL that WhatsApp can download; a link it can't fetch fails with error 131052. For documents, filename sets the name the customer sees.

{
"messaging_product": "whatsapp",
"to": "919820000001",
"type": "template",
"template": {
"name": "shipment_update",
"language": {
"code": "en"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"image": {
"link": "https://www.infiq.in/media/box.jpg"
}
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "INF-3091"
}
]
}
]
}
}

Fill the buttons: quick replies, URLs and copy codes

Button components are addressed by sub_type and index, the button's position in the template counted from 0. Quick-reply buttons take a payload that comes back to you when the customer taps; dynamic URL buttons take the text added to the end of the URL; copy-code buttons take the coupon code.

{
"messaging_product": "whatsapp",
"to": "919820000001",
"type": "template",
"template": {
"name": "reorder_prompt",
"language": {
"code": "en"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Ananya"
}
]
},
{
"type": "button",
"sub_type": "quick_reply",
"index": "0",
"parameters": [
{
"type": "payload",
"payload": "REORDER_INF3091"
}
]
},
{
"type": "button",
"sub_type": "quick_reply",
"index": "1",
"parameters": [
{
"type": "payload",
"payload": "STOP_PROMOS"
}
]
}
]
}
}

Fix the errors people hit first

Most failed template sends come down to one of these:

  • 132001, template name does not exist in the translation: the name or the language code doesn't match an approved template. en and en_US are different languages to WhatsApp, so send the exact code the template was approved in.
  • 132000, number of parameters doesn't match: the template expects a different number of values than you sent. Count the placeholders in the approved version, header included.
  • 131052, media download error: the header link isn't publicly reachable over HTTPS.
  • A paused or disabled template: Meta pauses templates that collect poor quality signals. InfiQ posts template.paused and template.disabled webhooks, so you can switch to another template before sends fail.

* Per-message rates for India, ex-GST: marketing, utility and authentication effective 1 July 2026; service messages ₹0.145 since 1 October 2026 after the first 1,000 a month on each WhatsApp number, which are free (all were ₹0 until 30 September 2026). Volume commitments earn discounts — final rate is confirmed on your account; applicable GST extra. Rates for other countries differ (see the international rate table on /pricing).

Get your InfiQ API key

Frequently asked questions

What language code should I send for an English template?+
The exact code the template was approved in. en, en_US and en_GB are separate languages to WhatsApp. Check the template's language in the dashboard and send that code; a mismatch fails with error 132001.
Can I send a WhatsApp template with an image?+
Yes, if the template was created with an image header. Send the image as a header parameter with a public HTTPS link. You can't add an image to a template that was approved without one; create a new template with an image header instead.
Why do I get “template name does not exist in the translation”?+
That is error 132001: WhatsApp found no approved template with that name in the language you sent. Check the spelling (template names are lower case with underscores), the language code, and that the template is approved rather than pending, rejected or paused.
Can I send a template to a customer who hasn't opted in?+
Meta's policies require opt-in before a business messages someone first, and marketing templates sent without it lead to blocks, reports and a lower quality rating. Collect opt-in at sign-up or checkout and keep a record of it.