Articles in this section
Category / Section

How to Configure Dynamic Order Selection in Chat Workflows Using Webhooks

3 mins read
Updated:
New

Integrating dynamic order selection into workflows enables personalized customer experiences and efficient data capture.

By using temporary fields and webhooks to fetch data from external systems, you can populate selection inputs with real-time order data and seamlessly tie the user’s selection to a chat field.

This guide provides step-by-step instructions for configuring a workflow that fetches customer orders, displays them as selectable options, and stores the selected order ID in a chat field for further processing.

Fetching customer orders using a webhook

Creating a workflow

  1. Navigate to Admin > Chat > Chat Automation > Workflow > Conversation Created and click Add Workflow.

  2. Enter the required details and click Next.

    CreateWorkflow

  3. In the Designer, select the Initial Block, then click the plus (+) icon to open the context menu.

    InitialBlock

  4. Configure how to collect the email using the Customer Details Block.

Refer here for more details: How to Request the Customer’s Email After Their First Message?

Configuring webhook to fetch the orders

  1. Navigate to Actions > Trigger Webhook.
  2. Configure request parameters as follows:
  3. Click Test API Call to enable Response Mapping.
  4. Configure Response Mapping to store the API result in a temporary variable (e.g., orders), then click Add.
    TriggerWebhookGeneralConfig

    TestAPICall

    ResponseMapping

Displaying orders as selectable options and assigning the selected value to a chat field

  1. In the API Success path, configure a dropdown input block by navigating to User Inputs > Drop-down > Get Choice via Drop-down. This displays the list of orders retrieved from the temporary field.

    SuccessPath

  2. Provide the necessary details and enable Use Saved API Data to populate choices using temporary field data (e.g., tf_orders, created in the Trigger Webhook block).

  3. From the Temporary Field Name dropdown, choose the field that contains the array of orders.

  4. Map the Option properties to define how each should appear based on the structure of the array as follows:

    • If the temporary field contains an array of objects: Map the object properties to the Label and Value fields.
      • Label: The property name to display to the user.
      • Value: The property name that uniquely identifies the item.
    • If the temporary field contains an array of primitive values: No mapping is needed. Each value will be used as both the Label and the Value automatically.
      DropdownBlockUseSavedAPIDataEnabled
  5. For failed requests, configure the failure path and communicate to the customer with an appropriate message.

  6. Use Action > Send Message to communicate appropriate messages for each path (failure or success).

  7. Conclude each workflow path with an Exit block, and finally, Activate the workflow.

For dynamic options to be configured and function correctly, please ensure the following:

  1. Workflow order: The temporary field you select from the dropdown must be created in a previous step within the workflow. This ensures its data is available when this block is executed.
  2. Ensuring valid option assignment to chat fields: When using temporary field data to populate dropdown options, and assigning the selected value to a chat field, the value must exactly match one of the predefined options configured for that chat field. Otherwise, the value will be skipped and not saved.

OrderLookUpWorkflow

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied