Skip to contentSkip to navigationSkip to topbar
On this page

Connect Virtual Agent


Studio uses Widgets to represent various parts of Twilio's API that can then be stitched together in your Studio Flow to build out robust applications that require no coding on your part.

The Connect Virtual Agent Widget allows you to connect a Twilio Voice call to a Google Dialogflow CX agent(link takes you to an external page).

Connect Virtual Agent Widget (for Dialogflow CX).

You can leverage a native integration between Twilio Voice and Dialogflow CX to provide callers with conversational AI experiences. The integration also allows for operations such as live agent handoff and customer barge-in.

Twilio provides the telephony aspect of the conversational IVR experience and Dialogflow CX enables agent configuration, including setting intents, sentiment analysis, speech models, and agent responses.


Set up the integration between Twilio and Dialogflow CX

set-up-the-integration-between-twilio-and-dialogflow-cx page anchor

To use the Connect Virtual Agent Widget, you must connect your Dialogflow CX agent to Twilio in the Google Dialogflow CX cloud console. Review the prerequisites and steps for the integration in the Dialogflow CX Onboarding Guide.

After you complete the integration, Twilio will automatically create a new Studio Flow containing a Connect Virtual Agent Widget that is connected to your Dialogflow CX agent.


Start or resume a session

start-or-resume-a-session page anchor

As you're setting up your virtual agent, you can choose to:

  • Start a new session
  • Resume a paused session

Start a new session

start-a-new-session page anchor

If you start a new session, you'll need to add the Virtual agent connector. Enter the connector's name exactly as it appears in the Twilio Marketplace Add-on listings.

(information)

Info

To pause a session, you must configure a custom payload in your virtual agent. Visit Pause a session to learn more.

If you resume a paused session, you'll need to select how to identify the previous session. Choose from the following options:

  • Select a previous widget: This allows you to select a previously used Widget to resume a session from. Use the dropdown to select the Widget where the session you want to resume was paused. Based on your selection, Studio identifies the virtual agent connector and EndUserID needed to resume the session.

  • Manual entry: This allows you to manually enter the Virtual agent connector and EndUserID from a previously paused session.

If you'd like to start from a specific event, select Resume session at a specific point. When unchecked, the session resumes from the same point it was paused. Learn more about how to resume a session and configure resumeEventName.


Required Configuration for Connect Virtual Agent Widget

required-configuration-for-connect-virtual-agent-widget page anchor

The Connect Virtual Agent Widget requires the connector name for the Google Dialogflow CX instance. You can find the Connector Name in the Dialogflow CX Connector in the Twilio Console(link takes you to an external page) after you have completed the One-click telephony integration in the step above.

NameDescriptionDefault
Connector NameThe unique name configured in your Dialogflow CX connector instance.empty
(error)

Danger

Editing the Connector Name within the Connect Virtual Agent Studio Widget alone will break the integration between Dialogflow and your Twilio project. If you need to update the Connector Name, you must edit it in the Dialogflow CX Connector(link takes you to an external page) and the Studio Widget.


Optional Configuration for Connect Virtual Agent

optional-configuration-for-connect-virtual-agent page anchor

The Connect Virtual Agent Widget also accepts a number of configuration options that you can use to configure agent interactions and analysis.

NameDescriptionDefault
Status Callback URLURL to send status callback events from Twilioempty
Status Callback MethodThe HTTP method to use when requesting the Status Callback URL. Accepted values are GET or POST.POST
ParametersKey-value pairs used to send custom session parameters to your virtual agent to drive personalization and/or parameterize your agent's responseempty
ConfigurationsKey-value pairs used to override underlying connector properties (e.g. language, sentimentAnalysis, voiceName, welcomeIntent, etc.) and/or modify your virtual agent's default behaviorempty

Connect Virtual Agent Transitions

connect-virtual-agent-transitions page anchor

These events trigger transitions from this Widget to another Widget in your Flow. For more information on working with Studio transitions, see this guide.

NameDescription
CompletedThe Dialogflow CX agent ended the connection because an intent matched the "end of the conversation" intent indicating the call completed successfully
Live Agent HandoffThe Dialogflow CX agent returned a live agent handoff response indicating the call needs to be escalated to a human agent
PausedThe Dialogflow CX agent session was paused with the intention of the session being resumed later
HangupThe caller hung up during the Dialogflow CX agent interaction
FailedAn error occurred during VirtualAgent processing

Connect Virtual Agent Variables

connect-virtual-agent-variables page anchor

When the Connect Virtual Agent Widget executes, it will have stored the following variables for use throughout your Studio Flow (where MY_WIDGET_NAME is the name of your actual Widget). For more information on working with variables in Studio, see this guide.

NameLiquid Template Language
VirtualAgentProvider{{widgets.MY_WIDGET_NAME.VirtualAgentProvider}}
VirtualAgentStatus{{widgets.MY_WIDGET_NAME.VirtualAgentStatus}}
VirtualAgentProviderData{{widgets.MY_WIDGET_NAME.VirtualAgentProviderData}}
VirtualAgentError{{widgets.MY_WIDGET_NAME.VirtualAgentError}}
VirtualAgentErrorCode{{widgets.MY_WIDGET_NAME.VirtualAgentErrorCode}}

VirtualAgentError and VirtualAgentErrorCode will be present if status is failed (if the Widget ends through the Failed transition). VirtualAgentProviderError may also be provided if VirtualAgentErrorCode is 32601.

VirtualAgentProviderData

virtualagentproviderdata page anchor

For Google Dialogflow CX agent, the VirtualAgentProviderData JSON object may contain the following information. Note that this variable might be empty if the Widget exited through the Failed transition.

JSON keyDescription
ConversationIdConversationId: Unique identifier for this conversation provided by Google
EndUserIdUnique identifier for the end user participant provided by Google
AgentHandoffParametersParameters included from the Dialogflow CX Agent if the Live Agent Handoff Transition was triggered
PauseParametersParameters included from the Dialogflow CX Agent if a Pause Transition was triggered.

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.