WhatsApp template variables: how to fill the parameters from the API (and why a send says missing_variables)
How to fill {{1}}, {{2}} and {{3}} in a WhatsApp template from code, with curl and Node examples, a check that counts the values before you send, and what the 132000 and 132012 errors mean when a send does reach Meta.
November 14, 2026 · 7 min read
You connected a number, you have an approved template, and the first send fails. Often the template wants a value for every {{n}} and you sent a different number of them. This guide shows how the values are filled from code, from the dashboard and from a chat with Claude or ChatGPT, how to catch a wrong count before anything leaves your server, and what Meta's own error codes say when a send does get that far.
SendFromChat is an independent product and is not affiliated with Meta or WhatsApp. It runs on Meta's official WhatsApp Cloud API; you keep your own WhatsApp Business account. Facts about Meta's API come from Meta's documentation, read on 14 Nov 2026. Meta can change them, so check the linked pages before you ship.
The one rule
A template body has placeholders: {{1}}, {{2}}, {{3}}. Every placeholder needs a value, and the values go in the order the placeholders appear. Take this approved template, called order_shipped:
Hi {{1}}, order {{2}} ships on {{3}}. Thanks!
Three placeholders means three values: Ana, #4821, Tuesday. Two values is a wrong count.
From the REST API
Values go in template.variables, as an array in placeholder order:
curl -i https://sendfromchat.com/api/v1/messages \
-H "Authorization: Bearer sfc_test_…" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-4821-shipped" \
-d '{
"to": "+447700900123",
"template": {
"name": "order_shipped",
"language": "en_US",
"variables": ["Ana", "#4821", "Tuesday"]
}
}'
An object works too, and makes the order explicit: "variables": { "1": "Ana", "2": "#4821", "3": "Tuesday" } (REST API reference). If you leave out language, it is en_US. A language code that doesn't match your template (en_GB is not en_US) is a different failure: the template isn't found.
With a test key (sfc_test_…) you get 200 and "status": "test": the checks run, nothing is sent (test without sending). With a live key you get 202 and "status": "accepted", which means accepted, not delivered.
What happens when the count is wrong
Send two values to the three-placeholder template and SendFromChat answers before it calls Meta:
{
"error": {
"type": "missing_variables",
"message": "Template \"order_shipped\" needs {{3}} — pass them as variables {\"1\": \"…\"}."
}
}
The status is 400. The message names the placeholders that have no value. An empty or blank string counts as missing too. This check is in our send code (lib/services/messages.ts, before the Meta call) and listed in the error table; it needs the template to be known to your workspace. A template made in WhatsApp Manager appears after Sync from Meta on the Templates page (templates docs).
What this check does not do: it looks for missing values. Sending more values than the template has is not caught here, so that request goes on to Meta. Meta's error table describes code 132000 as the number of variable values not matching the number of variables in the template, and 132012 as values formatted incorrectly (the values don't use the format the template specifies) (Cloud API error codes, read 14 Nov 2026). When Meta refuses a send, SendFromChat returns 422 with whatsapp_rejected and Meta's reason. Neither code is retryable: fix the request. Our error-codes guide covers the rest of the table.
Count the values before you send (Node)
Your code can ask the API what a template needs. GET /templates lists each template with a variables array, one entry per placeholder (REST API reference). This helper reads it and refuses to send a wrong count:
const BASE = "https://sendfromchat.com/api/v1";
const headers = {
Authorization: `Bearer ${process.env.SFC_API_KEY}`,
"Content-Type": "application/json",
};
// Ask the API which approved template you mean and how many values it needs.
async function templateInfo(name, language = "en_US") {
const res = await fetch(`${BASE}/templates?status=approved`, { headers });
if (!res.ok) throw new Error(`templates list failed: ${res.status}`);
const { templates } = await res.json();
return templates.find((t) => t.name === name && t.language === language);
}
// Send only if the number of values matches the template.
export async function sendTemplate(to, name, values, language = "en_US") {
const info = await templateInfo(name, language);
if (!info) return { ok: false, reason: `no approved template ${name} (${language})` };
if (values.length !== info.variables.length) {
return { ok: false, reason: `${name} needs ${info.variables.length} values, got ${values.length}` };
}
const res = await fetch(`${BASE}/messages`, {
method: "POST",
headers: { ...headers, "Idempotency-Key": `${name}-${to}-${values.join("|")}` },
body: JSON.stringify({ to, template: { name, language, variables: values } }),
});
const body = await res.json();
if (!res.ok) return { ok: false, status: res.status, type: body.error?.type, message: body.error?.message };
return { ok: true, status: res.status, body };
}
We ran this against a local mock that copies the documented behaviour (mock only, not run against the real API or Meta). Three values returned 200 with "status": "test". Two values were stopped by the helper (order_shipped needs 3 values, got 2). Calling the endpoint directly with two values returned 400 missing_variables. An unknown template stopped the helper, and a bad key returned 401.
Two details in that code are on purpose. The Idempotency-Key is built from the event (template, recipient, values), not from a random value, so a retried job doesn't send a second message (why this matters). And the check is a convenience: the API enforces the count either way.
From the dashboard
In the inbox, when you choose a template, SendFromChat shows one input per placeholder ("Value for {{1}}", "Value for {{2}}", and so on) and keeps Send off until every one is filled. In campaigns, each placeholder is filled from a contact column, the contact's name or fixed text (templates docs). Through the assistant, the campaign preview is described in the tool's own description as flagging unmapped or empty variables before anything is created.
From Claude or ChatGPT
Once your assistant is connected (connect your assistant), the template is a sentence:
Send the order_shipped template to +44 7700 900123 with Ana, #4821 and Tuesday.
Behind that, the assistant calls the send_message tool with the template name, language and variables {"1":"Ana","2":"#4821","3":"Tuesday"}. If a value is missing, expect a missing_variables error back, and the assistant can ask you for the value. An assistant can still pick the wrong template or the wrong value from your wording, so read the preview before you confirm a real send. The Claude and ChatGPT guide walks through it.
What the API fills, and what it doesn't
The send request has one place for values: the body. That covers most utility templates, such as order updates, reminders and sign-in codes. A few related cases:
- Image header. If the template has a picture header, it is attached automatically. If we don't have the picture, the send returns
header_image_missing(image header guide). - Sign-in code templates. For an Authentication template, pass the code as variable 1; the copy-code button is filled in for you (REST API reference).
- Variables in the header, footer or buttons. The template builder here doesn't allow variables in headers or footers, and the send request has no field for button parameters. If you need those, check whether your template can be reworked so personal details sit in the body.
- Named parameters. Meta's documentation now describes named parameters (
{{first_name}}) next to the numbered ones, and says the format is positional by default (Meta, template fundamentals, read 14 Nov 2026). SendFromChat's template builder and send API use numbered placeholders,{{1}},{{2}}. Keep to those here.
A checklist when a template send fails
- Count the placeholders in the body and compare with
variables.lengthfromGET /templates. - Order. Value 1 fills
{{1}}. Swapping two values won't raise an error; it sends the wrong text. - Blank values. An empty string counts as missing. Use a real fallback, such as "there", when a name is unknown.
- Language code. Use the one on the template (
en_US,de, and so on). A wrong one givestemplate_not_found, or Meta's132001when it comes from Meta (error-codes guide). - Approved status.
template_not_approvedmeans wait or fix the template (approval rules). - Outside the 24-hour window, only a template can be sent, so the failure is the template, not the window (how the window works).
- Status after sending.
202is accepted. Watchmessage.statusforfailedand its reason (delivery status guide).
A note for EU and UK customers
SendFromChat stores data in Mumbai, India. Transfers from the EU and UK are covered by the Standard Contractual Clauses and the UK Addendum in our Data Processing Agreement, and the sub-processors are listed publicly. Read it before you decide. Your own consent and opt-out records stay your responsibility (GDPR guide).
Try it
Start the 30-day free trial (no card), connect a number, create a test key and run the curl above with your own template. Plans start at $19 a month, and Meta's per-message charges are billed by Meta to your own account (pricing guide). If you are still choosing a route, see SendFromChat vs the WhatsApp Cloud API direct.
Do this from your AI assistant
SendFromChat connects Claude, ChatGPT, Cursor or any MCP client to the WhatsApp Business API — templates, bulk sends, inbox, chatbots and sequences, just by asking. 30 days free, no card.
Start freeMore guides
How to handle WhatsApp STOP and opt-outs in your app
A customer replied STOP on WhatsApp. What must your app do? Honour the opt-out everywhere, block the next send, log it, and let people opt back in, with a tested webhook handler and the exact error to expect.
WhatsApp Cloud API webhook not working? A step-by-step checklist
Meta's WhatsApp webhook won't verify, or verifies but sends nothing? Work through six checks in order (verify token, public HTTPS, subscribed field, overrides, signature, 200 reply) with a tested Node receiver and curl commands.
Retry WhatsApp API sends without double-sending: idempotency keys, timeouts and 429s
How to retry a failed WhatsApp send safely. An Idempotency-Key example in Node, what the API does on a replay, a timeout, a 409 or a 429, and which errors you should never retry. Tested against a local mock.
Send a WhatsApp message with cURL: copy-paste commands
Send a WhatsApp template message from the command line with cURL. Check your key, send with a test key first, retry without double-sending, read the status, and a short shell script that handles the errors.