DialogFlowLogo.PNG

Dialogflow Integrations

You can currently use the following integrations in Dialogflow: Facebook Messenger, Google Assistant, Phone Gateway, LINE and Slack.

By creating a Dialogflow Endpoint in Cognigy.AI, you can utilize the power of intents in an existing Dialogflow agent with a Flow in Cognigy.AI.

This tutorial covers the necessary steps for creating and connecting a Dialogflow Endpoint. If you want to get information about assigning a Flow to the Endpoint and setting up the Data Management see Endpoints.

Requires a Dialogflow Agent

This guide assumes that you already have a working Dialogflow Agent with intents in the Dialogflow console. If this is not the case, then you can follow this guide to create your first Dialogflow agent: Create and your first Dialogflow agent

The Dialogflow Agent needs to use the V2 API.

Two Step Preparation Process

1 Create a Dialogflow Endpoint in Cognigy.AI.
2 Integrate the Dialogflow Endpoint with your Dialogflow agent

1 Create a Dialogflow Endpoint

Location: Cognigy.AI

The first thing you need to do is to create a Dialogflow Endpoint in Cognigy.AI. In order to do this, navigate to the Endpoints menu in your agent. This is found under the Deploy sub-menu. Click on the + New Endpoint button at the top of the screen and select the Dialogflow Endpoint type.

dfImage.PNGFigure 1.1: Creating a Dialogflow Endpoint

After creating your Endpoint, you should be navigated to the Endpoint configuration of your Dialogflow Endpoint. Here you need to set the Flow that the Endpoint should point to, and you can change the NLU Connector of the Endpoint.

settings.PNGFigure 1.2: The Dialogflow Endpoint settings

1.1 NLU Connector

Per default, the Dialogflow Endpoint uses the NLU from the Dialogflow agent that you connect to the Endpoint, meaning that it will use the intents defined in your agent. You can override this behaviour by changing to another NLU Connector, either to use intents you have created in Cognigy.AI, or to use another external NLU Connector.

1.2 Reparsing Slots

If you open the Dialogflow Settings panel, you will see a setting called Reparse Slots. If this setting is enabled (disabled per default), then the text from Dialogflow will be reparsed with Cognigy.AI NLU in order to detect slots. This means that slots defined in any Cognigy.AI lexicon, which you have attached to your Flow, will also be detected along with the slots found by Dialogflow. If the setting is off, then you only get the slots found by Dialogflow.

Using the COGNIGY NLU Connector

If you choose Cognigy NLU as the NLU Connector, then the Reparse Slots setting will be disabled, since you are then always using Cognigy.AI NLU to parse the sentence and find Slots.

2 Integrate the Dialogflow Endpoint with your Dialogflow Agent

Location: Dialogflow Console

Requirements
✔ Endpoint URL

2.1 Configuring the Dialogflow Fulfillment

In order to connect your Dialogflow agent to your Dialogflow Endpoint, you first have to enable Webhooks in the Dialogflow console. Do this by going to your Dialogflow agent in the console, navigating to Fulfillment in the side menu and enabling Webhooks. After doing this, you need to copy the EndpointURL of your Dialogflow Endpoint and insert it into the URL of the Fulfillment Webhook. You can find the EndpointURL in your Dialogflow Endpoint in the Cognigy.AI User Interface.

0c78ce3-Screenshot_from_2018-08-21_18-20-04.png
Figure 2.1a: Configuring the Fulfillment in Dialogflow

2.2 Enabling Webhooks for your Intent

In order to actually send the request from Dialogflow to Cognigy.AI, you need to enable Webhooks for all of your intents in Dialogflow. You can do this by opening each intent in the Dialogflow console, scrolling down to the Fulfillment section and enabling the setting Enable webhook call for this intent. When this setting is enabled, Dialogflow will sent a request to your Dialogflow Endpoint when this intent is triggered.

b5b5497-Screenshot_from_2018-08-21_18-12-53.png
Figure 2.2a: Enabling Webhooks for an intent

2.3 Conversation Variations

There are two common approaches to handling conversations with Dialogflow. First, the user could start the Action by saying something like: "Ok Google, talk to my agent". Second, the user could directly trigger an intent with: "Ok Google, talk to my agent and book a hotel". For the first variation, one could use the default Welcome Intent Dialogflow provides after creating an action. The second one would need a handler on the Cognigy side.

Understand the Dialogflow Welcome Intent in Cognigy.AI

In order to get the best out of Cognigy.AI, you don't want to maintain intents in Cognigy.AI and Dialogflow. All intents should be defined inside your Cognigy Flow. Therefore, please define the Default Welcome Intent such as the following:

3398fd4-dialogflow-welcome-intent-config.png
Figure 2.3a: Dialogflow Default Welcome Intent Configuration

Use the Cognigy.AI response

Since you want to use the response which is defined in your Flow, you have to delete the Dialogflow default responses.

Furthermore, click on the GOOGLE ASSISTANT tab in the Responses section and toggle the button, so that it is on:

3816f4d-dialogflow-welcome-intent-responses-assistant.png
Figure 2.3b: Dialogflow Responses Configuration

Add the Dialogflow welcome text to your Cognigy intent

As soon as you start talking to your Google Assistant, it sends a specific user input text to your Cognigy Flow. Please add the following text to your Flow's welcome intent:

  • GOOGLE_ASSISTANT_WELCOME

Important

You have to add this example sentence to your welcome intent. Otherwise, this will not work.

Don't use the Google Welcome Intent

If you want to use more than just the welcome message as the start of your conversation, you have to delete the whole DialogFlow welcome intent. Thus, the message is directly forwarded to Cognigy NLU. When the user now starts the conversation with "Ok Google, talk to my agent", a so-called DATA_ONLY message is sent to the Cognigy Flow. Inside your Flow, this message needs to be handled in order to provide the Welcome message.

dataOnlyMessage.PNGFigure 2.3c: Cognigy IF Node to handle Google DATA_ONLY_MESSAGE

2.4 Testing the Dialogflow Endpoint

When you have created your Fulfillment and enabled Webhooks for your intents, you can test your Dialogflow Endpoint by sending a message in the chat in the Dialogflow console. When you use the chat in the Dialogflow console or the Web Demo Integration, then your userId in Cognigy.AI will be the project id of your Dialogflow agent, which you find in the agent settings.


Comments

0 comments

Please sign in to leave a comment.

Was this article helpful?
0 out of 0 found this helpful