Pass data to and from a bot

Use flow input and output variables to pass data back and forth between call, chat, or message flows and Architect bots. You can add any logic and configure expressions and return values based on your flow requirements. However, this example demonstrates how to pass a specific balance to and from a bot flow.

Note: You can perform this task from a new or existing call or voice flow, or directly from a new or existing bot flow. This example demonstrates how to pass data to and from a bot flow from within an existing chat flow.

Add an intent

To create an intent, follow these steps:

  1. Create a bot flow or open an existing one. The Bot Flow page opens.
  2. Under Natural Language Understanding, click Intents.
  3. To add a new intent, do the following:
    1. Click Add Intent.
    2. Add a distinctive name for the intent and click Save.
    3. Click Add Utterance.
    4. Under Utterance, type the term or phrase.
    5. Press Enter.
    6. Repeat steps c and d for each additional utterance. 
  4. Next, add slots.

Add a currency statement variable to a bot flow

  1. From the Architect home page, click or hover over the Flows menu and select Bot Flow.
  2. Open an existing bot flow.
  3. Open the chat flow’s Initial State.
  4. Click the chat flow’s Call Bot Flow action.
  5. Under Bot Flow, click the Open the selected flow . The bot flow opens in a new tab.
  6. From the Architect toolbox, add an Update Data action into the bot flow’s editor.
  7. Click Add update statement and select Currency.
  8. In the Variable Name field, type a name for the variable. For example, Flow.AccountBalance. 
  9. Click the variable link. The Edit Variable dialog box opens.
    Note: If your variable is new, after you type the name click anywhere on the screen and the name appears as a blue hyperlink. Click the variable name; for example, Flow.AccountBalance. The Edit Variable dialog box opens.
  10. Configure the variable as an output from the bot flow:
    1. Under Variable Options, click to enable the Output from flow check box.
    2. (Optional) Add a description to the variable. For example, Customer account balance.
    3. Click Save.
  11. In the Value To Assign field, add a value. For example, $500.00.
  12. Click Publish.
  13. Navigate to the inbound chat flow and refresh the page. The new Currency update statement, Flow.AccountBalance in this example, appears in the Output area.
  14. In the new variable’s field, bind it to the inbound chat flow. In this example, enter Task.AccountBalance.

Use the variable in a chat flow

The variable is now available to use by flow authors. You can add a Decision action to retrieve information. For example:

  1. Add a Decision action to the chat flow.
  2. Drag a Decision action below the Call Bot Flow action.
  3. In the Expression box, to bind the example intent, type Task.AccountBalance == “Check Account Balance”.
  4. Under the Decision action’s Yes path, add a Send Response action.
  5. Under Message Body, click to open the String Builder dialog box.
  6. Add a Text field and enter “Your account balance is.”
  7. Add a Data field and enter State.AccountBalance.
  8. Save and publish the flow.

The result in a real-time chat message is: “Your account balance is $500.00.”

Pass and use an intent in an inbound call flow

  1. Add intents to a bot flow.
  2. Open an existing call flow.
  3. Add a Call Bot Flow action to the call flow.
  4. In the Call Bot Flow’s Execution Results area, under Intent, add the variable name; for example, State.BotIntent.
  5. Add a Decision action below the Call Bot Flow action.
  6. In the Expression box, to bind the example intent, type State.BotIntent == “Book Appointment”.
  7. Under the Decision action’s Yes path, add a Transfer to ACD action.
  8. Select an appropriate queue.
  9. Save and publish the flow.