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?

Handoff

The Autopilot Handoff action enables you to transfer a user from an Autopilot session to a human agent, passing along all the context of the conversation.

  • Handoff to Programmable Voice
  • Handoff a Voice call to Task Router or Flex

NOTE: Handoff is only supported in Voice Autopilot sessions

Handoff to Programmable Voice

When handing off an Autopilot voice session to Programmable Voice, you need to provide the destination TwiML URL. When the Hand-off is executed the Autopilot session is terminated and TwiML will be fetched and executed from the URL provided. See the Autopilot Request to see the callback params

Example 1: Transfer Autopilot session to a Programmable Voice TwiML URL.

{
	"actions": [
		{
			"say": "Hold on, we are connecting you with an agent"
		},
		{
			"handoff": {
				"channel": "voice",
				"uri": "INSERT YOUR TWIML_URL HERE",
				"method": "POST"
			}
		}
	]
}

Example 2: Transfer Autopilot session to a Programmable Voice TwiML URL with a Programmable Voice Status Callback URL defined.

{
	"actions": [
		{
			"say": "Hold on, we are connecting you with an agent"
		},
		{
			"handoff": {
				"channel": "voice",
				"uri": "INSET YOUR TWIML_URL HERE",
				"method": "POST",
				"voice_status_callback_url": "INSERT STATUS_CALLBACK_URL HERE"
				"voice_status_callback_method": "POST"
			}
		}
	]
}

Handoff to Task Router or Flex

When handing off an Autopilot voice session to Task Router or Flex, you need to provide the destination the Task Router workflow Sid. When the Hand-off is executed the Autopilot session is terminated, the call is enqueued with the Dialogue Payload as a task attribute.

Example 3: Transfer Autopilot session to a contact center agent via Task Router or Flex.

{
	"actions": [
		{
			"handoff": {
				"channel": "voice",
				"uri": "taskrouter://WW0123456789abcdef0123456789abcdef"
			}
		}
	]
}

Example 4: Transfer Autopilot session to a contact center agent via Task Router or Flex with all the optional parameters.

{
	"actions": [
		{
			"handoff": {
				"channel": "voice",
				"uri": "taskrouter://WW0123456789abcdef0123456789abcdef",
				"wait_url": "https://myapp.com/hold_music.php",
				"wait_url_method": "GET",
				"action": "https://myapp.com/post_bridge_survey.php",
				"priority": "5",
				"timeout": "200"
			}
		}
	]
}
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.