Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Google Dialogflow CX Native Integration in Flex for Virtual Agents


Public Beta

This feature is currently available as a Public Beta product and information contained in this document is subject to change. This means that some of the features are not yet implemented and others may be changed before the product is declared as Generally Available. Public Beta products are not covered by a Twilio SLA.


Not a HIPAA Eligible Service

Virtual Agent for the Conversations channel is not a HIPAA Eligible Service and should not be used in Conversation or Flex workflows that are subject to HIPAA.

This guide outlines the native integration of Google Dialogflow CX with Flex. It uses the Twilio one-click integration for Google Dialogflow CX. With this integration, you can:

  • Hand off Virtual Agent calls and conversations to agents in Flex.
  • View call transcripts and message history between Virtual Agents and customers.
  • Pass relevant information from the Virtual Agent to Flex for routing.

The supported Conversations channels are SMS, Webchat 3.0, WhatsApp, Google Business Messages, and Facebook Messenger.


prerequisites page anchor
  • For the Voice channel, an active Flex account with Flex UI 2.2.0 or later. For supported Conversations channels, an active Twilio account with Flex UI 2.5.0 or later.
  • For the Voice channel, Native Dialpad configured on your Flex application .
  • Completion of the Dialogflow CX Onboarding guide. To ensure that the Virtual Agent transcripts are captured accurately, enable interaction logging in the Logging Settings of the Google Dialogflow CX Console.

    Enable Interaction Logging Google Dialogflow CX Console under Agent Settings.

If you would like to use the Voice channel or Conversations channels with the Connect Virtual Agent Widget for Flex, contact our support team(link takes you to an external page) for help enabling this Beta feature.

Connect Virtual Agent Widget

connect-virtual-agent-widget page anchor

Once the Dialogflow CX integration is complete, you can access the Connect Virtual Agent Widget in Twilio Studio.

This Widget connects Twilio Flex with Google's Dialogflow Virtual Agent. For an overview of transition events available for the Connect Virtual Agent Widget, see Connect Virtual Agent for Flex (Public Beta).


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.

For agents in Flex to handle calls or conversations from the Virtual Agent, the Connect Virtual Agent Widget needs to link to the Send to Flex Widget using the Live Agent Handoff transition.

Follow these steps to integrate Flex with Google Dialogflow CX:

Step 1: In the Google Dialogflow Console, set up live agent handoff fulfillment

step-1-in-the-google-dialogflow-console-set-up-live-agent-handoff-fulfillment page anchor

From the Google Dialogflow Console, ensure that the live agent handoff fulfillment is triggered by the Virtual Agent from the required flows to initiate the transition within Twilio Studio. This is the first step to ensure seamless routing of an ongoing call or conversation to an agent in Flex. For more details, check out Google's live agent handoff docs(link takes you to an external page).

Google Dialogflow CX Virtual Agent Live agent handoff fulfillment.


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: In Twilio Studio, connect Google Dialogflow CX with the Live Agent Handoff transition

step-2-in-twilio-studio-connect-google-dialogflow-cx-with-the-live-agent-handoff-transition page anchor

If the Virtual Agent is not able to fulfill the call or answer the conversation, Dialogflow CX allows you to escalate it to a live human agent.

If Google's Dialogflow CX Virtual Agent returns a live agent handoff response, it indicates that the call or conversation needs to be escalated to a human agent:

  • If you are using Twilio Studio's Connect Virtual Agent Widget, the Live Agent Handoff transition state is triggered.
  • If you are using TwiML, 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: In Twilio Studio, associate the Connect Virtual Agent Widget with the Send to Flex Widget

step-3-in-twilio-studio-associate-the-connect-virtual-agent-widget-with-the-send-to-flex-widget page anchor

Next, associate the Live Agent Handoff transition on 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 the appropriate Task Channel to route conversations. For Voice, select Voice as the Task Channel to route calls. For Conversations channels, select your messaging channel, such as Webchat or SMS, as the Task Channel to route incoming messages.

In the Attributes field, specify an attribute to send to Flex. For example, you could use the VirtualAgentProviderData from the Connect Virtual Agent Widget as follows:

{"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 Widget and Send to Flex Widget.

Step 4: In Twilio Console, configure a Conversations address or Voice phone number

step-4-in-twilio-console-configure-a-conversations-address-or-voice-phone-number page anchor

If you're using a Voice channel, see the Dialogflow CX Onboarding Guide to connect your phone number to the Studio flow that you created.

If you're using a Conversations channel, you need to connect your Conversations channel to the relevant Studio flow:

  1. In Twilio Console(link takes you to an external page) , from the Develop sidebar, select Flex > Manage > Messaging(link takes you to an external page) .
  2. From the Conversations Addresses tab, select your address type from the Filter by Address type list. If you need to add a new Conversations address, see Overview of Address Management to configure a new address.
  3. Click the pencil icon next to the address to edit it.
  4. Under Flex integration, from the Studio Flow list, select the Studio flow that you created earlier when integrating with Dialogflow CX.
  5. Click Update Address .

Availability of transcripts and message history

availability-of-transcripts-and-message-history page anchor

Once you complete the setup steps, Virtual Agent calls or conversations that are escalated to Flex also include call transcripts or message history. With this information, the agent is better equipped to help the customer, and the agent won't need to request information that's already been provided.

The call transcript or message history is only available for the portion of the call or conversation where the Dialogflow CX Virtual Agent is interacting with the customer. The transcript messages show both the Virtual Agent's responses and the customer's responses.

Call Transcripts in Flex UI for Dialogflow CX Voice Virtual Agent.

Sending data from Google Dialogflow CX to Flex

sending-data-from-google-dialogflow-cx-to-flex page anchor

To send additional information from Dialogflow CX Virtual Agent during the Live Agent handoff process, you can use the optional data section of the Dialogflow Live agent handoff fulfillment.

The data shared at the fulfillment step is available as part of the VirtualAgentProviderData variable of the Connect Virtual Agent Widget. Refer to Connect Virtual Agent Widget 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 and conversation routing that leverages the context provided by the Dialogflow CX Virtual Agent.

Rate this page: