Table of Contents

Dialogflow & Landbot lesson 6: Redirect user depending on Dialogflow response parameters (intent, entities and more)

Pau Sanchez Updated by Pau Sanchez

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

Once you have the Dialogflow configured and your loop set up, you will be able to "keep" a conversation with Dialogflow, but the best usage of Dialogflow with Landbot is when you use both tools at once, one to "understand and capture" users inputs and Landbot to display and make operations with the information and data captured.

Specially when you redirect the user to specific flows depending on Dialogflow responses and parameters returned. Below are a set of examples on how to use different parameters (not just the text response) that Dialogflow will return to you, and based on that set up redirection to specific flows.Ā 

Redirect to specific flow based on Intent Name

One of the easiest ways to set up a flow depending on the user input, is based on the Intent triggered in Dialogflow. So for example, in the below agent we will be able to set flows based on 5 intents:

- Default Welcome Intent

- faq.delivery

- faq.hours

- faq.location

- reservation.trigger

1. In Landbot Dialogflow block set up to "Show advanced configuration"

2. With this option, if we now scroll down an open the "Save the response" section, we will be able to see more parameters that we can capture from Dialogflow, in this case we are interested in the "Intent Name"

3. Now we will create a Landbot variable to store it:

4. To set up the flows depending on the intent names, we will use the Keyword Jump block:

5. The variable to match will be the recently create variable @intent_name:

6. As "keywords" we need to make sure the match is exact. As a good practice try not to use spaces or capital letters. So we now will paste the names of the intents we want to match:

7. Now that we have all the intents names that we are going to use for specific flow inside Landbot, we can set up specific flows for each one

8. Notice we still have the Default option connected to a regular Question text block, that is very handy to keep the conversation in the "loop" in case you don't want to have a specific flow, and you want to let Dialogflow deal with that type of conversations, like for example "welcome inputs"

Here is an example of how this bot will behave if first we use a regular welcome input, and then we trigger a specific intent like the location intent:

Other really useful intent that you can have, if you have agents is to set up a set a "human.takeover" intent. So in case the user enters in a loop, and says something like "I wan to speak with a person", " I need help from a real person" ... you can redirect them to a flow where there is a human takeover block:

Redirect to specific flow based on Entities values

Entities as other type of parameters that we can extract, are a way to also redirect the user to a flow. In this other example we will set up a flow, for people booking for tables bigger than 6 persons.

1. To capture the entities we will set them up in the Dialogflow block as we have them in the "reservation.trigger" intent:

And in the Dialogflow block:

2. Now, these entities will be captured only in the "reservation.trigger" flow, so we will add a conditional block specifically for that flow:

3. Now we set up the flow content for each one:

Let's test it out now, for a group of 10!

Other types of parameters from Dialogflow

Dialogflow responses, as you have seen offer more than simply text responses, it offers you also Intent names and Entities. But there are other more advanced parameters that can also be used by more advanced users:

For this parameters, the Formula block, and the method GetValue, will be really handy to extract the information required

Output Context

This parameter is returned as an object, so it will be stored in an Array type variable

Here is how it would be displayed:

Payloads

This parameter is returned as an object, so it will be stored in an Array type variable

Here is how it would be displayed:

Query Response

This parameter is returned as an object, so it will be stored in an Array type variable

Here is how it would be displayed:

How did we do?

Dialogflow & Landbot lesson 5: Entities and Landbot variables

Learn more about Dialogflow - Courses and communities

Contact