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.


With Flows, you can:


  1. Present simple input forms (in order to schedule an appointment, for example)

  2. Create workflows that guide users through multiple screens (for ordering products, for example)

  3. Create endpoints that exchange data across screens to enable more complex interactions (such as guiding a user through a process with multiple potential outcomes)


An example of Appointment booking Flow is shown below:


 


In this documentation, you'll find easy-to-follow guides for Flows integration, API references, explanations of common terminology, and much more.


Leveraging Flows


Flows is built for form-based use cases. You can create Flows to achieve a range of tasks with your customers, including:


  1. Lead generation

  2. Appointment booking

  3. Registration, Sign up, and Sign in

  4. Customer support and feedback

  5. And many more


How are Flows configured and used?

Flows are linked from a Call To Action (CTA) in a message. Flows are composed of:


  1. 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.

  2. Layouts: These define how components are presented within a Flow, providing a structured look and feel.

  3. 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 (Template Messages), as well as standard messages (Session Messages).


Lifecycle of a Flow on Meta Dashboard

Flows on the WhatsApp Business Platform undergo various states, each signifying different functionalities and restrictions. Here's a breakdown: 


Business-Set Flow states: These states are the default states through which the Flow passes.

  1. Draft State: A Flow is actively being modified.

    1. Capabilities: Can be sent for testing; can be deleted if no longer needed.

    2. Next States: Deleted (if in Draft state), Published.


  1. Published State: Ready for deployment to real users.

    1. Capabilities: Cannot be modified or deleted to maintain consistency.

    2. Actions: Create a new Flow based on the existing one (using clone_flow_id) or deprecate it using the /deprecated API call.

    3. Next States: Deprecated, Throttled.


  1. Deprecated State: No longer sent to real users; still visible on users' devices.

    1. Actions: None (terminal state).



System-Set Flow States:

These states are internal states set by the system. Businesses don’t have any control on these states.


  1. Throttled State: Flow limited to 10 messages/hour due to endpoint issues.

    1. Actions: Open a support case via the Support Portal for assistance.

    2. Next States: Published, Deprecated, Blocked (upon further deterioration).


  1. Blocked State: Flow cannot be sent or opened due to severe endpoint issues.

    1. Actions: None (terminal state).


Understanding these states is crucial for developers, ensuring smooth interactions between businesses and customers on WhatsApp.


Steps to be followed


Pre Requisites

  1. The WhatsApp business number should be onboarded to the Exotel console.

  2. The WhatsApp number should be hosted either on On-Premise or Cloud API.

  3. You have configured the webhook for the phone number to receive the callbacks.     

    An example webhook is shown in the figure below:


  1. In case you are using our WhatsApp APIs, you need to integrate the updated Flows request and response for the Send Message API (for sending new type of session message and Template message) with the new callback formats.
    Please refer to the developer documentation 
    here.


Note: You can now configure a chatbot and start using the WhatsApp Flow feature to send automated flow messages.


Create Flow

There are 2 ways to create WhatsApp Flows: 

  1. Use WhatsApp Manager

  2. Use the Flows API

We are currently using the first approach above to create Flows. WhatsApp Manager contains two options to create Flows:

  1. Inclusion of Flows while creating Message Templates

  2. Using Flows Builder under the Account Tools section

Option 1: Inclusion of Flows while creating Message Templates

Step 1: Create Your Flow Template 


  1. Login to your Exotel account and click on the WhatsApp option from the left side menu.




  1. Navigate to the WhatsApp Flows option from the Left Side Menu and click on Meta Dashboard link for the Template with Flows section. 



  1. It will open the WhatsApp Business Manager portal in the new tab, search and open your valid WABA account from top right corner. In the WhatsApp Manager of your WhatsApp Business Account, select Account tools on the left-side menu and then click Flows.



  1. Click on the Create Template button and Select the Category as Marketing and the type as Form.



  1. Fill the basic information details for the template, the steps remain the same as the Exotel console like template name, and select language. Click on Continue.

  2. Fill the other template details like Header, Body, Footer with samples and navigate to the Buttons section where you need to provide the Button Text and select the Type of the form (you can select the relevant use case to get a pre-filled form) and click on Create.



  1. It will open an UI and within this UI you can create Flows using the drag and drop Form Editor, without having to write any Flow JSON code yourself.



  1. After you create and submit a Message Template with a Flow attached using this UI, you can send it to your users once it is approved by Meta. 

  2. Below is the reference video for a Lead generation use case form with the template which will help you! 


Creating Flows in Message Template Creation


Step 2: Sync the Exotel Template Console


  1. Go to the Template Management section on the messaging console.

  2. Select the same WABA from the dropdown on which this template was created.


  1. Click on the Sync icon to update the newly created Template on our console to start using the Template.



Option 2: Using Flows Builder under the Account Tools section


In this section, we'll walk you through creating your very first Flow. At the end of this tutorial, you'll have a completed and published demonstration Flow, ready to be sent to other WhatsApp users.


To do this, we'll use the Flows Builder UI in WhatsApp Manager. Remember, if you haven't already gone through the prerequisites, be sure to read through it before starting this guide.


Step 1: Create Your Flow

  1. Login to your Exotel account and click on the WhatsApp option from the left side menu.




  1. Navigate to the WhatsApp Flows option from the Left Side Menu and click on Meta Dashboard link for the Free Form Message. 



  1. It will open the WhatsApp Business Manager portal in the new tab, search and open your valid WABA account from top right corner. In the WhatsApp Manager of your WhatsApp Business Account, select Account tools on the left-side menu and then click Flows.



  1. On the top right of the page, click the button titled Create Flow. A dialog will open where you can enter some details about your Flow.


  1. What do these fields mean?


  1. Name: The name is a unique identifier for your Flow across your business account. Generally, try to choose a name that describes your Flow and its purpose. In this case, enter my_first_flow.

  2. Categories: Choose any categories that match the purpose of your Flow from the list of options. If none of the categories listed make sense for your Flow, just check "Other". In our case, choose "Other".

  3. Template: WhatsApp Flows has a few template Flows pre-created to make it easier for you to get started. If any of the templates are similar to what you'd like your Flow to do, use a template as a starting point for your Flow or leave this blank.


Step 2: Build Your Flow JSON


To help you move quickly, here's a very simple demonstration ("Hello World") Flow. You can edit it here and then copy-and-paste it over to the Flows Builder UI when you're ready. (You can also preview it inside the builder.)

Once you've pasted the JSON into the Flows Builder UI, click Run to preview the Flow. If you're happy with the demonstrated Flow, click Save.


{

  "version": "2.1",

  "screens": [

    {

      "id": "HELLO_WORLD",

      "title": "Hello World",

      "terminal": true,

      "layout": {

        "type": "SingleColumnLayout",

        "children": [

          {

            "type": "Form",

            "name": "form",

            "children": [

              {

                "type": "TextHeading",

                "text": "Hello World"

              },

              {

                "type": "TextBody",

                "text": "Welcome to WhatsApp flows"

              },

              {

                "type": "Footer",

                "label": "Complete",

                "on-click-action": {

                  "name": "complete",

                  "payload": {}

                }

              }

            ]

          }

        ]

      }

    }

  ]

}


Step 3: Test Your Flow

The easiest way to test a Flow is by using the Interactive preview option which simulates the real experience. You can click on the Flow's green Complete button to see the Flow in action.


Step 4: Publish Your Flow


When you first created your Flow, it entered the Draft state. And as you edited and saved the modified Flow JSON content, it remained in the Draft state. You are able to send the Flow while it's in the Draft state, but only for testing purposes. If you want to send the Flow to a larger audience, you'll need to Publish the Flow.


Note: Remember, once a Flow has been published it can no longer be modified. See Flow Status Lifecycle for more information on the different Flow states.


To publish your Flow, open the menu to the right of the Save button and click Publish. Once published, the Flow can be sent to anyone!


What's Next?

Congratulations! ? Your Flow can now be sent to real users. To learn how you can actually send your Flow, read the next section to Send the Flows


Build Data Channel

Setup and Consume webhook notifications


You will have to set up the Webhook to receive the WhatsApp Flows callbacks for your WhatsApp phone number.


Setup the Webhook


  1. You can set up the Webhook for WhatsApp phone numbers from the Exotel Messaging console.

  2. Go to the Webhooks section and navigate to the Phone Number.

  3. Click on the Edit icon on the right-hand side of the table.

  4. Paste your Callback URL and click on Save. (This will take 10-15 mins to be active).



Consume the Webhook notifications


  1. Upon flow completion, a response message will be sent to the WhatsApp chat. 

  2. 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.

  3. As you have configured the webhook for the number on the Exotel Message Console, you will receive the callbacks with the Flow details as the sample response present below:



{

    "whatsapp": {

        "messages": [

            {

                "callback_type": "incoming_message",

                "sid": "4743da54fb78365cb640caab9b2f17al",

                "from": "+918871206831",

                "to": "+912248931479",

                "timestamp": "2023-10-21T12:35:00+05:30",

                "profile_name": "Javed",

                "content": {

                    "type": "interactive",

                    "context": {

                        "sid": "f317c729f41c3e25d00d0b51c6ac17am"

                    },

                    "interactive": {

                        "type": "nfm_reply",

                        "nfm_reply": {

                            "body": "Sent",

                            "name": "galaxy_message",

                            "response_json": "{\"terms_and_conditions\":true,\"flow_token\":\"flows-builder-97dca41f\",\"vehicle_number\":\"74785\",\"name\":\"Javed Ansari\",\"phone_number\":\"918111101011\",\"email\":\"abcd@gmail.com\",\"cover_type\":\"0\"}"

                        }

                    }

                }

            }

        ]

    }

}


Sending a Flow


You are able to send your WhatsApp Flow once you have created it. On this page, we will explore the existing APIs for sending a message, as well as the modifications required for sending a message with a Flow.


There are two types of messages with which you can attach a Flow:

  1. Template messages from the Business

  2. In reply to user-initiated conversations


Details of how a Flow can be attached to these message types is explained below.


Template messages from the Business

You can send a template message with a WhatsApp Flow. Only the approved templates with the Flow buttons can be sent to the users via Campaigns or APIs.

We have introduced a new button type called FLOW. Use this type to specify the Flow to be sent with the template message.


Please follow the steps below to send a Flow via Template messages. 

Step 1: Create and Sync the Template with Flows

  1. Given that the template is created on the Meta dashboard and you have synced the Templates on the Exotel dashboard.

  2. You can refer to this section to complete this step - Step 1: Create Your Flow Template 


Step 2: Send the Template via Exotel Campaign Console


Let us see how to send a Campaign with the Template Flows CTA button.


  1. Login to the Exotel dashboard and navigate to the Campaign console from the left-sided menu.

  2. Select WhatsApp and Click on the Create button from the top right corner.



  1. Provide the Campaign name, Select the correct WABA ID where this new template with Flow button was created on the Meta dashboard.



  1. Select the Phone Number, and attach the Audience List details to the campaign to whom you would want to send the message and click on Next.

  2. Select the correct Template name which has the ‘Form’ present in the button and click on Next. Templates with a Flow attached to them will be shown as ‘MARKETING - FORM’  to differentiate the Flows templates with the other Marketing category templates (see below)


  1. Review the selected Template with the Flow button with the Preview screen present on the RHS on the third step and click on Next.

  2. Schedule your campaign as per your requirement and click on Create Campaign button to send the template messages.



Alternative to Step 2: Send the Template Message via API


  1. Please follow Step 1 for creating the template with Flow on the Meta dashboard.

  2. You can then use the Send Template Message API (Business Message) to send the Flow message via API.

  3. You need to configure the endpoint in a similar way how you use to send other messages - POST https://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/messages

    1. You can get the API credentials and details from your Exotel account under the API Credentials section.

  4. Following are the key parameters related to Flow that you need to pass (along with the other mandatory/optional parameters in the Send Template Message API) - Postman API Collection

    1. To and from number

    2. Template Name

    3. Language Code

    4. Flow Token - Optional (this can be passed any static value)



Property

Type

Description

buttons.flow_id

String

id of a flow

buttons.navigate_screen

String

Flows Json screen name. Required if flow_action is navigate

buttons.flow_action

Enum

navigate or data_exchange. Default value is navigate


  1. Hit the send message API to send and test your template message containing the Flow.




In reply to user-initiated conversations

You can send a message with a Flow in a user-initiated conversation using a message with a Call To Action (CTA). 

You can send this message either through Send Message API with information specific to the Flow. The Flow is triggered when the user clicks on the CTA button.


Please follow the steps below to send a Flow via user-initiated conversation message types. 

Step 1: Create the JSON flow on meta

  1. Given that the required JSON Flow is created on the Meta dashboard and you have successfully published the Flow you are good to go.

  2. You can refer to this section to complete this step - Create Free Form Flows


Step 2: Send the JSON Flow


  1. You can use the Send Template Message API (User Initiated Message) to send the Flow message via API.

  2. You need to configure the endpoint in a similar way how you use to send other messages - POST https://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/messages

    1. You can get the API credentials and details from your Exotel account under the API Credentials section.

  3. Following are the key parameters related to Flow that you need to pass (along with the other mandatory/optional parameters in the Send Message API) -  Postman API Collection

    1. To and from number

    2. Content type - Interactive

    3. Header, Body and Footer Text for the Message

    4. Below are more details: 

    5. Action -> name

    6. flow_message_version

    7. flow_id

    8. flow_token

    9. flow_cta

    10. flow_action

    11. flow_action_payload -> Screen name

Property

Type

Description

interactive.type

String

Value must be flow

interactive.action.name

String

Value must be flow for Cloud API number and galaxy_message for On Premise Number

interactive.action.parameters.mode

String

The Flow can be in either draft or published mode. published is the default value for this field.

interactive.action.parameters.flow_message_version

String

Value must be 3.

interactive.action.parameters.flow_token

String

Flow token that is generated by the business to serve as an identifier.

interactive.action.parameters.flow_id

String

Unique Flow ID of the Flow provided by WhatsApp.

interactive.action.parameters.flow_cta

String

Text on the CTA button. For example: "Signup"

Character limit - 20 characters (no emoji).

interactive.action.parameters.flow_action

String

navigate or data_exchange. Default value is navigate

interactive.action.parameters.flow_action_payload

String

Required if flow_action is navigate. Should be omitted otherwise.

interactive.action.parameters.flow_action_payload.screen

String

The screen name of the first screen.

interactive.action.parameters.flow_action_payload.data

String

Optional. The input data for the first screen of the Flow. Must be a non-empty object.


  1. flow_token: Copy it from the Meta Dashboard from the Flows Section, click on the Manage option on the right hand side.
    It will open the Modal which will provide you the Flow Token and other details for that published flow.



  1. Configure the API payload and Hit the send message API to send and test your message.

  2. Make sure an active conversation is present to send a free form session message.



Note: You can also configure a Chatbot and send an automated reply with Flow CTA button using the Chatbot UI. Please Contact your CSM for more details to understand how to configure and use the Chatbot with your WhatsApp number.



Note: Currently, we support static Flows in WhatsApp i.e. Flows where the questions shown in the subsequent Flow screens are not dependent on the data provided in the previous screens. If your use case is around dynamic Flows, e.g. displaying the available seats for a movie show is dependent on the date and time of the show selected,  please contact hello@exotel.com with the subject of the email as mentioned below, and we’ll be happy to assist you.


Email subject: Enable dynamic WhatsApp Flows feature