Create templates

Save SMS templates, and write WhatsApp templates for Meta to review.

Save a template once, then send it by name. An SMS template is ready at once. A WhatsApp template you write is submitted to Meta, and ready once Meta approves it, usually within minutes.

Requirements

  • An API key with the messages.send permission.
  • For WhatsApp, your number connected in Integrations → WhatsApp.

Requests

POST /v1/templates

Request syntax

An SMS template:

{
  "name": "<NAME>",
  "channel": "sms",
  "category": "<CATEGORY>",
  "content": { "text": "<TEXT>" }
}

A WhatsApp template:

{
  "name": "<NAME>",
  "channel": "whatsapp",
  "whatsapp": {
    "submit": {
      "category": "<WHATSAPP_CATEGORY>",
      "language": "<LANGUAGE>",
      "header": "<HEADER>",
      "body": "<BODY>",
      "footer": "<FOOTER>",
      "quickReplies": ["<LABEL>"]
    }
  }
}
PlaceholderDescriptionSample value
<NAME>String. Unique, ignoring case. Up to 100 characters. Your system sends it by this.order_ready
<CATEGORY>String. marketing, utility or authentication.utility
<TEXT>String. What it says, with placeholders. Up to 6 SMS.Hi {{name|there}}, order {{data.order}} is ready.
<WHATSAPP_CATEGORY>String. marketing or utility. Meta makes authentication templates. See Authentication templates.utility
<LANGUAGE>String. en or sw.en
<HEADER>String. Optional. One line, up to 60 characters, with one placeholder at most.Order {{data.order}}
<BODY>String. Up to 1,024 characters, with placeholders.Hi {{name|there}}, your order is ready.
<FOOTER>String. Optional. Up to 60 characters, no placeholders.Duka Amina
<LABEL>String. Optional. A quick-reply button. Up to 3, each up to 25 characters.Thanks

Example request

curl https://api.goomzo.africa/v1/templates \
  -H "Authorization: Bearer $GOOMZO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "order_ready",
    "channel": "whatsapp",
    "whatsapp": { "submit": { "category": "utility", "language": "en",
      "body": "Hi {{name|there}}, your order {{data.order}} is ready to collect.", "quickReplies": ["Thanks"] } }
  }'

Responses

The answer is 201 with the template. A WhatsApp one has a problem until Meta approves it, and its approval arrives with the next sync.

Note: Goomzo numbers your placeholders as Meta's {{1}}, {{2}}, and fills them in when it sends.

Notes

  • Meta's rules: a WhatsApp body can't start or end with a placeholder, or have two side by side. Goomzo checks this before it submits.
  • The right category: a template that promotes is marketing, even with an update in it. Meta moves one it judges wrong, and can restrict your account's utility templates if it happens often.
  • A template on your account: to save one made in WhatsApp Manager, name it instead of submit: "whatsapp": { "name": "order_ready", "language": "en", "values": { "body.1": "{{name|there}}" } }.
  • Changes: PATCH /v1/templates/{id} changes what you send. What's left out stays as it was.

Next steps

Last updated