Sending a WhatsApp Flow and Receiving Response via Bot Application

Updated 

Before You Begin

Ensure you have an existing flow asset created

Sending a Flow

This process outlines the steps for sending a flow through WhatsApp using a dialogue tree. By selecting the appropriate flow asset, you can ensure effective communication with users on the WhatsApp platform.

Note: A WhatsApp Flow Asset cannot be used for initiating a new conversation. However, it can be used within an ongoing conversation and sent within 24 hours of the last message sent by the user.

  1. Start by creating a dialogue tree that includes a bot reply node.

  2. Change the reply to the Chat Templates.

  3. Select the Channel as WhatsApp Business.

  4. Choose a flow asset from the Digital Asset Manager (DAM). All flows created within Conversational AI will be available in the DAM.

  5. Once you’ve selected the appropriate flow asset, click Save to finalize the setup for sending the flow.

Triggering Bot with Flow Asset via Rule

  1. Create an Inbound rule.

  2. Condition Setup: Under "Condition Applies To The source of the Message" section, select the Account as WhatsApp Business account. Ensure that the WhatsApp account (number) used is associated with the same WABA (WhatsApp Business Account) using which the Flow Asset was created.

  3. Action Selection: Under "Actions To Auto respond to a message using bot" section, select

    Trigger Bot Application: Select Receiver Account Type. Defines the trigger condition for the bot.

    Bot Application: Specifies which bot application the trigger condition will be applied to.

    Choose Account to Reply From: Select Receiver Account.

    Choose Campaign: Choose a specific campaign if required.

    Choose Preferred Reply Type: Select Auto Select from Message to have the bot automatically choose the reply based on the incoming message content.

This setup ensures that the bot triggers correctly based on the inbound rule conditions and replies using the designated flow asset from the associated WhatsApp account.

Receiving the Flow Response

Once the users fill in the details in the configured flow, you can receive their responses seamlessly.

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 the message webhook. The response_json field will contain flow-specific data formatted as follows:

{
"flow_token": "<FLOW_TOKEN>",
"optional_param1": "<value1>",
"optional_param2": "<value2>"
}

This structure allows you to capture and utilize the information provided by users in response to the flow, enabling you to enhance the user experience and process the data accordingly.

  1. Add an Update Properties node after the Bot Reply node.

  2. Define a variable to store information on the left that can be captured using a Groovy script on the right:

    def resp = MESSAGE.TEXT;​​
    ​​return resp;

  3. Click Save to finalize the changes. This allows you to capture the user’s input and store it for further processing.