Table of Contents

Integrations > Dialogflow Block

Pau Sanchez Updated by Pau Sanchez

Feature only available for Professional and Enterprise accounts

Prefer watching than reading? No problem, we've got you covered πŸ‘‡

For Landbot (Web)

Dialogflow block allows you to use Google's powerful Dialogflow Natural Language Processing engine. Among many things you can do, the main goal is to let the bot understand phrases that your bot visitors are using, as long as they are already trained in your Dialogflow agent.

For more information about how Dialogflow works, please check Dialogflow Google's official documentation

Regular set up of Dialogflow block in the builder

There are different set ups for each of the different outputs. You might use conditions or set variables, but the one below is the most common to cover all the cases:

  • We start with a Text type of question, that we will store in a variable called @dfinput
  • Then we use that variable as the "Variable to send"

  • We set up the block to store the speech from Dialogflow in the variable @dfspeech

  • Then, if everything is correct, we will display the variable @dfspeech in a send message

  • In case something is missing or the input hasn't been matched it will go through the RED or YELLOW output, then we will set a loop and repeat the question. Being the text of the question the variable @dfspeech

Anatomy of the Dialogflow Block

1. Account Token

In this section, we identify both the Agent and the ID of the session.

JSON Key File

Here we will upload our JSON Key File:

Please check this article to get how you can get the JSON Key File in Dialogflow

Dialogflow session identifier [required]

By default we will use the session of the user id, but it can be any other string. It is recommended to use a random string every time.

2. Setup the request

Here we set up the different configurations needed to detect the intent:

Variable to Send [required]

Here we add the variable that is collecting the text that we want to send to the Dialogflow. It should be a string variable. It will try to match your agent's training phrases.

Set up in Dialogflow:

Input Context [optional]

Here we can set up the context of the session, for a more precise intent:

Set up in Dialogflow

Lifespan count [optional]

It is used when Input Context is used. The value by default is 1. It sets the lifespan of the context we set

Language [required]

The value by default is english. Here we can set up the language of the intent. It is a required option:

Time zone [optional]

It is empty by default, and it comes handy if we want to ask for date or time related data. It is not a required option.

3. Save the response

Entities

In case you want to extract parameters from the phrases, you will need to set them first in Dialogflow, and then fill the input with the same name to be collected, like in the example below with "date":

Set up in Dialogflow:

In some cases you will encounter entities that are objects. In that case you can set up the path to the value desired

Response

This is where you select the variable where you are planning to store the "phrase" that the intent is meant to answer. Is will also collect the value in case the intent is unsuccessful:

Set up in Dialogflow

Saved in Landbot

Output Context

The output context will come as the full name delivered by the API, it means is a full path. In case you want to check the name, maybe to set another variable or to use a condition, you will need to reach the keys and values, as mentioned before.

Set up in Dialogflow

The output context will be stored as an array with objects. To extract information from Output Context, please check here

Saved in Landbot

Payloads

The following items come as an array with objects. To extract information from Payloads, please check here

Set up in Dialogflow

Saved in Landbot

Query Response

The following items come as an array with objects. Is in the object where you will find additional information from the response. To extract information from the Query response, please check here

Saved in Landbot

Outputs

The block is meant to send a request to the Dialogflow engine, and according to the response, can have one of the following outputs. It is important that you connect it properly and are prepared for the different behaviours.

Success - Green Input

This is when everything is correct. The phrase sent in the variable to send section was matched by Dialogflow, and the everything was ok. In case you requested entities, once all of them are collected, this is path it will take.

Incomplete - Yellow Input

Here is where it is going to go when you requested to get entities but not all of them had been collected.

Fail - Red Input

When any training phrase is matched against your agent, it will go through this path.

for WhatsApp

This block/functionality is fully compatible with WhatsApp

for Messenger

This block/functionality is fully compatible with Messenger

How did we do?

How to extract parameters from Dialogflow response with Formulas

Contact