We are sunsetting On-Premises API. Refer to our On-Premises API Sunset document for details, and to learn how to migrate to our next-generation Cloud API.
A message template is required to open marketing, utility, and authentication conversations. These conversations can be customer care messages or appointment reminders, payment or shipping updates, alerts, and more.
See Categories.
When sending a message template, you need to specify the language using the language
field. Your business is responsible for all translations you wish to use.
Language | Code |
---|---|
Afrikaans |
|
Albanian |
|
Arabic |
|
Azerbaijani |
|
Bengali |
|
Bulgarian |
|
Catalan |
|
Chinese (CHN) |
|
Chinese (HKG) |
|
Chinese (TAI) |
|
Croatian |
|
Czech |
|
Danish |
|
Dutch |
|
English |
|
English (UK) |
|
English (US) |
|
Estonian |
|
Filipino |
|
Finnish |
|
French |
|
Georgian |
|
German |
|
Greek |
|
Gujarati |
|
Hausa |
|
Hebrew |
|
Hindi |
|
Hungarian |
|
Indonesian |
|
Irish |
|
Italian |
|
Japanese |
|
Kannada |
|
Kazakh |
|
Kinyarwanda |
|
Korean |
|
Kyrgyz (Kyrgyzstan) |
|
Lao |
|
Latvian |
|
Lithuanian |
|
Macedonian |
|
Malay |
|
Malayalam |
|
Marathi |
|
Norwegian |
|
Persian |
|
Polish |
|
Portuguese (BR) |
|
Portuguese (POR) |
|
Punjabi |
|
Romanian |
|
Russian |
|
Serbian |
|
Slovak |
|
Slovenian |
|
Spanish |
|
Spanish (ARG) |
|
Spanish (SPA) |
|
Spanish (MEX) |
|
Swahili |
|
Swedish |
|
Tamil |
|
Telugu |
|
Thai |
|
Turkish |
|
Ukrainian |
|
Urdu |
|
Uzbek |
|
Vietnamese |
|
Zulu |
|
Message templates are stored in language packs. A language pack is a bundle of message template elements for a particular language or locale. If a business supports at least one translation for a language or locale, a pack for that language or locale is created.
A message template namespace is a bundle of language packs for a particular business.
If a message template is sent with the language: policy
field set to deterministic
, the default value, WhatsApp delivers the message template in exactly the language and locale asked for. Then, the device queries the server for a language pack of that particular language.
When this message is delivered to the device, the device does the following:
"policy": "deterministic"
and "code": "en"
, is there a cached en
pack on the device?
en
pack be found on the server?
structure_unavailable
error via a Webhook, and no messages are rendered on the device."element": "hello_world"
element exist?
en
pack from the server and repeat Element Check.structure_unavailable
error via a Webhook, and no messages are rendered on the device.The device language/locale settings are completely ignored.
A problem that can arise when using the deterministic
policy is if what you're requesting doesn't exist. Make sure:
Message templates provide localization support out-of-the-box by localizing the message according to the device locale settings.
Templates have parameters that are dynamically incorporated into the message. For the example used in this document, the message template looks like this:
"You made a purchase for {{1}} using a credit card ending in {{2}}."
For "namespace": "cdb2df51_9816_c754_c5a4_64cdabdcad3e"
with "element_name": "purchase_with_credit_card"
, the first value you list replaces the {{1}} variable in the template message and the second value you list replaces the {{2}} variable.
The number of parameters passed into the payload must match the number of parameters in the template
object. If not, you get a callback informing you that there was an issue displaying the message template.
Some of these parameters (e.g., date_time
or currency
) are localizable so that they are displayed appropriately based on the customer's language and locale preferences. If the device is unsuccessful in localizing a parameter, it defaults to the fallback_value
.
If you need to specify currency and date in addition to the fallback_value
, use the currency
and date_time
objects. This allows the client to optimally localize the data the best way possible, only defaulting to the fallback_value
when they cannot localize the data.
The localizable_params
options are shown in the table below:
Name | Description |
---|---|
type: String | Required. Default text if localization fails. All of the localization parameters must have a fallback value. When specifying text, just the fallback value is required. |
type: | Optional. If the |
type: | Optional. If the |
currency
ObjectThe Whatsapp Business API client attempts to format the currency based on the specified localization.
Name | Description |
---|---|
type: String | Required. Currency code as defined in ISO 4217. |
type: Integer | Required. Amount multiplied by 1000. |
{ "type": "currency", "currency" : { "fallback_value": "$230.99", "code": "USD", "amount_1000": 230990 } }
date_time
ObjectThe Whatsapp Business API client attempts to format the date/time based on the specified localization. The supported date and time formats include:
Name | Description |
---|---|
type: DateTimeComponent | Required if Date/time by component. |
type: DateTimeUnixEpoch | Required if Date/time by Unix epoch. |
At least one of the following fields is required: component
or unix_epoch
. If used, only one of them can be present.
Name | Description |
---|---|
type: String | Optional. If different from the value derived from the date (if specified), use the derived value. Both strings and numbers are accepted. |
type: Integer | Optional. The year. |
type: Integer | Optional. The month. |
type: Integer | Optional. The day of month. |
type: Integer | Optional. The hour. |
type: Integer | Optional. The minute. |
type: String | Optional. Type of calendar. |
{ "type": "date_time", "date_time" : { "fallback_value": "October 25, 2020", "day_of_week": "Saturday", "day_of_month": 25, "year": 2020, "month": 10, "hour": 12, "minute": 0 } }
DateTimeUnixEpoch
will be deprecated. DateTimeComponent
will be the default going forward. Please make changes to your code to avoid issues.
Name | Description |
---|---|
type: Integer | Required. Epoch timestamp in seconds. This field is planned to be deprecated. |
This document contains reference information about message templates. For a guide on how to create and send a template, see Sending Message Templates. For all parameters that can be used in a message template, see Messages, Message Template.
https://developers.facebook.com/docs/whatsapp/message-templates/creation#step-1--create-template-using-the-whatsapp-manager