Templates

What are templates and how to use them.

What are Templates?

Templates are pre-designed message formats that businesses use for automated communication with customers.


A template consists of...

1. Meta Data

1

name

The name of your template.

  • Requests must have a unique name / language pair

  • name can only contain lowercase, underscore characters, and numbers

2

description

Give your template a descripton (like what it's for).

3

language

The language the template is in, if the language of the template does not match the language chosen, META will reject the template.

Supported Languages: META Documentation

4

category

Each template can be one of three categories, each having their own rules

  • MARKETING

  • UTILITY

  • AUTHENTICATION

5

status

When a template is created, it will be given a PENDING status and then META will either APPROVE or REJECT the template.

  • PENDING

  • APPROVED

  • REJECTED

Reasons for Rejection: META Documentation

2. Components

A templates structure is determined by its components . The request can have up to four objects, either HEADER, BODY, FOOTER or BUTTONS.

AUTHENTICATION Templates have their own rules. See link below.

Create Templates

Headers don't need an example property, you simply add the parameter and off you go:

{
   "type":"HEADER",
   "format":"TEXT",
   "text":"Hello {{1}}",
   "example":{
      "header_text":[
         "Pete"
      ]
   }
}

3. Tags

Tags are used in conjunction with the component parameters. They are essentially a means to add dynamic data into the HEADER, BODY and BUTTONS.

Tag Structure

head: [
    {
        index: number;
        type: string;
        value?: string;
        url?: string;
        prompt?: string;
        fields?: string[]; //used for csv fields or subscriber fields depending on type
    }
];
body: [
    {
        index: number;
        type: string;
        value?: string;
        url?: string;
        prompt?: string;
        fields?: string[]; //used for csv fields or subscriber fields depending on type
    }
];

Tag Fields

Field
Description
Notes

index

Indexed used to populate replacement tags in template

Head and body

type

Type of Tag (see below)

The head tags cannot be populated with a csv

value

Used to store the value for 'hard-coded/on-campaign-creation' fields

url

Used to specify the url for tag types ( csv | image, video)

The following endpoint should be used to upload any files required by templates: {{url}}/v1.1/templates/upload This endpoint returns a list of the uploaded files along with their public url which must be specified

prompt

Used to populate the prompt when assigning a value to this tag on campaign creation

Used for csv/subscriber fields

fields

Array of fields to be used for tag replacement

Tag Types

Option
Description
Notes

csv

CSV Merge file uploaded to s3 and url saved against record

populate fields with the desired field + populate url with the key returned by {url}/v1.1/templates/upload

hard-coded

Hard Coded value (setup at on template creation)

populate value field with string value

on-campaign-creation

On Campaign Creation

populate the value with the text you would like to use when passing the tags object on campaign creation

image

Image uploaded to s3 and url saved against record

populate url field with the location returned by {url}/v1.1/templates/upload

video

Image uploaded to s3 and url saved against record

populate url field with the location returned by {url}/v1.1/templates/upload

subscriber-field

Subscriber field to use for tag replacement

populate fields with the subscriber field you want to replace - currently available fields are as follows: mobileNumber, firstName, lastName

Upload endpoint.

This endpoint facilitates the uploading of files for later use in templates.

Want to ingest a Template?

This endpoint updates your list of templates with META's list of your templates.


Want to get your Template approved?

The link below specifies all that needs to be known about getting your templates approved.

Get your template approved

Get started in

WhatsApp has rules! We cannot just make any message we want and send them off to millions of people. It must meet the criteria. Only then can we send millions of messages.

Last updated

Was this helpful?