Engage Digital | Configuring Dialogflow integration

Last updated on June 30, 2022

Table of contents

Now that you have configured and connected Engage Digital and Google Dialogflow, you’ll need to use the Engage Adapter App to configure the remaining integration settings. The Engage Adapter App allows you to configure a virtual agent that handles conversations and handover rules in Google Dialogflow. The virtual agent in the Engage Adapter App specifies an associated chatbot agent from Google Dialogflow, which allows you to use the chatbot agent’s configuration settings.
RingCentral Engage Digital Google Dialogflow adapter Create virtual agent page

Virtual agents and mega agents

Google supports the combination of multiple Dialogflow agents, called sub-agents, into a single agent called a mega agent. When you perform a ‘detect intent’ request against a mega agent, the mega agent considers the responses from all sub-agents and selects the best one. The main benefits of this functionality are:
  • Better governance: If you have multiple teams building an agent, each team can be responsible for one sub-agent, which simplifies change conflicts across teams.
  • More intents: If you have agents with a large number of intents, you may approach the intent count limit. In this case, you can combine multiple sub-agents with one mega agent.

Configuring a virtual agent

  1. Access the Engage Adapter App.
  2. Log in using your RingCentral admin account.
  3. Click Add a virtual agent.
  4. Enter a name for the virtual agent.
  5. (Optional) Enter an Output context.
  6. Select an agent from the Choose a Dialogflow agent menu.
  7. Check the Is Mega Agent box if you want this agent to be a mega agent.
  8. If configuring a mega agent, complete the Project Id field. Add more project handles as needed.
  9. Select a category to listen to. It must be a skill category accessible by your Engage user.
  10. In Select sources to listen to, check the boxes for the channels to listen to.
  11. Select a Backup Engage category.  
  12. (Optional) Specify a fallback message for the user.
  13. Check if you want to Allow messages longer than 256 characters.
  14. Click Save & Activate.

Virtual agents configuration settings

  • Name of this virtual agent: A name used only in this application. For example, “Greeter bot.”
  • Output context: Sent as an input context to Dialogflow with each message. (Supported only in Dialogflow ES.)

    Note: For a mega agent, you can configure different output contexts for each sub-agent, but it's possible to configure only one per agent. 
  • Choose a Dialogflow agent: Select one of the Dialogflow agents available to you. All Dialogflow agents should be using API v2.
  • Is Mega Agent: Indicates that the agent will be a mega agent.
  • Project Id: Specifies the sub-agent project ID to add to the mega agent.
  • Select a RingCentral Engage category to listen to: A category to be used exclusively with this integration. It must be a skill category that your Engage user can access. Your bot will listen only to messages that you place in this category. 
  • Select sources to listen to: Select the channels that your virtual agent will use.
    • Notes: 
      •  ▪ You may not use channels that other virtual agents are using.
      •  ▪ You’ll need to ensure that your API key can access specified channels.
  • Backup Engage category: Select the category that you’ll use exclusively for fallback recategorization. If the bot fails, the specified category will be attached to the message thread.
  • Fallback message to be sent: Select the fallback notification message to send to the user if the bot fails.
  • Allow messages longer than 256 characters: Dialogflow prevents replies longer than 256 characters. If you send a message that exceeds this limit, the integration will send a fallback message by default. When this flag is checked, the integration will truncate your message at 256 characters and send it to DialogFlow.
  • Save & Activate: Saves the configuration settings and activates the virtual agent.
  • Remove this virtual agent: Removes the virtual agent. This option will appear only when the virtual agent has been saved and activated.
RingCentral Engage Digital Google Dialogflow adapter virtual agent handover rules page

Configuring virtual agent handover rules for Google Dialogflow ES agents

  1. Access the Engage Adapter App.
  2. Log in using your RingCentral admin account.
  3. Click on the virtual agent’s name to edit it.
  4. Select the Handover Rules tab. 
  5. Add the handoff value to the output context fields and match it with categories.
  6. Click Save.

Configuring virtual agent handover rules for Google Dialogflow CX agents

Virtual agent handover rules determine how a virtual agent hands over a conversation to a human agent. Note that these steps apply only to Google Dialogflow CX. Configuring the Live agent handoff in Dialogflow CX allows the virtual agent handover rules to be configured.
Google Dialogflow CX virtual agent fulfillment live handoff configuration page

Adding a live agent handoff dialog option in Google Dialogflow

  1. Access the Google Dialogflow CX console.
  2. Log in using your Google account and create a project. Read about Dialogflow CX Setup  for more information.
  3. Go back to the console and select the project you’ve created.
  4. Click Create agent. Read about building an agent for more information.
  5. Create a flow for the agent. Read about flows for more information.
  6. On the Build page, click the Add page plus sign icon in the Pages section. Enter a name for the page.
  7. Hover over the newly created page, then click the More icon that appears at the far right. Click Edit
  8. Click Edit fulfillment in the Page configuration panel on the right side of the page.
  9. Click Add dialogue option. 
  10. Click Live agent handoff.
  11. Add a dialog option in the Live agent handoff text box. The key must be ‘name’; the value can be any text. For example:
{
   "name": "transfer_to_support"
}
 
  1. Click Save.
View of adding a live agent handoff dialog option in Google Dialogflow

Editing the virtual agent handover rules

  1. Access the Engage Adapter App.
  2. Log in using your RingCentral admin account.
  3. Edit the virtual agent.
  4. Select the Handover Rules tab. 
  5. Add the handoff value to the output context fields and match it with categories.
  6. Click Save.

Handover configuration settings for virtual agents

  • If encounter this Google Dialogflow Output Context: An output context that triggers a handover.
  • Handover to the following Engage Category (Skill): An Engage Digital category that is assigned.
  • Add plus icon: Add an additional handover rule.
  • Delete trash icon: Remove a handover rule.

Intent response logic

Intents have a built-in response handler that can return responses after the intent is matched. You can configure intent responses using the tabs in the Responses menu in the Intents page.
 
This integration supports the following logic:
  • If there is a payload from the platform-specific tab, the payload from this tab is taken into account, and the text from the default tab is ignored.
  • If there are several payloads from the different platform-specific tabs, including Facebook, the payload from the Facebook tab is taken into account, and all other tabs are ignored.
  • If there are several payloads from the different platform-specific tabs, excluding Facebook, all tabs are ignored.
  • Otherwise, the payload from the default tab is taken into account.
The toggle ‘Use responses from the DEFAULT tab as the first responses’ should be disabled.

Setting up structured messages

If an Engage Digital channel supports structured messages, the adapter can convert Google Dialogflow structured messages to Engage Digital structured messages. An example of a channel that supports structured messages is Engage Messaging, where structured messages are supported for all device types. Structured messages are supported only by Dialogflow ES.
 
To use structured messages in Google Dialogflow:
  1. Access the Google Dialogflow console.
  2. Log in using your Google account.
  3. Go to the Intents page. 
  4. Select an existing intent.
  5. Expand the Responses menu. 
  6. Click the plus icon. From the dropdown, add a new messenger for integration.
  7. Disable the Use responses from the DEFAULT tab as the first responses toggle setting.
  8. Click Add Responses.
  9. Depending on the messaging channel, add Quick Replies or Card as a response.
  10. Enter the configuration information for the quick reply or card.

Structured message types

The structured message integration supports these structured message types:
  • Quick replies
  • Templates
  • Carousels
  • Custom payload

Quick reply

A quick reply is a suggested user response. When a user taps a quick reply, the agent receives the text as a user query. This response allows you to send a pre-configured text to Dialogflow.
 
Note: The following constraints apply when using Quick replies:
  • Dialogflow Quick reply type responses must contain a title and text.
  • Only one Quick reply should be configured for each intent.

Cards (Templates)

A Card may contain several elements, such as image, title, subtitle, and clickable button. The adapter will convert a Card type response to a Template if there is only one card in the intent.
 
Note: The following constraints apply when implementing a template:
  • A Card type response must contain a title and at least one button. All other fields are optional.
  • The adapter will upload an image to Engage Digital.
  • Any buttons with empty ‘URL’ or ‘text postback’ fields will be converted to buttons with empty payloads.
  • A button with text postback will be converted to a button with a payload. The payload will be filled with the text postback, which can send an event to your postback webhook. This is useful when you want to invoke an action in your bot.
  • A button with a URL will be converted to a link.

Cards (Carousels)

A Carousel is an array of Template types. The adapter will convert a response to a Carousel if it contains several cards. Each card will be one member of the Carousel.
 
Note: The above constraints on Templates also apply to Carousels.

Custom payload

Using a custom payload allows overriding the DialogFlow limitation for the number of characters in structured messages for ES version and provides support for structured messages in DialogFlow CX. You can set up a custom payload on any response tab, so long as you abide by the limitations detailed in Intent Response Logic.

Quick replies

 Field in custom     payload
Description
Example
title
The select structured message body
{
 "quickReplies": {
 "title": "this is the body of the quick replies",
 "quickReplies": [
   "option1",
   "option2",
   "option3",
   "option4",
   "option5"
   ]
  }
}
quickReplies Payload of the structured message

Template/card

Field in custom payload
Description
Example
title
Title of the template
{
  "card": {
    "imageUri": "https://www.planetware.com/wpimages/2020/01/india-in-pictures-beautiful-places-to-photograph-taj-mahal.jpg",
    "buttons": [
      {
        "text": "button1"
      },
      {
        "text": "button2"
      },
      {
        "postback": "http://ringcentral.com/",
        "text": "button3"
      },
      {
        "text": "button4"
      }
    ],
    "title": "Title of the template",
    "subtitle": "Subtitle of the template"
  }
}
subtitle
Subtitle of the template
imageUri
The URL to the attachment used to decorate the template with an image
buttons.text
The title of the item (button)
buttons.postback
URL if you want to open website when clicking on the button
 

Carousel as a custom payload

Several cards are considered as a carousel on the Engage Digital side. The structure of the payload is the same as for the template.

The limitations for each field are described on developers.ringcentral.com in the corresponding sections.

Webview

The webview is a convenient way of opening a custom-made webpage. You can choose it by setting the optional target parameter to ‘webview’ when sending a structured message that contains a link element, such as a Template or a Carousel.
 
Note: The webview feature is intended to be customizable, so it will not work “out of the box.” No default picker or page has been provided. Neither does the webview feature include any pre-selected response that customers will see upon completing their actions on the page.
  Field
Description
Example
target
Possible options: webview, current, open
{"card":
 {
  "imageUri": "https://www.planetware.com/wpimages/2020/01/india-in-pictures-beautiful-places-to-photograph-taj-mahal.jpg",
  "buttons": [
   {
    "postback": "https://context.reverso.net/translation/",
    "text": "button1",
    "target": "webview",
    "webview_height": "full"
   },
   {
    "text": "button2"
   },
   {
    "postback": "http://ringcentral.com/",
    "text": "button3"
   }],
    "title": "Title of the template",
    "subtitle": "Subtitle of the template",
    "target": "webview"
 }
}
webview_height Possible options: full, tall, compact

Passing customer images to Google Dialogflow

When a customer sends an image, you can pass the image to Google Dialogflow so it can be processed by third-party APIs, such as Google Vision. Passing images is available only for Engage Messaging and Engage Chat channels. For other channels, the integration will execute fallback rules.
 
This feature only supports images. This logic won't process videos, documents, or other files.
 
To pass images to Google Dialogflow, use the following parameters:
  • ed_data_image_urls: An array of image URLs.
  • ed_has_attachment: Context passed to explicitly match to intents that can process images (ES only).
  • original_body: Text message if the end-user message contains text and image.
Any text sent along with images will contain only ‘ed_image_attached’. For this reason, the intent that will  process the image should use this phrase as training data. 
 
© 1999-2022 RingCentral, Inc. All rights reserved.
Thanks!
We've sent you a link, please check your phone!
Please allow a full minute between phone number submissions.
There was an issue with SMS sending. Please try again. If the issue persists, please contact support.