Skip to content
New Describe an automation in plain words, and AI builds it for you.
Developers

Send template messages

Message anyone at any time with a template Meta has approved, and fill in names, order numbers and links.

6 min read Developers

A template is a message you write once and Meta approves. You need one whenever you message someone first, or more than 24 hours after their last message: order updates, reminders, login codes, offers.

0–24 h · Window openReply with anything: text, photos, buttons
After 24 h · Window closedApproved templates only

Step 1 · Create and get the template approved

Do this once, in the dashboard. Approval usually takes minutes to a few hours. See Template basics.

Step 2 · Find the template's id

GET /api/v1/templates

Lists your templates with their ids and wording.

cURL
curl https://flowleb.com/api/v1/templates \
  -H "Authorization: Bearer YOUR_API_KEY"
Response 200 OK
{
  "data": [
    {
      "id": 31,
      "name": "order_shipped",
      "category": "UTILITY",
      "language": "en",
      "header": "Order update",
      "body": "Hi {{1}}, your order {{2}} has shipped 🚚 It will reach you by Friday.",
      "footer": "Reply STOP to opt out",
      …
    }
  ],
  "meta": { "count": 1 }
}

Note the id (here 31) and count the {{1}}, {{2}}… placeholders. You fill them in, in that order.

Step 3 · Match your values to the template

1
2

Hi {{1}}, your order {{2}} has shipped 🚚 It will reach you by Friday.

3Reply STOP to opt out
4Track orderTalk to us
  1. Header Optional. Text, image, video or document.
  2. Body The message. {{1}} marks a variable.
  3. Footer Optional small print.
  4. Buttons Optional. Quick replies, a link or a phone call.
Template partSend it asExample
Body variables {{1}}, {{2}}… body: a list, in order ["Maya", "#2045"]
Text header with {{1}} header_text "Order #2045"
Image, video or document header header_media_url (a public link) or upload header_media "https://…/invoice.pdf"
Document file name header_filename "Invoice-2045.pdf"
Link button with a variable buttons: index (0 = first button), sub_type, value [{"index":0,"sub_type":"url","value":"2045"}]

Step 4 · Send it

POST /api/v1/templates/{id}/send

Sends one template to one number.

curl -X POST https://flowleb.com/api/v1/templates/31/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "919876543210",
    "body": ["Maya", "#2045"],
    "buttons": [ { "index": 0, "sub_type": "url", "value": "2045" } ]
  }'
Response 201 Created
{
  "data": {
    "wamid": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgS…",
    "status": "sent",
    "template_id": 31,
    "template_name": "order_shipped",
    "to": "919876543210"
  }
}
What Maya sees

Send a document as the header

For invoices, tickets or reports, upload the file in the same request. No separate upload step is needed.

cURL · multipart upload
curl -X POST https://flowleb.com/api/v1/templates/44/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F to=919876543210 \
  -F "body[]=Maya" \
  -F "body[]=#2045" \
  -F header_media=@invoice-2045.pdf \
  -F header_filename="Invoice-2045.pdf"

Still stuck? Ask the team, a person replies by email.