Skip to content
Get started
Esc
Templates and consent

Building

Updated 4 December 2026

A template is a WhatsApp message with set wording that Meta approves before you can send it. You need one in two cases:

  1. To message a customer who has never written to you.
  2. To message a customer whose last message is more than 24 hours old.

Instagram has no templates.

Listing templates

⁠GET /v1/templates returns the number's approved templates, each with its name, language, category, parameters and body.

Code language
import { Airbox } from "@airboxhq/api";

const client = new Airbox(process.env.AIRBOX_API_KEY);

const { data, error } = await client.templates.list();

if (error) {
  throw new Error(`${error.code}: ${error.message} (${error.requestId})`);
}

console.log(data);

Sending one

Name the template and its language, and give a value for each placeholder in parameters, in their order. A template with named placeholders takes an object by name instead. Values are strings, up to 100 of them, each up to 1,024 characters.

Code language
import { Airbox } from "@airboxhq/api";

const client = new Airbox(process.env.AIRBOX_API_KEY);

const { data, error } = await client.templates.send("order_ready", {
  to: "+77011234567",
  language: "ru",
  parameters: [
    "Asel",
    "1042",
  ],
}, { idempotencyKey: "order-1042-reminder" });

if (error) {
  throw new Error(`${error.code}: ${error.message} (${error.requestId})`);
}

console.log(data);

A missing or empty value gets 422 template_parameters, and a name or language Meta has not approved gets 422 template_not_found.

Consent is a WhatsApp matter, as only WhatsApp lets you write first. Before a template goes to a number that has never written to the workspace, record that the customer agreed to hear from you. Without it the response is 422 no_consent.

Code language
import { Airbox } from "@airboxhq/api";

const client = new Airbox(process.env.AIRBOX_API_KEY);

const { data, error } = await client.contacts.grantConsent("+77011234567");

if (error) {
  throw new Error(`${error.code}: ${error.message} (${error.requestId})`);
}

console.log(data);

When the customer changes their mind, ⁠DELETE /v1/contacts/{phone}/consent withdraws it. A customer who asked not to be written to gets 422 opted_out when you write first.

New customers a day

Meta limits how many new customers a number writes to first in a rolling 24 hours, from 50 to 100,000 by the number's tier. limits.new_customers_per_day in ⁠GET /v1/channels shows the number now, and a send beyond it gets 422 messaging_limit. Answers to customers who wrote in the last 24 hours do not count.