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.
Add an intent
To create an intent, follow these steps:
- Create a bot flow or open an existing one. The Bot Flow page opens.
- Under Natural Language Understanding, click Intents.
- To add a new intent, do the following:
- Click Add Intent.
- Add a distinctive name for the intent and click Save.
- Click Add Utterance.
- Under Utterance, type the term or phrase.
- Press Enter.
- Repeat steps c and d for each additional utterance.
- Next, add slots.
Add a currency statement variable to a bot flow
- From the Architect home page, click or hover over the Flows menu and select Bot Flow.
- Open an existing bot flow.
- Open the chat flow’s Initial State.
- Click the chat flow’s Call Bot Flow action.
- Under Bot Flow, click the Open the selected flow . The bot flow opens in a new tab.
- From the Architect toolbox, add an Update Data action into the bot flow’s editor.
- Click Add update statement and select Currency.
- In the Variable Name field, type a name for the variable. For example, Flow.AccountBalance.
- 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.
- Configure the variable as an output from the bot flow:
- Under Variable Options, click to enable the Output from flow check box.
- (Optional) Add a description to the variable. For example, Customer account balance.
- Click Save.
- In the Value To Assign field, add a value. For example, $500.00.
- Click Publish.
- 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.
- 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:
- Drag a Decision action below the Call Bot Flow action.
- In the Expression box, to bind the example intent, type Task.AccountBalance == “Check Account Balance”.
- Under the Decision action’s Yes path, add a Send Response action.
- Under Message Body, click to open the String Builder dialog box.
- Add a Text field and enter “Your account balance is.”
- Add a Data field and enter State.AccountBalance.
- 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
- Add intents to a bot flow.
- Open an existing call flow.
- Add a Call Bot Flow action to the call flow.
- In the Call Bot Flow’s Execution Results area, under Intent, add the variable name; for example, State.BotIntent.
- Add a Decision action below the Call Bot Flow action.
- In the Expression box, to bind the example intent, type State.BotIntent == “Book Appointment”.
- Under the Decision action’s Yes path, add a Transfer to ACD action.
- Select an appropriate queue.
- Save and publish the flow.