Sending WhatsApp Templates

When automating conversations with your users on WhatsApp, it is very important to understand how to use Template Messages. This is because Template Messages offer the *only* way use interactive elements in your flows, such as Quick Reply buttons or Call to Action buttons, but also because Template Messages allow you to re-engage your users in conversations more than 24 hours after your last conversation with them (for a fee).

As with Facebook Messenger, WhatsApp has a 24 hour messaging window. This means that 24 hours after a user has last communicated with your bot, attempts to send them additional messages will fail. If you want to send users messages outside of this window, you must use a pre-approved, non-promotional message template that you configure in your WhatsApp Business API account. These messages must be non-promotional in nature, and can contain placeholders for you to fill in dynamic data such as your users name to personalize the message when you send it.

Template Messages can have several different components, each of which can be personalized in one way or another:

The header can be text, an image a video or a document (pdf). A text header can have one replaceable parameter, and if your header is a media header you will supply the url or ID of the media wen you send the message.

The body is text and can have many replaceable parameters.

The footer is also text only, and can have replaceable parameters.

Each message may also have interactive elements, either up to three Quick Replies or up to two Call to Action buttons.

Each Quick Reply may be supplied with a "payload" when the message is sent - this is a non-visual piece of text that will be sent to Flow XO instead of the label when the button is clicked. In the UI clicking a Quick Reply looks like this:

If you are building a flow that uses quick replies and you want the flow to pause until the user selects an option, make sure you add a Wait for a Response task after the Send Template Message task in your flow to capture the response from the user. Quick Replies on WhatsApp work differently than on any other platform in that each quick reply in a message is can be selected, but only once.

The other type of button you can send is a Call to Action. A Call to Action button will either navigate your user to a (predefined) url of your choice, or will initiate a call on a mobile device. The URL of a call to action button must be declared as part of the template, but you can have an optional "suffix" that you can supply at runtime to personalize the URL. For example, in your template you may specify that the URL is dynamic and will be https://www.flowxo.com/app/usage/user/ and when you send the message you supply a suffix, such as u123123. The final URL your user will be navigated too will be https://www.flowxo.com/app/usage/user/u123123

Approval 

Getting approval for your template messages can be a bit of trial and error, and take anywhere from less than an hour to a couple of days. You can read about the official guidelines here: https://developers.facebook.com/docs/whatsapp/message-templates/guidelines/. Be prepared to do some guessing about what WhatsApp doesn't like about your template messages and trying different variations, because if rejected you will get no information about why.

Sending Template Message with Flow XO

To send template messages in Flow XO you will use the WhatsApp Actions integration, documented here: https://support.flowxo.com/article/270-whatsapp-actions

Language Code: Here you will specify the language that the template should be send it. WhatsApp template messages can be translated into any number of languages. The full list is here: https://developers.facebook.com/docs/whatsapp/message-templates/creation

Template Name: When you define a Message Template in the WhatsApp manager you will give it a name. This field must match that name exactly.

Header Parameters: If you have replaceable parameters in your header text, you can specify the parameters here. The names you give your parameters do not matter - they are matched in order - so make sure you specify your parameter values in the exact same order that you did in your template. Each parameter has two pieces of data you can specify, the parameter value (what to replace your placeholder with in the template) and the parameter type. The parameter value will depend on the type. For instance in the header template you can include media elements. So if your header contains an Image, you would need to supply a parameter like this:

Please note that for media template replacements you can use either a URL or a WhatsApp file id. If an image is uploaded to WhatsApp, Flow XO will extract the Attachment ID and put it in the metadata which you can find in your interaction log and reuse in templates (or in Send Media Message).

The available parameter types are: text, image, video, document, date_time, currency

date_time and currency will be "localized" based on the language code. 

Media Parameters

Media parameters (video, image, document) can be specified as a URL or Attachment ID but can also be given a specific filename. To specify a filename, specify your template value as {url or id}|{filename} where the url and the filename are separated by a "pipe" character |. Here's an example:

Currency Parameters

Currency parameters can have three parts, each separated by a |. The parts are: fallback text | currency code | value

For example: 

The value should be specified as an integer with 3 digits in the decimal portion of the number. So $100.01 would be specified as 100010

Button Parameters

Button parameters do not have types. The type will depend on the type of button. There are Quick Reply buttons and Call to Action buttons. 

Quick Reply Parameter

The parameter for quick reply buttons is the "payload" - this is the message that will be sent to Flow XO instead of the button label if the button is clicked.

Call to Action Parameter

If your button type is Call to Action, the value of the parameter will be the URL "Suffix" appended to the URL you defined when creating the template. So when you created the template you used a URL of https://www.flowxo.com/app/usage/users/ and you put 1234 in the button parameter, the final url would be https://wwww.flowxo.com/app/usage/users/1234

Thats It!

Go conquer the world with your WhatsApp template messages, and let us know at support@flowxo.com if you have any questions/comments.

Still need help? Contact Us Contact Us