Menu

Connect Virtual Agent

Virtual Agent is in Public Beta. Learn more about Twilio's beta product support here.

Looking for the Connect Virtual Agent (Dialogflow ES) Widget? View the documentation here.

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.

Connect Virtual Agent Widget (for Dialogflow CX)

You can leverage a native integration between Twilio Voice and 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

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.

Required Configuration for Connect Virtual Agent Widget

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 after you have completed the One-click telephony integration in the step above.

Name Description Default
Connector Name The unique name configured in your Dialogflow CX connector instance. empty

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 and the Studio Widget.

Optional Configuration for Connect Virtual Agent

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

Name Description Default
Status Callback URL URL to send status callback events from Twilio empty
Status Callback Method The HTTP method to use when requesting the statusCallback URL. Accepted values are GET or POST. POST
Parameters Key-value pairs used to send custom session parameters to your virtual agent to drive personalization and/or parameterize your agent’s response empty
Configurations Key-value pairs used to override underlying connector properties (e.g. language, sentimentAnalysis, voiceName, welcomeIntent, etc.) and/or modify your virtual agent’s default behavior empty

Connect Virtual Agent Transitions

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

Name Description
Completed The Dialogflow CX agent ended the connection because an intent matched the "end of the conversation" intent indicating the call completed successfully
Live Agent Handoff The Dialogflow CX agent returned a live agent handoff response indicating the call needs to be escalated to a human agent
Hangup The caller hung up during the Dialogflow CX agent interaction
Failed An error occurred during VirtualAgent processing

Connect Virtual Agent Variables

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.

Name Liquid 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

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 key Description
ConversationId ConversationId: Unique identifier for this conversation provided by Google
EndUserId Unique identifier for the end user participant provided by Google
AgentHandoffParameters Parameters included from the Dialogflow CX Agent if the Live Agent Handoff Transition was triggered
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 by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

Thank you for your feedback!

Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!

Refer us and get $10 in 3 simple steps!

Step 1

Get link

Get a free personal referral link here

Step 2

Give $10

Your user signs up and upgrade using link

Step 3

Get $10

1,250 free SMSes
OR 1,000 free voice mins
OR 12,000 chats
OR more