# [POST] /waTemplates

## Objective:

Use this service to create a new WhatsApp template

## Example CURL:

```

curl --location --request POST ‘go.botmaker.com/api/v1.0/waTemplates/’ \

–header ‘Content-Type: application/json’ \

–header ‘Accept: application/json’ \

–header ‘access-token: ACCESS-TOKEN’ \

–data-raw '{

“buttons”: [],

“optInImage”: “https://storage.googleapis.com/m-infra.appspot.com/public/res/SoporteBotmaker/20210818-hnFCAbAtiaVneNafwub7cBZaFPS2-UUHZ3-.png”,

“locale”: “es_AR”,

“content”: “Hola, gracias por todo”,

“mediaHeaderText”: “”,

“mediaFooterText”: “”,

“name”: “test_create_temp_API”,

“mediaHeaderType”: “image”,

“category”: “Account Update”

}

```

## Important fields:

- buttons

- locale

- category

- optinImage

- content

## Types of buttons:

First type: **QUICK_REPLY**

These buttons are used to execute an intent inside the bot or send a text in case of an API client. You can create up to **3**.

If you are already an **API** customer, you should complete the following fields:

- “text”: Text that the button will contain

- type": Must have the QUICK_REPLY type.

- “responseId”: The message that the bot responds to when the button is pressed.

If you are **not** an **API** customer:

- “text”: Text that the button is to carry

- type": Must have the type QUICK_REPLY

- “intent”: The id of the intent to execute.

**Considerations in case of being an API customer:**

You can use the buttons to send the responseID defined in your webhook configured in Botmaker when there are clicks from users. This way, you will be able to analyze when users click on the options and program automatic responses/sendings in your system depending on the responseID received.

**Note**: The filed responseID does not accept variables; it should only be used with text messages.

**Non-API Example:**

```

“buttons”: [

{

“text”: “seated”,

“type”: “QUICK_REPLY”,

“intent”: “BotmakerTesting-327f05674554c@bm.com-1611242990470”,

“responseId”: “”

},

],

```

**API Example:**

```

“buttons”: [

{

“text”: “seated”,

“type”: “QUICK_REPLY”,

“intent”: “”,

“responseId”: “hello”

},

],

```

Second type, **CALL TO ACTION**:

These buttons give you the possibility to add buttons that allow you to call a phone number, or take you to a URL. These two types of controls cannot be mixed with a QUICK_REPLY button.

In this case, you cannot have more than **2** buttons.

The fields are, in the case of a **call** button, the following:

- “phone_number”: Phone number to call.

- “text”: Text of the button

- “type”: Type of the button, in this case, “PHONE_NUMBER”.

In the case of being one of **URL**:

- “url”: Url of the page to which the user will be sent to.

- “text”: Text of the button

- “type”: Type of button, in this case, “URL”.

For example:

```

“buttons”: [

{

“phone_number”: “+5491155640000”,

“text”: “Call Support”,

“type”: “PHONE_NUMBER”

},

{

“text”: “Go to google”,

“type”: “URL”,

“url”: “www.google.com

}

],

```

Example of a wrong one. In this case, button types cannot be mixed.

```

“buttons”: [

{

“text”: “Greeting”,

“type”: “QUICK_REPLY”,

“intent”: “BotmakerTesting-327f0567455b4c@bm.com-1611242990470”,

“responseId”: “”

},

{

“text”: “Go to google”,

“type”: “URL”,

“url”: “www.google.com

}

],

```

## Local validations:

Local refers to the template language and is validated against the following list:

```

Allowed languages:

af,

sq,

ar,

az,

bn,

bg,

ca,

zh_CN,

zh_HK,

zh_TW,

hr,

cs,

da,

en,

en_GB,

en_US,

et,

fi,

fr,

de,

el,

gu,

he,

hi,

hu,

id,

fil,

ga,

it,

ja,

kn,

kk,

ko,

lo,

lv,

lt,

mk,

ms,

mr,

nb,

fa,

pl,

pt_BR,

pt_PT,

pa,

ro,

ru,

es,

es_AR,

es_MX,

es_ES

}

```

## Category:

Template category, can be one of the following:

```

ACCOUNT_UPDATE,

PAYMENT_UPDATE,

PERSONAL_FINANCE_UPDATE,

SHIPPING_UPDATE,

RESERVATION_UPDATE,

ISSUE_RESOLUTION,

APPOINTMENT_UPDATE,

TRANSPORTATION_UPDATE,

TICKET_UPDATE,

ALERT_UPDATE,

AUTO_REPLY

```

## optinImage:

Very important, pass to the optinImage field the link to an image, which has the optIn.

**What is optIn?**

It is an image, with a template of some form, in which it is demonstrated that some page or app is asking for consent from customers to receive messages proactively via WhatsApp.

## Content:

**Remember**: You have a limit of 1024 characters or 160 characters in case you have a header or footer. And you cannot include new lines, tabs or more than four consecutive spaces.

The text can be in:

**Bold**: to make your message bold, place an asterisk on either side of the text.

**Italics**: to italicize your message, place an underscore on either side of the text.

**Strikethrough**: to cross out your message, place a check mark on each side of the text.

**Monospace**: to leave a monospace text, place three sentences on each side of the text.

**Emojis**

**Variables**: must begin with a $ and contain the variable name between braces, as in the example below. Example: ${name}

## Template Status:

Once the template is created, it goes through different stages until it is finally approved.

### Status:

**botmakerPending:** The template is pending submission to Facebook.

**accountPending:** The template has some errors and needs to be modified by the business. In these cases, the error will be found in the **notes** of the template. The template will need to be corrected and re-generated through this service.

**facebookPending:** The template was sent to Facebook and is awaiting validation.

**Approved:** The template was approved and is ready to be sent.

**Rejected:** The template was rejected and cannot be used.