Rate this page:

Dialogflow CX Onboarding Guide

Twilio’s Dialogflow CX Connector is a native telephony integration with Google Dialogflow CX aimed at enterprises with medium to large sized contact centers. Through this integration, Twilio enables customer applications with rich conversational AI experiences.

This guide walks through the process of integrating your Twilio application with your Google Dialogflow CX virtual agent.


These prerequisite steps are required prior to starting the one-click integration:

Set up your Google Dialogflow CX agent

Check out Google's Dialogflow CX setup documentation on how to start using Dialogflow in Google Cloud.

Grant Twilio Permissions to access your Dialogflow CX agent

This one-time manual step is required prior to initiating one-click integration. You will need to provide Twilio’s production service account permission to run your Dialogflow agent:

Log in to the Twilio Console

Before performing the one-click integration with Google Dialogflow, you should be signed into the Twilio Console and logged into the account or sub-account you wish to use with your Dialogflow CX agent integration.

Connect Twilio to your Dialogflow CX Agent with the one-click integration

Once you have completed the prerequisite steps, you are ready to use the one-click integration to connect your Twilio Dialogflow CX Connector to your desired Dialogflow CX agent.

Configuration steps within the Google Cloud Console

  1. Log in to your Google Dialogflow CX cloud console and click Manage on the left navigation bar
  2. Select Integrations from the Manage menu
  3. Under the One-click Telephony options, select Twilio
    Twilio under the One-click telephony integrations in the Dialogflow CX agent Manage console
  4. In the modal pop-up, give your integration a new name, select the Environment and Language for your Dialogflow CX agent, and click Add. This will start the integration process and launch the Twilio Console page.

Configuration steps in the Twilio Console

Make sure you have granted Twilio access to Google Dialogflow CX. If you have not, you will be redirected back to Google with an authentication error.

After you have completed the steps above in the Google Cloud Console, you'll be taken to the Twilio Console to finish the Dialogflow integration. You will see the Dialogflow CX one-click integration page that has the Dialogflow CX Connector with some pre-populated values:

Dialogflow CX Connector page in Twilio Console

Complete the Connector configuration by providing the following values:

  • Connector Friendly Name: the unique name of the Connector. You will use this name to identify the connector in Twilio Studio or using TwiML.
    • Give the Connector a friendly name, say, “Dialogflow_CX_Test1”
  • Status Callback URL (optional): the URL to your endpoint where you want Twilio to send requests on call status, intents triggered, sentiment scores, agent-caller text, etc.
    • For the purpose of this tutorial, we can link it to Twilio Functions
  • Welcome Intent Friendly Name: the name of the Dialogflow CX agent welcome intent you want to trigger when connecting the caller to agent.
    • If you do not have a custom welcome intent, you can use the system generated default welcome intent called WELCOME. This default intent can be edited as desired within the Dialogflow CX agent configuration.
  • Bot Voice: indicates the Text-To-Speech voice to use when synthesizing audio responses from the bot. Check out Google’s documentation on the list of voices currently supported for Dialogflow.
  • Sentiment Analysis: when set to ON, Dialogflow will perform sentiment analysis on the end user input and sentiment scores will be relayed in the status callbacks.

Once you have configured the Connector with all the details, click Next.

You will then see a "Review Information" screen prompting you to review the Connector configuration. If something is incorrect, you can click on Previous to update the connector setting. If the configuration looks correct, click on Confirm Configuration Details.

Dialogflow CX connector confirmation window

You will see a modal pop-up asking for your consent to connect your Twilio Connector to your Dialogflow CX agent.

You can abandon the set-up by clicking on X at the top right corner of the modal pop-up or closing your browser tab.

Click on Agree and connect to Google to finish the integration setup.

Dialogflow CX Connector consent dialogue

Your Dialogflow CX integration is now complete! You can see the completed Connector instance under the Dialogflow CX Connectors in the Twilio Console.

Develop your application with the Dialogflow CX agent integration

Once you've completed the Dialogflow CX integration with Twilio, you can send a Twilio call to your Dialogflow CX agent in two ways: using the Twilio Studio Connect Virtual Agent Widget, or TwiML <VirtualAgent> noun.

Connect Virtual Agent Widget and Twilio Studio

When you complete the integration, Twilio automatically creates a new Studio Flow with a Connect Virtual Agent Widget in it.

Connect Virtual Agent Widget (for Dialogflow CX)

You can find this new Flow in your Studio Flows dashboard. It will have the name that you provided for the "Connector Friendly Name" field when configuring the Connector.

The Connect Virtual Agent Widget will be pre-configured with the settings you provided during the Connector setup. You can add additional customizations to the Widget, such as passing in additional parameters that you would like to pass from Twilio to the Dialogflow agent.

See the Connect Virtual Agent Widget documentation to learn more about the available parameters.

You can add other Widgets to the Studio Flow to control what happens before and after the Twilio call. For example, if a call with Dialogflow CX agent ends with a Live Agent Handoff transition, you could add a Connect Call To Widget to connect the caller to a live agent's phone.

Configure a Twilio number to connect to your Virtual Agent Studio Flow

Once you’re happy with your Flow and you've published all changes, you can connect it to a Twilio Number so people can start interacting with it.

Navigate to the Active Numbers section of the Twilio Console and click on the number you’d like to connect to the Flow. (If you do not have any phone numbers, you can purchase one from the Console.)

After clicking on the number, you will see its configuration menu where you can connect the number to your Studio Flow.

To configure this number to trigger your Studio Flow from an Incoming Call, scroll down to the Voice & Fax section of the configuration menu. Under Configure With, select the dropdown option "Webhook, TwiML Bin, Function, Studio Flow, Proxy Service". Then, under A Call Comes In, select the dropdown option "Studio Flow". You'll see another dropdown menu appear where you can select the Studio Flow you'd like to connect to when a call comes in to this number.

Configure a Studio Flow to connect to a Voice number

Choose the Flow you'd like to connect the number to, and then press Save to save these changes. Your Flow is now connected to your Twilio number!

<VirtualAgent> TwiML noun

You can also use the integration to your Dialogflow CX agent programmatically with the TwiML <VirtualAgent> noun.

New to using TwiML? Check out this overview of what TwiML is and how to use it to handle Twilio Voice calls.

You can use one of Twilio's helper libraries to generate TwiML. Below is an example of code you to connect a call to your Dialogflow CX agent using TwiML:

Loading Code Sample...

        Connect a Programmable Voice call to a Dialogflow CX agent

        See the <VirtualAgent> documentation for more information about how to use this TwiML noun.

        Support for Dialogflow CX features

        Native welcome intent

        When you configure the Dialogflow CX Connector within Twilio, you can specify a welcome intent. When Twilio connects a call to your Dialogflow CX agent, this welcome intent will trigger (for example, saying "Hello" to the caller before they start speaking). You can use the Dialogflow CX agent's default welcome intent called "WELCOME" and configure it in your Dialogflow CX Connector. You can edit this default welcome intent within Dialogflow.

        Custom agent parameters

        You can pass custom parameters to the Dialogflow CX agent either within the Connect Virtual Agent Studio Widget or from the <VirtualAgent> TwiML noun. You can also configure parameters in your agent’s setting in the Google Cloud console.

        End the conversation with an agent

        In your Dialogflow CX console, you can set the transition target for an intent to "End" to indicate that the conversation with the agent should end after a particular virtual agent response. For more information, check out the Google docs.

        If you are using TwiML and the virtual agent ends the conversation because an intent matches the "end of the conversation" intent indicating the call completed successfully, the VirtualAgentStatus field in the request to your action URL is set to completed. This will execute the next TwiML in your application by using the action parameter, or the next TwiML step <Connect> verb.

        If you are using Connect Virtual Agent Studio Widget and the virtual agent ends the conversation because an intent matches the “end of the conversation” intent, the Completed transition state is triggered.

        Live Agent Hand-off

        If the virtual agent was not able to fulfill the call, Dialogflow CX now 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.

        For more details on how to enable the live agent handoff inside the agent fulfillment within your Dialogflow CX console, check out Google docs.

        If you are using TwiML and the Dialogflow CX 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 Connect Virtual Agent Studio widget and the Dialogflow CX 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..


        You can enable Barge-in within Dialogflow CX agents, which allows callers to interrupt the virtual agent anytime. If barge-in is enabled and a caller starts speaking in the middle of the agent's response, Dialogflow will stop sending audio to the caller and process the caller’s next input.

        For more details on how to turn on the barge-in feature, check out these Google docs.

        DTMF Support

        In addition to speech input, an end user can provide a DTMF (Dual-tone multi-frequency signaling) input through their telephone keypad. You can configure DTMF for a parameter in your Google Dialogflow CX console. Once enabled, your customer can use their telephone keypad to provide parameter values for an agent using a telephony integration.


        We are looking forward to hearing from you! Please reach out to your Twilio Account Manager or contact our Sales Team. We’re looking for feedback on:

        • Developer experience
        • Level of configurability
        • Status callbacks
        • Ease of transferring control of the call back to Twilio (to execute the next TwiML)
        • Regional implications
        • Applicable use cases
        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!