Table of Contents

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

Pau Sanchez Updated by Pau Sanchez

Prefer watching than reading? No problem, we've got you covered 👇

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. Click on the Question: Text to see the settings for that block:

  1. Change the variable name for the Question: Text block to @input, string type:

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 Welcome 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