Menu

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

How to use variables from the Autopilot Widget in Studio

The Autopilot Studio Widget allows you send calls or messages from Studio to Autopilot and handle what happens after the Autopilot session ends.

In this guide you will learn to:

See the Autopilot Widget reference documentation.

Autopilot Studio Wdiget

Use Autopilot variables in Studio

Using Autopilot within Studio, you can leverage all the Autopilot session data later in the flow. This is especially useful when you collect data with Autopilot and then make flow decisions in Studio based on that.

You have access to the following variables:

Variable

widgets.{AutopilotWidgetName}.CurrentTask


The user's last Autopilot Task.

widgets.{AutopilotWidgetName}.DialogueSid


The Autopilot session identifier. It is 34 characters long, and always starts with the letters UK.

widgets.{AutopilotWidgetName}.UserIdentifier


The unique user identifier coming from the channel. For Voice and SMS it will be the user's phone number.

widgets.{AutopilotWidgetName}.CurrentInput


The last thing the user said on Autopilot.

For example: "I want to book an appointment for 4 in the afternoon"

widgets.{AutopilotWidgetName}.Field_{field-name}_Value


The key-value pair of the field value recognized from last thing the user said. A different key-value pair will be sent for each field value.

For example: 16:00

widgets.{AutopilotWidgetName}.Field_{field-name}_Type


The key-value pair of the field type recognized from last thing the user said. A different key-value pair will be sent for each field type.

For example: Time

widgets.{AutopilotWidgetName}.DialoguePayloadUrl


A URL to the Dialogue JSON payload that contains the context and data collected during the Autopilot session.

widgets.{AutopilotWidgetName}.Channel


The channel the interaction is taking place.

widgets.{AutopilotWidgetName}.Memory.twilio.collected_data.{ColletcName}.answers.{QuestionName}.answer


The answer to an Autopilot Collect question.

widgets.{AutopilotWidgetName}.Memory.twilio.collected_data.{ColletcName}.answers.{QuestionName}.type


The data type of the Autopilot Collect question.

widgets.{AutopilotWidgetName}.Memory.twilio.collected_data.{ColletcName}.answers.{QuestionName}.filled


True if the Autopilot Collect question was answered, false otherwise.

widgets.{AutopilotWidgetName}.Memory.twilio.collected_data.{ColletcName}.answers.{QuestionName}.attempts


The number of attempts it took the user to answer the question.

widgets.{AutopilotWidgetName}.Memory.{RememberedVariable}


A variable stored in the Autopilot Assistant Memory using the Remember action.

Handoff from Autopilot to human agents

With Autopilot and Studio you can handoff a user session from an Autopilot bot to a human agent on any channel following the steps below:

  1. Create a talk-to-agent Task on Autopilot
  2. Train the talk-to-agent Task
  3. Program the talk-to-agent Task
  4. Insert a Split widget after the Autopilot widget on end_session trasition
  5. Evaluate the Autopilot Current Task variable in the Split widget
  6. Connect to an agent

1. Create a talk-to-agent Task on Autopilot

Go to the Tasks section of Autopilot and create a talk-to-agent Task.

2. Train the talk-to-agent Task on Autopilot

Once the task is created, click on Train and add the samples below:

  • Talk to agent please
  • representative
  • agent
  • I want to talk to someone
  • talk to a person
  • talk to representative
  • agent please

3. Program the talk-to-agent Task on Autopilot

Then click on Program, to define what happens when the task is invoked. Enter the following JSON:

{
	"actions": [
		{
			"say": "Hold on, we are connecting you with an agent"
		}
	]
}

Note that the task does not have a Listen: true, meaning that the Autopilot session will end and it will send control back to Studio.

4. Insert a Split widget after the Autopilot widget on end_session trasition

You will only want to send to agents the Autopilot sessions that end on the talk-to-agent Task. To differentiate this, you'll need to create a Split after the Autopilot end_session transition.

Autopilot Studio Widget

5. Evaluate the Autopilot CurrentTask variable in the Split widget

Here you need to create one condition in the Split widget if the task is talk-to-agent. You will end up with two transitions from the widget: if task is talk-to-agent and No condition matches for everything else.

Autopilot Studio Widget

6. Connect to Agent

Lastly, you need to connect the talk-to-agent transition to the appropriate widget.

  • For Voice - use the Connect Call To widget
  • For SMS, Chat and Messaging Channels - use the Reply and Wait for Reply

Autopilot Studio Handoff

Use Autopilot and Flex

You can easily use Autopilot and Flex by adding the Send to Flex widget to do human agent handoff.

Autopilot and Flex

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.