Google Dialogflow CX Native Integration in Flex for Voice Virtual Agents

This feature is currently available as a Public Beta and the information contained in this document is subject to change. Some capabilities are not yet implemented, and others may change before the product is declared Generally Available. Beta products are not covered by a Twilio SLA. Learn more about Public Beta support.

This feature requires Flex UI version 2.2.0 or above. Additionally, the feature is only available for Google Dialogflow CX and may not work as expected for Dialogflow ES.

This guide outlines the features that are available as part of the native integration of Google Dialogflow CX with Flex. This relies on the Twilio one-click integration for Google Dialogflow CX. Along with the ability to hand off Virtual Agent calls to agents in Flex, you are now also able to view the transcripts for the Virtual Agent’s conversations with customers. You can also pass relevant information from the Virtual Agent to the Flex interaction to aid routing.


Enable Interaction Logging Google Dialogflow CX Console under Agent Settings

Virtual Agent Widget

Once the Dialogflow CX integration is complete, you will get access to the Connect Virtual Agent Widget.

This widget orchestrates the call connection between Twilio Flex and Google's Dialogflow Virtual Agent. For an explanation of the events that could trigger a transition from Studio's Connect Virtual Agent widget, see Connect Virtual Agent Transitions.

Sensitive Data (PII and PHI)
Please do not include Sensitive Data (PII and PHI) as part of the Virtual Agent to ensure appropriate handling of the data in our systems.

Integration with Flex

To allow agents in Flex to handle the calls from the Virtual Agent, the Live Agent Handoff transition of the Connect Virtual Agent widget needs to be linked to the Send to Flex widget. Follow these steps to integrate Flex with Google Dialogflow CX:

Step 1: Set up live agent handoff fulfillment in the Google Dialogflow Console

From the Google Dialogflow Console, you must ensure that the live agent handoff fulfillment is being triggered by the virtual agent from the required flows to initiate the transition within Twilio Studio. This is the first step for ensuring seamless routing of an ongoing call to an agent in Flex.

Google Dialogflow CX Virtual Agent Live agent handoff fulfillment

For more details, check out Google's live agent handoff docs.

In the Live agent handoff fulfillment section of the Google Dialogflow Console, it is not mandatory to enter a JSON object to ensure that the call is routed to Flex. In a later section, we will look at how we share additional data from the virtual agent to Flex.

Step 2: Connect Google Dialogflow CX with Live Agent Handoff Transition in Studio

As we noted in the previous section, if the virtual agent was not able to fulfill the call, Dialogflow CX allows you to escalate it to a live human agent. Twilio’s support for status callbacks allows us to pass requests containing information on call status, intents triggered, sentiment scores, agent-caller text, and more to your application URL, which would enable you to write custom code against it and build a live agent hand-off experience in your own contact center application.

If you are using Twilio Studio's Connect Virtual Agent widget and Google's Dialogflow CX virtual agent returns a live agent handoff response (indicating the call needs to be escalated to a human agent), the Live Agent Handoff transition state is triggered.

If you are using TwiML and the Dialogflow CX virtual agent returns a live agent handoff response indicating the call needs to be escalated to a human agent, the VirtualAgentStatus field in the request to your action URL is set to live-agent-handoff.

If you are using the <Virtual Agent> TwiML noun for integrating with Flex instead of the Studio-based configurations, the Transcripts on the Flex UI would not be available.

Step 3: Associate Studio's Connect Virtual Agent widget with the Send to Flex widget

The final step in this process is to associate the Live Agent Handoff transition of the Connect Virtual Agent widget with the Send to Flex widget. In the Send To Flex widget config, you need to select the appropriate workflow on a "Voice" Task Channel to route the calls. In the Attributes field, you can specify an attribute and dynamically select the VirtualAgentProviderData for your Connect Virtual Agent widget:

{"escalation_type": "{{widgets.<connect_virtual_agent_widget-name>.VirtualAgentProviderData}}" }

This will ensure that the transition for Live Agent Handoff is used to create a task and route it to an appropriate agent in Flex.

Connect Virtual Agent with Send to Flex widget

Availability of transcripts

Once the setup steps mentioned above are completed, the Virtual Agent calls that are escalated to Flex will also consist of the transcripts of the call. This is to aid the agent with the context of the call so that they are better equipped as well as do not need to request for information that has already been provided by the customer.

The transcript will only be available for the portion of the call where the Dialogflow CX Virtual Agent was interacting with the customer. The transcript messages would also indicate distinctly the utterances by the Virtual agent as well as the customer.

Call Transcripts in Flex UI for Dialogflow CX Voice Virtual Agent

Accessing data from Google Dialogflow CX to Flex

To send additional information from the Dialogflow CX Virtual Agent during the Live Agent handoff process, the optional data section of the Dialogflow Live agent handoff fulfillment can be used.
The data that is shared at the fulfillment step is made available as part of the VirtualAgentProviderData variable of the Connect Virtual Agent Studio widget.

Please refer to the Connect Virtual Agent widget documentation for details on the other variables you can use. You can use these variables to populate the task attributes in the Send to Flex widget. They can be useful to route the incoming task accordingly or route to different workflows from Studio itself.

The above options allow for a lot of flexibility in terms of intelligent call routing that leverages the context provided by the Dialogflow CX Virtual Agent.

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!