Table of Contents

Dialogflow & Landbot lesson 3: Setting up of Dialogflow in Landbot

Pau Sanchez Updated by Pau Sanchez

In this lesson we are going to build a very basic set up to use Dialogflow in Landbot

Store first user input

Before we start using Dialogflow, we must correctly collect the first input of the user in the Welcome Message block, and store it in the right place to use it later in the Dialogflow block

  1. Let's create a web bot

  1. As you can see there is a default Welcome Message block, but it has a button for the user that says "Hi!"

  1. Hover over the "Hi!" button and select the bin to delete the button

Once you delete it you will see the message "Open Question" as in the picture below

  1. As you can see if you enter in the setting of the Welcome Message block is that the variable where we are going to store the input is going to be "@welcome" , but we want to use a different one

  1. Let's create a Set Variable block

  1. We will use it to set the value of the welcome variable (with the first input of the user) to a new variable, and we will set up the name as @input, and will be a type string

  1. And now we add the value of welcome by selecting from the VARIABLES selector the Welcome variable

So it will look like this:

Create Dialogflow block and the Key

Now that we have the variable with a more useful name, and set up the welcome message without buttons, we can start using the Dialogflow block.

  1. Create a Dialogflow block and connect the set variable block to it, as in the picture below:

  1. If we enter in the block the first thing we need to do is to add our JSON key

  1. And Apply Changes to save it

Set Landbot variables in Dialogflow block

We will set up the minimum variables that we need to send information and receive information from Dialogflow

  1. Now in the Set up the request we will set up in the "Intent Text" section the variable where we store the user input, that will be sent to Dialogflow and matched with your intents and training phrases

  1. Now in the Save the Response, we will create a new variable called df_response. In this variable is where the response from Dialogflow is going to be stored, it's the text that you want to display to the user

  1. And press Apply Changes

Set block to display response from Dialogflow

Now is when we set up connections to display Dialogflow responses and make it send back to Dialogflow the following inputs from the user:

  1. From the Green Output (Success) add Question Text

  1. Inside this Question Text block, we will change the default text

For the variable df_response to display the response from Dialogflow

  1. Now we will switch the Text Area to Short

  1. As we are planning to do a loop, and send the information captured in this block, back to Dialogflow, we will add the input variable again

  1. And press Apply

Set loop to send user input again back to Dialogflow
  1. Now we will create a loop and connect this block back to Dialogflow

  1. Now we want to handle the other two outputs, the green and red outputs. To do so, duplicate the Question Text block

  1. And relocate it below:

  1. Now we will connect both Yellow and Red outputs to this new Question Text block

  1. And finally, lets connect back the new Question text block to the Dialogflow block

Now we have a basic setup. The green output will be the way it goes when Dialogflow "understands" the user input, and the red output will be when the Dialogflow "doesn't understand" the user input. The yellow, at the moment is not going to be used, as we are not working yet with entities.

Let's test our first intent

Now we will do the same, but for a phrase that we didn't train yet Dialogflow, that will trigger the red output and display the default fallback

Next Lesson

Dialogflow & Landbot course 4: Training phrases and responses for a FAQ Link to lesson

How did we do?

Dialogflow & Landbot lesson 2: Get the JSON Key

Dialogflow & Landbot lesson 4: Training phrases and responses for a FAQ

Contact