Integrate Google Dialogflow CX

Before completing the tasks on this page, be sure that the prerequisites for the integration have been met.

Create a Script

Required permissions: Studio Script View, Create/Edit

You need at least one Studio script to route interactions to your virtual agent. Follow the script guidelines and requirements. Your script must have the phone media typeClosed A medium, such as voice, email, and chat, through which a contact connects with an intended recipient. for a voice virtual agent or the digital media type for a text virtual agent. The supported virtual agent actions for this provider are:

If you're using a SIPClosed Protocol used for signaling and controlling multimedia communication sessions such as voice and video calls. backchannel connection with your virtual agent, contact your CXone Account Representative.

You can learn more about Studio scripting in the Fundamentals and Technical Reference Guide sections of the online help.

When your virtual agent is ready to go into production, assign the script to one or more points of contact.

Custom Payload Best Practices

Follow these best practices when integrating custom payload data from Google Dialogflow CX into CXone

  • Dialogflow CX doesn't use contexts to pass data to Dialogflow intentsClosed The meaning or purpose behind what a contact says/types; what the contact wants to communicate or accomplish like Dialogflow ES does.
  • You can pass custom data to Dialogflow CX using JSON key-value pairs. In a Snippet action in your script, create a dynamic customPayload object and add the key-value pairs to it. For example:

    DYNAMIC customPayload
    customPayload.ani = ani
    customPayload.contactID = contactId
    customPayload.masterContactId = masterId
    customPayloadJSON = "{customPayload.asJSON()}"	
  • In the Exchange or Conversation action in your script, configure the customPayload property with variable that has the asJSON() function in its value. You can find this variable in the customPayload object.
  • Pass the customPayload JSON to the virtual agent using the Payload property of QueryParameters. See Google documentation on QueryParameters A square with an arrow pointing from the center out from the top right corner. for Google Dialogflow CX.
  • Data passed through QueryParameters is received by a webhook in Dialogflow CX. You can write code in the Dialogflow CX console to handle the passed data.
  • Do not nest an object within the customPayload object. Nested objects are sent as literal strings.
  • To pass custom data from your Dialogflow CX virtual agent back to the script, use the Custom Payload field in the Dialogflow CX console. Make sure you're in the console for the virtual agent you're using with CXone. Map this to your script using the customPayloadVarName (out) variable in the voice or chat Studio action in your script. For example, you can use this to set the next prompt's behaviors.
  • Parameters set using customPayload can only be used in the external webhook. If you want to set parameters for use outside the external webhook, set them in a Snippet action with the session_params field. For example:

    {
    	"session_params":
    	{ 
    		"name": "Winnie Le Pooh"
    		"job": "Food critic"
    		"location": "Hundred Acre Wood"
    	}
    }

    Access the session parameters in the Dialogflow CX agent intent using the following syntax:

    $session.params.name = Winnie Le Pooh

    $session.params.job = Food critic

    $session.params.location = 100 Acre Wood

    Session parameters are only used with Dialogflow CX virtual agents. To achieve a similar result with Dialogflow ES, use contexts.

  • Speech context hints can be passed with custom payload in the speechContexts parameter. The value of speechContexts.phrases must be a Google class token A square with an arrow pointing from the center to the upper right corner. for the hint you want to give. The token must match the language and locale of your contacts. For example:

    DYNAMIC customPayload
    customPayload.speechContexts.phrases="$OOV_CLASS_ALPHANUMERIC_SEQUENCE"
    customPayload.speechContexts.boost=10		
  • When using VOICEBOT EXCHANGETo configure how long the virtual agent waits when the contact pauses while speaking, add the maxPostEnergySilenceMS parameter to the Next Prompt Behaviorsor Default Next Prompt Behaviors Snippet action.

Add an App to Virtual Agent Hub

Required permissions: Automation & AI > Launch Automation & AI

Adding a configuration app to Virtual Agent Hub establishes the connection between CXone and your virtual agent provider.

If you're using a SIPClosed Protocol used for signaling and controlling multimedia communication sessions such as voice and video calls. backchannel connection with your virtual agent, follow the steps for setting up this kind of connection.

  1. In CXone, click the app selector and select Other > Automation & AI and then click Virtual Agent Hub. You can also double-click the virtual agent action in your Studio script to launch Virtual Agent Hub.
  2. Click Add Bot.
  3. Enter a Virtual Agent (Bot) Name and click Google Dialogflow CX in the list of virtual agent providers.

  4. Click Next.

  5. Complete the fields in the configuration form and click Next. You can find details about this form in the Configuration Page Details section on this page.

  6. Click Next.

  7. If you're setting up a text virtual agent, select Text Only (No Voice Support) on the Voice page. If you're setting up a voice virtual agent, see the Configure Voice Integration Options section on this page.

  8. Click Next.

  9. On the Transcript page, select the option for whether you want the conversation transcript and intent information captured. This option is only available for text virtual agents and utterance-based voice virtual agents. It's not supported for voice integrations that use an SIPClosed Protocol used for signaling and controlling multimedia communication sessions such as voice and video calls. backchannel connection.

  10. Click Next.

  11. On the Test + Add page, you can test your bot's connection by sending voice or text prompts. If your test messages don't work, click Back to return to the Configuration page and verify the settings. You may also need to verify configurations in your virtual agent provider's management console.

  12. Click Add.

Google Dialogflow CX Configuration Page Details

Use the information in the following table when completing the Configuration page. You see this page when adding an app in Virtual Agent Hub

If you're setting up Dialogflow CX to use a SIPClosed Protocol used for signaling and controlling multimedia communication sessions such as voice and video calls. backchannel connection, follow the steps for setting up the connection instead of the steps in this section.

Field

Details

Integration Version

Select the version of Virtual Agent Hub that you want to use. This option allows you to use a previous version of Virtual Agent Hub until you're ready to switch to a newly-released version. The available versions are: 

  • Version 1.0.0This is the first version of Virtual Agent Hub. The custom payload object returns as customPayload.payload.xxxx.
  • Version 2.0.0This version updated the schemas used with Google Dialogflow CX. This impacts the structure of the customPayload object.
  • Version 3.0.0: This version introduced StandardBot, which standardizes how CXone communicates with virtual agent providers. The customPayload object returns as an array, as customPayloadscriptPayloads[n].xxxx. This version is available for all providers.
SIP Configured Click if you want to use a SIP backchannel connection with this virtual agent. Setting up a SIP backchannel connection is a separate process.
JSON Service Account

The service account key file you created and downloaded from your Google Cloud Console. Copy and paste the entire contents of the key file into this field, including the curly braces surrounding the key. This field is visible only if you're using your own Google Dialogflow CX account.

The service account key is a JSON object similar to the following example:

{

"type": "service_account",
"project_id": "ic-demo2-aai-gcp",
"private_key_id": "sdv80sdf08ssd9sdf0sdf8sdfsdf90sdf8",
"private_key": "-----BEGIN PRIVATE KEY-----
nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCzgrS8vp
<private key has been truncated for this example>
----END PRIVATE KEY-----\n",
"client_email": "your@client_email-gcp.iam.gserviceaccount.com",
"client_id": "123456789",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/dialogflow-dthjop%40ic-demo2-aai-gcp.iam.gserviceaccount.com"
}

The JSON Service Account must have the Dialogflow API Admin roleA square with an arrow point from the center out to the upper right corner..

Language

The language you want this virtual agent to use. This is the language that the virtual agent understands. This is a required field.

Region The region where the Google Dialogflow CX virtual agent you're adding to Virtual Agent Hub is located. This is a required field.
Agent The name of the Google Dialogflow CX virtual agent you want to add to Virtual Agent Hub. You can find the name in the virtual agent's Dialogflow CX console and click Copy Name to copy it to the clipboard. This is a required field.
Environment Enter the GUID of the environment you want this Dialogflow app to use. In Dialogflow CX, different versions of the same virtual agent are called environments. You can find the GUID for your environments in the Google Dialogflow CX console in the agent settings.
Perform Output TTS

Click the slider to On if you want to use the Google Dialogflow CX text-to-speech (TTSClosed Allows users to enter recorded prompts as text and use a computer-generated voice to speak the content.) service. Configure the TTS output settings.

If you don't to use the Google TTS service, you can use CXone Cloud TTS Hub. You configure this option on the Voice page of the configuration app wizard.

Timeout Event Handler Name of the Google Dialogflow CX event you want to trigger on timeout.
DTMF Break Out Pattern If the specified characters are pressed, the script skips straight to the OnDTMFBreakout branch.
External Provider Timeout

Enter the number of seconds you want the script to wait for a response from Dialogflow CX . When the timeout is reached, control returns to the script, which takes the error branch.

Configure Google Dialogflow CX TTS Output

Required permissions: Automation & AI > Launch Automation & AI

Complete the steps in this section if you want to use the Google TTS service. The fields in the following image appear when you enable the Perform Output TTS option on the Dialogflow CX Configuration page in Virtual Agent Hub.

  1. In Virtual Agent Hub, add a new configuration app and configure it according to the steps in Add an App to Virtual Agent Hub section on this page.
  2. EnablePerform Output TTS.
  3. To use a custom voice model, enable Use Custom Voice and enter the name of the AutoML model you want to use in the Custom Voice Model field.

  4. If you want to use a Google voice model, select the TTS Voice Name from the drop-down.

  5. Select the machine learning Model and Model Variant that you want the Google TTS services to use when synthesizing speech.

  6. To add silence to the start of the virtual agent's audio response, enter the number of milliseconds of silence to add in the Add Leading Silence field. The recommended amount of silence is 500 milliseconds.

  7. Enter the Speaking Rate, Pitch, and Volume Gain to configure how you want the TTS voice to sound.

  8. Return to the Add an App to Virtual Agent Hub section  on this page to finish adding the configuration app.

Configure Voice Integration Options

Required permissions: Automation & AI > Launch Automation & AI

If you're setting up a text virtual agent, you can skip this section. If you're using a SIP backchannel connection with your voice virtual agent, follow the steps for setting up SIP Backchannel instead.

  1. In Virtual Agent Hub, add a new configuration app and configure it according to the steps in the Add an App to Virtual Agent Hub section  on this page.
  2. Click Next on the Configuration page.

  3. On the Voice page under Voice Integration Options, select Turn by Turn Control (CXone Voice Bot Gateway).
  4. Under Text to Speech Options, select Use CXone Cloud TTS if you want to use the CXone TTS option. To use the virtual agent provider's TTS service instead, clear this checkbox and configure TTS output on the Configuration page of the wizard.

    If the form won't allow you to select Use CXone Cloud TTS, click Back to return to the Configuration page. Click the Perform Output TTS slider to Off. You can now enable Cloud TTS Hub on the Voice page.

  5. Select a TTS Vendor, if you're using Cloud TTS Hub. If you're using your virtual agent provider's TTS service, this field is not visible and you can skip this step.
  6. Under Transcription Options, select the option for the transcription service you want to use.

  7. If you choose to use a CXone transcription profile, click Transcription Profile to select the one you want to use. Click Add New Turn by Turn Transcription Profile to create a new profile.
  8. Click Next.
  9. Return to the Add an App to Virtual Agent Hub section  on this page to finish adding the configuration app.

Assign the Google Dialogflow CX App to an Action

Required permissions: Studio Script View, Create/Edit

When the virtual agentClosed The meaning or purpose behind what a contact says/types; what the contact wants to communicate or accomplish app is set up and configured in Virtual Agent Hub, you need to assign it to the virtual agent action in your script. This connects the action and the script to your virtual agent provider.

  1. In Studio, open the script you want to modify.
  2. If you haven't done so already, click the Tools tab, expand the Automation and AI category, and add the virtual agent action you want to use. Be sure to put it in the correct location in your script. If you don't see the action you expect, verify that your script media type is correct. For example, if you're creating a script for a voice virtual agent, the script must be a phone script.

  3. Double-click the action to open Virtual Agent Hub.

  4. In the left column, locate the virtual agent that you want to assign to the action and click the checkmark An icon of a circle with a checkmark inside. next to it.
  5. Click Close.

Change the Transcription Profile

Required permissions: Automation & AI > Launch Automation & AI

A transcription profile allows you to use a different transcription service from the one the virtual agent provider offers. Each virtual agent can have one transcription profile. You only need to follow the steps in this section if you are working with a voice virtual agent and need to change the transcription profile.

  1. In CXone, click the app selector and select Other > Automation & AI and then click Virtual Agent Hub. You can also double-click the virtual agent action in your Studio script to launch Virtual Agent Hub.
  2. In the list of virtual agent configuration apps on the left side of the Virtual Agent Hub page, click the one you want to modify.
  3. In the center of the virtual agent app properties page, click the Voice tab.
  4. Under Transcription Options, select Use CXone transcription Profile if it isn't already selected.

  5. Select the Turn by Turn Transcription Profile you want this virtual agent integration to use. If the option you want to use isn't there, you can add it.

  6. Click Save.
  7. Test your transcription service by using the microphone option in the Test section of your virtual agent app properties page.

Test Your Virtual Agent

Required permissions: Automation & AI > Launch Automation & AI

You can test many aspects of your virtual agent to make sure everything works as intended. You can run tests from the virtual agent app's properties page in Virtual Agent Hub. When testing, you can: 

  • Verify that the virtual agent app is correctly configured to communicate with the virtual agent provider.
  • Add custom payload JSON to test the virtual agent's handling of custom payload data.
  • Trigger a welcome intent event to test how the virtual agent begins a conversation.
  • Trigger a custom intent event to test any custom events you've created for your virtual agent.
  • Trigger a timeout event to test how the virtual agent responds when the contact times out.
  • Test how the virtual agent handles DTMFClosed Signaling tones that are generated when a user presses or taps a key on their telephone keypad. input.

The following image is an example of the properties page for a virtual agent app in Virtual Agent Hub. It shows the Configuration and Voice tabs and the Test pane.

  1. In CXone, click the app selector and select Other > Automation & AI and then click Virtual Agent Hub. You can also double-click the virtual agent action in your Studio script to launch Virtual Agent Hub.
  2. Click to select the configuration app for the virtual agent you want to test from the list on the left.
  3. In the Test pane, enter a test message in the Type a message field and press Enter to send it. You can also click Microphone An icon shaped like a microphone. and speak into your computer's microphone.

  4. Click Start with welcome intent to start a test conversation from the beginning. The virtual agent responds with its default welcome message. You can enter test messages.
  5. Click More Options An icon with three dots stacked vertically. to test other aspects of your virtual agent.

  6. Click Reset to start your test again.
  7. If you need to make changes based on the results of your testing, you can: 

    • Modify the Studio scripts for the virtual agent.
    • Modify the configuration settings in the virtual agent's app in Virtual Agent Hub.
    • Modify the virtual agent's configuration settings in the provider's console. Click the large square button on the app properties page in Virtual Agent Hub. The example at the beginning of this section shows the Google Dialogflow CX app with the provider button. It has the An icon that has a square with an arrow overlaid on top of it. The arrow points from the center of the square to the top right corner of the square. icon on it to indicate that the link opens an external site.
  8. Test the virtual agent thoroughly after each change to your scripts or any configuration settings.
  9. When you're finished testing, click Close.