Create a template

With this API you'll be able to submit a WhatsApp template creation request to Meta. Note that a template can not be used until Meta approves it. Typically, the templates are approved within 5 minutes from the request submission but may take up to 24 hours. This might change in the future though and we'll update accordingly. You'll have to fetch the templates from time to time to get their latest status.

POST /v1/businesses/{businessId}/create/template

Path Parameters

Name
Type
Description

businessId

String

{
    "entity": {
        "id": "template_test",
        "templates": [
            {
                "channel": null,
                "id": "1385622408844485",
                "language": {
                    "code": "en_US"
                },
                "status": "MESSAGE_TEMPLATE_STATUS_PENDING",
                "createdAt": "2023-01-18T01:07:20.075195879Z",
                "updatedAt": "2023-01-18T01:07:20.075195879Z",
                "externalTemplate": null,
                "components": [],
                "templateComponents": [
                    {
                        "header": {
                            "media": {
                                "type": "TYPE_IMAGE",
                                "example": [
                                    "https://uploads-ssl.webflow.com/60c6f467ba3a281e33bc3449/62bcc6414212753dc33b5c2d_312313.png"
                                ]
                            }
                        }
                    },
                    {
                        "body": {
                            "text": {
                                "text": "Hi {{1}}, Welcome to Connectly. Do you want to learn more?",
                                "example": [
                                    "Lorem"
                                ]
                            }
                        }
                    },
                    {
                        "footer": {
                            "text": {
                                "text": "Reply 'Stop' to opt out",
                                "example": []
                            }
                        }
                    },
                    {
                        "button": {
                            "quickReply": {
                                "text": "Learn more"
                            }
                        }
                    },
                    {
                        "button": {
                            "quickReply": {
                                "text": "Not interested"
                            }
                        }
                    }
                ],
                "rejectionReason": null
            }
        ],
        "name": "template_test3",
        "category": "MARKETING",
        "createdAt": null,
        "updatedAt": null
    }
}

The payload is the message template object which consists of:

  1. name - the name of the template

  2. category - category of the template. Can be any of:

  3. language - a language object. It only has one property called code and you can see all the supported language codes here

  4. template_components - a list of the components that represent the template structure

Template Components

Template headers have 4 types:

  1. TYPE_IMAGE - image header. You need to specify the image URL link in example to increase the template approval speed

  2. TYPE_VIDEO - video header. You need to specify the video URL link in example to increase the template approval speed

  3. TYPE_DOCUMENT - document header. You need to specify the document URL link in example to increase the template approval speed

  4. TYPE_TEXT - text header. If you want to specify the dynamic text content in the header you can do so like this {{1}}. ONLY ONE VARIABLE IS ALLOWED IN THE HEADER.

Body

In the body component, you specify the template's main text content.

The template body supports the variables. These are dynamic fields that can be replaced with different text values when you send out the templates. See here for information on how to send the templated messages.

If you want to specify the variable in the template body, use the following syntax:

Whenever you specify the number wrapped around the curly braces (e.g {{1}}), you indicate it is a variable.

The message template footer.

Button

The buttons are interactive components that you use to interact with your recipients.

You can use up to 3 buttons per template.

There are two types of buttons supported on the templates:

  1. quickReply - when a Quick Reply button is tapped, a message containing the button text is sent in the conversation. Quick Reply buttons can trigger auto responses.

  2. url - take your customers to your website. WhatsApp automatically disapproves shortened links (eg. bit.ly). Please use the full URL and add UTM parameters if required for tracking.

  3. phoneNumber - allow your customers to call you directly.

Note that you can't have Quick Reply and Call-To-Action buttons simultaneously(up to 3 quick reply buttons OR call to action with either URL and/or phone)

Examples

Simple Template with a body and no variables

Simple Template with a body with one variable

Simple Template with a body with 4 variables

Template with an image header and body varaibles

Template with text header and body variables

Template with a quick reply button

Template with a CTA button that leads to the website

we can add variable in url, e.g www.example.com/{{1}}

Template with a CTA button that starts a phone call

To create this carousel template:

You can use this structure:

To send that template as a WhatsApp message, see Sending a Carousel template message

Template

Below is a sample request:

If successfully accepted, the above request will return 200 with the following response:

Last updated