Templates

What are templates, and how to use them

What are Templates?

Templates are exactly what they sound like, they are pre-designed message formats that businesses use for automated communication with customers.


First Steps

  • Requests must have a unique name / language pair

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

When entering the initial fields, there are some things to keep in mind.

Components

A template will consist of its basic information such as name, category , etc. Its structure is determined by components . The request can have up to four objects each having a different type, either HEADER, BODY, FOOTER or BUTTONS.

You can add images, videos, and text to the HEADER

  • Optional

  • Maximum of 1 tag

  • Must have a format of either TEXT, DOCUMENT, IMAGE, VIDEO

  • Limited to 60 Characters

  • The image format will require an example image url from https://www.channel360.co.za/api/templates/upload. The url must then again be used in campaign creation as a tag.

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"
      ]
   }
}

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.

Tags can be created for the HEAD or BODY content types

  • index should start at 1 and increment up

  • index of tag should match the order that you want to populate replacement tags for the HEAD / BODY / 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
    }
];
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

FieldDescriptionNotes

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

OptionDescriptionNotes

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

Want to upload an image?

This endpoint facilitates the uploading of an image.

Upload Image

Want to upload a Template?

This endpoint facilitates the uploading of a Template.

Upload Template

Want to ingest a Template?

This endpoint allows you to ingest and process a template.

Ingest Template


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

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