Flows
Last updated
Last updated
If you are using On-Premise API, remember that it is being discontinued by Meta. No new signups will be allowed with this type of integration from May 15, 2024.
Numbers registered before this date will still be supported, but should start planning a change of hosting type as soon as possible.
WhatsApp Flows is a way to build structured interactions for business messaging. With Flows, businesses can define, configure, and customize messages with rich interactions that give customers more structure in the way they communicate.
You can use Flows to book appointments, browse products, collect customer feedback, get new sales leads, or anything else where structured communication is more natural or comfortable for your customers.
With Flows, you can:
Present simple input forms (in order to schedule an appointment, for example)
Create workflows that guide users through multiple screens (for ordering products, for example)
Create endpoints that exchange data across screens to enable more complex interactions (such as guiding a user through a process with multiple potential outcomes)
Flows is a feature of the WhatsApp Business Platform that allows you to swiftly develop and deploy native, task-centric workflows on WhatsApp. This results in enhanced interactions between customers and businesses.
With WhatsApp Flows businesses can design, build and customize their own journeys, which can make chatbot and AI agent solutions better, as well as offer end-to-end experiences.
For users, Flows can improve interactions with businesses on WhatsApp, leading to better task completion and fewer drop offs than alternative channels.
For businesses, Flows can improve engagement and completion rates, resulting in improved business outcomes.
Flows is built for form-based use cases. You can create Flows to achieve a range of tasks with your customers, including:
Lead generation
Appointment booking
Registration, Sign up, and Sign in
Customer support and feedback
And many more
Meta will continue to expand Flows capabilities to unlock additional use cases in the future. We will keep you updated.
Sign Up
Appointment Booking
Flows are linked from a CTA in a message. Flows are composed of:
Screens: When tapping on the Flows CTA in a message, the user will access the initial screen of the Flow. The user can then interact with the Flow to move through multiple screens until completion.
Layouts: These define how components are presented within a Flow, providing a structured look and feel.
Components: You can use components to display information, and to create input fields for your users. You can display information with Text, Images, and Embedded links. You can create input fields for your users to complete using Text Inputs, Dropdowns, Checkboxes, Radio Buttons, Opt-in, and Date Pickers.
Flows can be attached and sent as Business Initiated Messages, as well as standard messages. See Best Practices.
WhatsApp Flows are supported for numbers hosted either through Cloud API or as On-Premise API hosted by 360dialog.
The minimum version for development and go-live with WhatsApp Flows using the On-Premise API is v2.51.1.
As announced in November 2023, Meta is transitioning to a fully Cloud-hosted WhatsApp Business Platform and will stop supporting On-Premise API in October 2025.
Starting from On-Premise client v2.53, all new feature updates will be exclusively delivered to Cloud API. While the On-Premise API client will receive quarterly releases, they will focus solely on bug fixes and security patches. From May 15, 2024, 360dialog will not allow for new numbers to be onboarded with On-Premise API. We will continue supporting already registered On-Premise API throughout 2024, but we strongly recommend to start changing the hosting type of numbers to Cloud as soon as possible. Learn here how to integrate with Cloud API.
You can set up Flows directly from the WhatsApp Business Manager UI. To access it, make sure you have admin rights to manage the account. The Flows editor can be found under the "Account tools" section under the main menu in Meta's WhatsApp Manager.
Find in Form Builder section below payload examples with code snippets and explanations of how different Flows come together to create immersive experiences for users.
Flows can also be crafted through our Partner API. If you are integrating with a Solution Provider, or wish to build the flow on top of the API, we have various endpoints to perform different operations to Flows. Alternatively, you can access a Flow builder user interface through the "Account tools" section in Meta's WhatsApp Manager.
Meta has introduced a new flow JSON template “Book an Appointment” which you can use as reference when creating a flow in Builder. The flow template can be found here.
In order to later de- and encrypt data passed through WhatsApp Flows, every WhatsApp Business Account (WABA) requires a key pair, which needs to be signed for every phone number sending Flows within the WABA.
Generate a public and private RSA key pair by typing in the following command in the terminal/console within your operating system (Note: OpenSSL needs to be installed):
The generates 2048-bit RSA key pair encrypted with a password you provided. Next, you need to export the RSA public key to a file, which can be accessed within your file system:
For every phone number sending Flows the public key needs to be signed. This will be done through the our WhatsApp Business API endpoints. The process differs for Cloud API and On-Premise.
In Postman, when inputting the business public key as a parameter in the Body, select JSON format.
POST
https://waba-v2.360dialog.io/whatsapp_business_encryption
Name | Type | Description |
---|---|---|
business_public_key* | String | 2048-bit RSA business public key generated. |
POST
https://waba.360dialog.io/v1/settings/business/whatsapp_business_encryption
Name | Type | Description |
---|---|---|
public_key* | String | The generated Business Public Key. |
You can verify the public key by retrieving it through the following endpoints.
GET
https://waba-v2.360dialog.io/whatsapp_business_encryption
GET
https://waba.360dialog.io/v1/settings/business/whatsapp_business_encryption
When the Flow needs to exchange data with your backend systems, it will make an HTTP request to an endpoint, that you provide. This endpoint needs to be set up so that it can receive and process POST
requests.
With this endpoint you will receive data passed into the Flow by the end user, which you can process e.g. storing it in your database.
Once set up, you will share the data channel endpoint URL with the Flow through the Flow's Flow JSON.
Meta has introduced an endpoint example in NodeJS that works with the “Book an Appointment” flow JSON end to end, with app secret validation, endpoint error codes, and script to create public/private key. The endpoint code is available on Github and Glitch.
Since you're the owner of the endpoint you will not be able to validate the payload and verify the origin of the incoming webhook event. We will launch a solution during Q1/24 to improve the endpoint security by providing a secure proxy service. Announcements will be made here and through email communication.
The body of each request passed to your endpoint will be encrypted and will have the following format:
Parameter | Description |
---|---|
| The encrypted request payload. |
| The encrypted 128-bit AES key. |
| The 128-bit initialization vector. |
You can then proceed to decrypt this data using the encrypted_aes_key
. You can find a detailed example with sample code on this page of Meta's developer documentation.
After encryption the data will have the following format:
After processing decrypted request you can process the data end craft a response object, that will be encrypted and returned back to the Flow. A sample response payload before encryption would follow the format:
The response payload needs to be encrypted using the AES key received in the request and can afterwards be send back as Base64 string. An example on how to encrypt the data can be found in Meta's developer documentation via this link.
Your endpoint will receive requests in the following cases:
User opens the Flow
User submits the screen
User presses the back button on the screen
Error notification request (in case your endpoint returned with invalid content on the previous request)
For a detailed explanation of all cases and how to process the individual requests, please refer to Meta's developer documentation for implementing endpoint logic.
Once the Flow closes you will receive a message payload through your messages webhook URL, which will look like the followig example:
Parameter | Description |
---|---|
object | Context of the message that the user replied to. Context object contains message_id of flows request message and sender number. |
string | User's WhatsApp account number |
string | Message ID |
string | Always |
string | Always |
string |
|
string | String that can be parsed to JSON that contains the params business sent like |
string | Time of flow response message |
The Flows Builder allows Flows to be sent directly via WhatsApp Manager. The functionality works only with phone numbers registered to Cloud API.
You can send a Message with a Flow in a user-initiated conversation using a Message with a Call To Action (CTA). You send this message either through the On-Prem client or Cloud API with information specific to the Flow. The Flow is triggered when the user taps the CTA button.
To send a message with a Flow, you can use the new type of the Interactive Object named flow
with the following properties:
Parameter | Description | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| The interactive message configuration | ||||||||||||||||||||||||||
↳ | Value must be | ||||||||||||||||||||||||||
↳ |
| ||||||||||||||||||||||||||
Parameter | Description | ||||||||||||||||||||||||||
| Value must be | ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
↳ | The Flow can be in either | ||||||||||||||||||||||||||
↳ | Value must be | ||||||||||||||||||||||||||
↳ | Flow token that is generated by the business to serve as an identifier. | ||||||||||||||||||||||||||
↳ | Unique ID of the Flow provided by WhatsApp. | ||||||||||||||||||||||||||
↳ | Text on the CTA button. For example: "Signup" Character limit - 20 characters (no emoji). | ||||||||||||||||||||||||||
↳ |
| ||||||||||||||||||||||||||
↳ | Required if
|
Send a POST call to the /messages endpoint.
Sample Request for Cloud API
Sample Response
You can send a template message with a WhatsApp Flow. Only published Flows can be sent this way. Use the new button type called FLOW
. Use this type to specify the Flow to be sent with the template message.
First you need to create a template. Here is an example request:
Parameter | Description |
---|---|
| |
↳ | The unique ID of a Flow. |
↳ | Required if |
↳ | Either |
Sample Response
Ensure that your template passes all required reviews so that status
is APPROVED
instead of PENDING
. See Template Statuses.
Now you can send a template message with a Flow using the following request:
Sample Request for Cloud API
Sample Response
Upon flow completion a response message will be sent to the WhatsApp chat. You will receive it in the same way as you receive all other messages from the user - via message webhook. response_json
field will contain flow-specific data.
Here are some guidelines to optimize both the WhatsApp Flows user and developer experience.
The Feedback Form Flow can be used to collect customer feedback for an experience that includes purchase and delivery of a product. It can also easily be modified to collect other kinds of customer feedback as well.
This example tutorial breaks out the wrapper scaffolding code from the screen code. However, you should combine all the code in these examples using the Form Builder.
Wrapper Code
Include the following code to "wrap" the 2 screens of the Feedback Form (the General Satisfaction Questions screen, and the Rating Questions screen):
General Satisfaction Questions Screen:
The Form component organizes all the input fields on the page and sets the footer CTA to be disabled until all required fields have been completed.
RadioButtonsGroup and TextArea components are used to get input from the user.
You can decide for each input field whether it is required or not using the boolean “required” field.
Additional items to note here are the navigate
action which is designed to navigate to the chosen screen. This example also passes a payload to the next screen - the form collects the would_recommend
and how_to_do_better
payload so it can be received as part of the user’s response.
Once you have the first screen in the Builder and modified as needed, the following can be pasted below it:
The input data for the screen matches the payload of the navigate
action from the previous screen, and the complete
action terminates the flow (the screen is defined as terminal
).
For each dropdown, the id
of the option that the user selects is sent as part of the complete
action payload. In addition, the inputs from the first screen, propagated through the second screen’s data, is also sent as part of the complete
action payload. This way, the business will receive the entire feedback response from the user on the webhook.
Now that Flow development is complete, you should test it prior to publishing.
To test the Flow before publishing you can:
Use the interactive preview in the Meta Builder UI
Or
Send the Flow as a draft message using the Partner API
Once everything has been tested successfully, you can publish the Flow (via the Builder UI or the API) and start sending Feedback Form Flows to users.
The CTA should always tell the user what will happen next or what task is being completed on each screen, for example Confirm booking.
Use sentence case on screen titles, headings, and CTAs. Use consistent capitalization throughout each flow.
Always consider the context of the content when using emojis, such as:
Are they appropriate to use?
Will they add to the content?
Do they reflect the business brand?
Errors should be clearly communicated to the user, including what has happened and how to resolve it.
Make sure validation rules are clearly communicated, such as if a user tries to enter a password that is not long enough.
If the flow is exchanging data with your endpoint and a screen becomes invalid (eg. appointment booking), take the user back to the previous screen rather than ending the flow.
If you need to create a sub-flow for certain use cases (eg. a forgot password flow), try to keep it to a maximum of 3 screens and always take the user back to the main flow and task at hand.
Flows shouldn’t be long: Users should enter flows aiming to complete a task as quickly as possible, with tasks taking no longer than 5 minutes to complete.
Don’t have more than one task per screen: Screens with too many tasks may look messy and overwhelm the user. If the flow needs the user to complete multiple tasks, try splitting them up over several screens.
Don’t use too many components per screen: Too many components will make your screens look messy and may overwhelm users. It will also take longer to load.'
Build for caching: Once a user has completed a screen and moves onto the next, their information will be cached. If there are too many components on a single screen and the user exits the flow, they will lose all of this information, which could be frustrating for users.
Always use the right components for specific actions, for example, use the date picker to capture Date of Booking.
If an input requires a lot of text, use the text area component and not the text input.
Questions and form labels must provide full clarity on what it is asking the user.
Forms or questions should be logically ordered, for example, first name, last name, etc.
Forms that are not critical to completing a task should be made optional to the user.
Ensure that any information is correctly formatted for context, for example, currency symbols, phone numbers, and dates.
Always check the content in your flows before publishing.
Ensure you use consistent spelling and capitalization for certain terms.
Check your grammar such as ensuring sentences use full-stops.
Helper text should provide clarity for users, eg. the correct format for a phone number, date input, or email address.
The chat should provide clarity
Users will choose to open a flow based on the clarity of the initiation messages. The exchange should feel conversational, providing context and clear task-focused actions for the user.
Users want to complete a task
The CTA should go hand-in-hand with the message content. It should be short and concise, telling the user what task they can expect to complete by opening the flow.
There should be no surprises
The first screen of the flow should mirror the action of the CTA. Any deviations from the task at hand will result in a bad experience for the user, resulting in them closing the flow.
Some flows may need login screens to complete tasks. However, there are factors to consider when including them in your flows.
Use only when necessary
Including a login screen may be off putting for some users, so try to only use them when absolutely necessary. If you do need one, set the expectations for users so it doesn’t come as a surprise.
Sense of place within flow
Research has shown that login screens may confuse users within flows. Some people thought screens would take them to an external page, outside of WhatsApp. This may result in users losing their sense of place within the flow.
Users need to see the benefit of logging in
The placement of login screens is key. If they are too early in the flow, users will not be motivated to continue. Showing the benefits upfront will make users want to complete the flow. Aim to make the login screen one of the last steps before completion.
Always set expectations for how long it will take to complete a task, eg. "It should only take a few minutes to complete."
Help the user know where they are in the flow by using short, concise action-oriented screen titles, such as "Book appointment."
Use screen titles to show progress where possible, eg. "Question 1 of 3."
End the flow with a summary screen, especially if there have been multiple steps, so users can review and complete the task with clarity.
It should be clear what the user is consenting to.
You should try to include a "Read more" CTA which links to the relevant information, eg. Terms and Conditions.
Keep it simple, try not to use more than 10 options per screen.
Only use dropdown options when there are 8 or more options.
Use a radio button if there is only one selection to make.
Use checkboxes if the user can select multiple options.
Always make the option at the top of the list the default selection.
Set expectations
The last screen should clearly tell the user what will happen when they end the flow. They will also want confirmation of their actions. Sending a summary message should make the user feel reassured.
Bookend your flows
The termination messages should provide the user with clarity and a sense of completion. They should know what they have done, what the next steps are, and who they can get in touch with if they have any questions or if they want to edit or cancel a task.
The business logo (profile photo) should be simple and identifiable in the footer so the user knows and trusts the flow.
Add a CTA within your flow that enables your users to get in touch when needed. This can also be done in follow-up messages once the user has completed the flow.
Make sure your content follows a simple, clear hierarchy using a heading, body and captions
Do not repeat content unnecessarily, for example:
“Complete registration"
"Complete registration below"
Parameter | Description |
---|---|
screen
string
The ID of the first Screen.
data
object
Optional input data for the first Screen of the Flow. If provided, this must be a non-empty object.