Menu

Expand
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 the Autopilot Studio Widget

The Autopilot Studio Widget lets you send calls or messages from Studio to an Autopilot bot and back to Studio after the session with the bot ends.

In this guide you will learn how to:

You can also check out the Autopilot Widget reference documentation

Autopilot Studio Wdiget

Add Autopilot variables into Studio Flows

Using the Autopilot Widget lets you leverage data from a conversation with an Autopilot bot, like data from Memory or Field Types in the Studio Flow. This is especially useful when you use a bot to collect data from the user and need to make decisions in Studio based on that.

You can access the following Autopilot variables in Studio Flows:

Variable

widgets.{AutopilotWidgetName}.CurrentTask


The last Autopilot Task before the conversation with the bot ended.

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 to the Autopilot bot.

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.{CollectName}.answers.{QuestionName}.answer


The answer to an Autopilot Collect question.

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


The data type of the Autopilot Collect question.

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


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

widgets.{AutopilotWidgetName}.Memory.twilio.collected_data.{CollectName}.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 Memory using the Remember Action.

Initiate an Autopilot dialogue via Studio

With Autopilot and Studio you can start an Autopilot dialogue without being triggered by user input with the following steps:

1. Connect the trigger widget's Rest API trigger event to either a make outgoing call or send message widget, as shown below.

autopilottrigger1.png
2. If the call is answered or the message is sent, you can connect those actions to the Send to Autopilot widget.

send to autopilot widget
3. Under the config section of your Send to Autopilot widget, put in the Collection task you want to run when the outbound call or message is initiated by your Twilio client and not the user.

Autopilot Trigger Target Task

Tada! You've initiated an Autopilot dialogue starting with your Autopilot bot and not the user.

Handoff from Autopilot to human agents

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

  1. Create a talk-to-agent Task for your Autopilot bot
  2. Train the talk-to-agent Task
  3. Program the talk-to-agent Task
  4. Insert a Split Widget after the Autopilot Widget on the end_session transition
  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 only want to send to agents Autopilot sessions that end on the talk-to-agent Task. To check for this, you'll need to create a Split Widget after the Autopilot end_session transition.

Autopilot Studio Widget

5. Evaluate the Autopilot CurrentTask variable in the Split widget

Here you need to create a condition in the Split Widget to check if the task is talk-to-agent. You will end up with two transitions from the widget — one for if the CurrentTask matches talk-to-agent and another when the it does not match.

Autopilot Studio Widget

6. Connect to Agent

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

Autopilot Studio Handoff

Use Autopilot with Flex

You can also 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.