Thumbnail Preview

Total video duration: 6:32:54

Thumbnail Excerpt
Getting Started
Text Lesson
Dialogflow CX Beginner Tutorial

Before you go through the rest of the course, please go through the Dialogflow CX Beginner Tutorial, which explains how to build a state machine using Dialogflow CX.
Text Lesson
Dialogflow ES vs Dialogflow CX

The Dialogflow ES vs Dialogflow CX course explains the differences between ES and CX by creating an example bot.
CX vs ES: Get User First and Last Names
Duration: 0:03:10
Can you build this bot in Dialogflow ES?

(Autogenerated transcript) [00:00:00] Alright, so recently I got a message, rather an email from one of my students who’s already in the courses and he was asking if it’s a good idea to use Dialogflow CX for a particular type of flow and the flow that he was interested in actually goes like this. So the first thing is that you have the bot asking for the user’s name and the user could say one of three different types of responses. They could say my name is Alex here which is the first name or they could say my last name is Gonzales or they could say my full name is Alex Gonzales.
Duration: 0:09:32
Flowchart for the ES Bot

(Autogenerated transcript) [00:00:00] All right, so let’s get started. The first thing we are going to do is delete these, and we are going to start the flow where you can say that the user will trigger the welcome intent. And the bot is going to say, may I have your name, please? All right, so now the next possible options we have will be the user is going to say, my name is Alex, and the bot has to say, pleasure to meet you, Alex and your last name.
Duration: 0:08:57
Defining the intents

(Autogenerated transcript) [00:00:00] Alright, so now I’m here in the Dialogflow console and what you see here is that in the Default Welcome intent I removed the usual response and I have replaced it with can I have your name please which is what we have here and the output context is set to be await underscore name with a single with a lifespan of one. Alright, so now let’s create a new intent and all we have to do really is just effectively take this stuff
Duration: 0:04:03
ES Bot Demo

(Autogenerated transcript) [00:00:00] All right, so let’s test how the bot works. So the user will say, start the conversation with hello. And it’s going to ask, can I have your name, please? So let’s say the user says, my name is. I’m going to stick to the common names first, just to confirm that the flow works. And then let’s go on to less common names after that. So if I say, my name is John, you can see that it mapped it to the intent called provide.
Duration: 0:05:11
Extending the name system entity

(Autogenerated transcript) [00:00:00] Alright, so in the last video we were just giving inputs which were common names. So in this video let’s try names which are a little more, a little less common. So let’s start with saying hello and of course the bot is going to say can I have your name please. Now what I’m going to do is I’m going to give it a name which is actually a name that someone tried to give the kid in New Zealand and the New Zealand’s
Duration: 0:02:46
A note about entity annotation

(Autogenerated transcript) [00:00:00] Alright, so I just want to add one more piece of information and this is about entity annotation in this flowchart. Now the reason that this is important is because if you just take a look at this flowchart just as it is you can see that so the users that is one branch could be user provides first name, the second one could be user provides last name and the third is user provides full name but just by reading these training phrases by my name is so and so, my last name is so and my full name is so and so.
Duration: 0:09:20
Building the bot in Dialogflow CX

(Autogenerated transcript) [00:00:00] Alright, so now let’s see how you can create the same bot in Dialogflow CX. So I’m inside my Dialogflow CX console. I’m going to create an agent called getUserName. And let’s just go ahead and save that. And as you know, as soon as you start, you will have this default start flow, which already comes with the Default Welcome intent. So what I’m going to do in the Default Welcome intent is I’m going to delete the existing whatever the agent says, and I’m just going to replace it with, hi, can I have your name please?
Duration: 0:04:39
Testing the bot in the simulator

(Autogenerated transcript) [00:00:00] Alright, so now that we have built out what we wanted, let’s take a look and see if things work as expected by clicking on this test agent over here. And you can see that it’s opening this simulator and I just want to change it to the horizontal view so you get more information at a glance. Now one thing you can see is that the simulator is similar to the Dialogflow ES simulator. Let’s just type the word Hi and you can see that it’s going to show you the page and the flow.
Duration: 0:07:19
Pros and Cons of Dialogflow CX for this bot

(Autogenerated transcript) [00:00:00] Alright, so let’s take a look at some pros and cons of using Dialogflow CX just from whatever you have seen and learnt till now. Now, of course, this is not a full comparison for obvious reasons because CX has got a lot more features and in general you would say that it’s a lot more powerful. But if you had to just look at what is being built till now, one of the big pro that you notice is obviously the fact that you can reuse intents.
Duration: 0:05:01
Understanding scope in Dialogflow CX Part 1

(Autogenerated transcript) [00:00:00] Okay, so in this video, we are going to take a look at this concept called scope. Okay. Now, there are a lot of things that you can see, which are defined by the scope. And certainly there is a good reason why they have added all these things into this list here. But if you are already familiar with my material, and if you are already familiar with Dialogflow ES, I think that I can reduce the definition of scope down to scope is what decides which intents are candidates.
Duration: 0:08:03
Understanding scope in Dialogflow CX Part 2

(Autogenerated transcript) [00:00:00] Alright, so what I’m going to do in this video is I’m going to do a very small test and I think that it will help understand what scope actually is. Okay, so as I pointed out in the last video, you can see that the provides.lastName intent is both a part of the Start Page as well as the await last name page. Okay, so what I’m going to do now is I’m going to go to the test simulator and you can see that right now the getName flow has been entered and the Start Page is the current page.
Flowcharts and Test Cases
Duration: 0:04:06
Why ES First

(Autogenerated transcript) [00:00:00] So, recently someone asked on my YouTube channel to make a tutorial about parameters in Dialogflow CX and they also mentioned that it is really confusing compared to Dialogflow ES and of course this comment is very true but one of the things that I also feel lot of people are missing is that Dialogflow CX is sort of an improvement over ES and not only that it is meant to be used at least in my opinion only in the situations where ES is not sufficient for your bot and I will actually say that there is a lot of stuff you can do with just ES in fact I have created a lot of material in my courses which will help you to do that and I also think it is much easier to learn CX if you learn the Dialogflow ES bots first that is if you learn how to build you know reasonably complex conversations even using [00:01:00] Dialogflow ES and the reason for that is because it will show you really what is missing you know it is like CX sort of starts where ES ends in my view and if you never understood the limitations of why it was hard to create these more complex conversations in ES then getting jumping right into CX will actually be of course this is my personal opinion but I actually think that you are likely to waste a lot of time now I can imagine given that I have already created a lot of training material for ES there will be some people who will say that
Duration: 0:04:33
Decision Tree Flowchart

(Autogenerated transcript) [00:00:00] Alright, so the first thing that we are going to do is create a decision tree chatbot based on my decision tree chatbot that I already built using ES. So this is what the bot, this is how it works. You can see that it first starts with a prompt which is which programming language is right for your Dialogflow chatbot and it’s going to ask the user to, it just asks the user to fill out a set of, not fill out but really like click on buttons which are yes or no answers.
Duration: 0:11:59
Initial Flow

(Autogenerated transcript) [00:00:00] Alright, so what we are going to do in this lesson is we are going to take a look at the flow chart that I have already designed for the decision tree bot. And also based on the lessons we have already done for the CX course, how to do the you know pages and states and how to transition between them and all that. You already have a fairly good picture of how to create these pages and keep transitioning between them.
Duration: 0:02:54
Some Housekeeping Tips

(Autogenerated transcript) [00:00:00] Alright, so before I go on and fill out the rest of the flowchart, I just want to give you a little housekeeping tip. You can see that just by going through this flowchart, so I go to the start and you can see that there’s a Default Welcome intent and you can see that it goes to this get is AOG app as one of the possible transitions. And then in the AOG app, I can see the transition terms which are possible.
Duration: 0:05:51
Building the remaining pages

(Autogenerated transcript) [00:00:00] Okay, so now that we have gone over the housekeeping tip Let’s just use it to fill out the rest of the information in the bot You can see that get is programmer is already completed now I am going to go to get knows node.js. I’m going to add a transition route and this is where they say no and Let’s go down and So do you know node.js? What does it actually do? If you know node.js, it’s just going to ask you to use node.js Let’s just check to see if I’m on the right track.
Duration: 0:01:41
Identifying test Cases

(Autogenerated transcript) [00:00:00] Alright, so in this video I’m going to do a few things at once. The first one I’m going to do is of course test what we have built. But as I’m talking about testing what we have built, I am also going to demonstrate a nice feature in CX which allows you to do this testing inside of the Dialogflow CX console itself. And the third thing I’m going to do is I’m going to just give you a tip that you can use which will help you as you design your so called test cases.
Duration: 0:05:01
Naming test cases

(Autogenerated transcript) [00:00:00] Alright, so let’s take a look at how to use this flow chart and create the test cases. So you can see that when the user starts the chatting, they’ll first say something like hi or hello or something like that. And then it’s going to ask them, are you building an actions on Google app? And then they will say yes. Okay, so the first test case is going to be the word hi, or you know, whatever you use to trigger the conversation,
Duration: 0:04:34
Running Test cases

(Autogenerated transcript) [00:00:00] Alright, so now I have actually declared all the test cases as I mentioned in the previous lesson and you might have noticed that I made a change which is I put a prefix with the number 1, 2, 3 etc. indicating the branch, the leaf number if you go in this counterclockwise order. So this is 1, this is 2 and this is 3 and so on. And the other change I had to make is I had to actually copy over from the old agent to the new one called decision rebought because apparently for some reason if you choose a location as US West it’s not able to run the test cases so I had to change it to global.
Entities and Parameters
Duration: 0:02:38
Planets Bot: Introduction

(Autogenerated transcript) [00:00:00] Alright, so in the next set of videos, what we are going to do is translate the planets bot which I have already created for the ES and I am going to translate that to Dialogflow CX. Now, the planets bot was actually the first chat bot that I explained in my step by step Dialogflow course, which is actually like my recommendation for people who are just getting started with Dialogflow ES. Okay, and though this was the first bot I created in ES, I do not recommend people use this as my first as the first thing they learn in the CX course because I think that it is more important that you understand how state machines work and that is why I created a different course or a different you can say a mini course which is like the beginners tutorial for Dialogflow CX.
Duration: 0:07:32
Entity Definitions

(Autogenerated transcript) [00:00:00] So, as you learn about how to build the PlanetsBot in Dialogflow CX, you are going to learn two core concepts in CX. The first one is going to be entities and you will actually notice that entities in CX are not that different from entities in ES but the way you invoke the entities is actually quite different. And so in other words, if you look at entities and parameters as a single concept, which is I do, I actually think of them as similar things.
Duration: 0:04:29
Original vs Resolved value

(Autogenerated transcript) [00:00:00] Alright, so in this video what I am going to do is explain the concept of resolved and original values for the intent parameters which were extracted by Dialogflow CX. Now I also went ahead and added all the planet values for all the nine values. You can see that over here. And what I am going to do now is when the user asks for getPlanet attribute, I am going to actually go into this response and in the parentheses, okay, I am going to have, so what I will do is I will have dot, dot, so here if you look at it, it says intent.parameter, params.parameterid.original.
Duration: 0:02:11
Intent vs Session parameters

(Autogenerated transcript) [00:00:00] Alright, so one of the big changes that is introduced in Dialogflow CX is this concept of intent form and session parameters. Now the reason that this is such a big concept is because this actually the way that Dialogflow CX is introduced these parameters, it solves a lot of problems which were there, which were present in Dialogflow ES and notably the big problem that they solved is the fact that carrying over users input whatever information that they had provided through the whole conversation was actually very tricky.
Duration: 0:04:01
Session Parameters Intro

(Autogenerated transcript) [00:00:00] Alright, so when the agent responds with this response, you ask for intent.parents.attribute.original of, you know, blah blah and all that. What is happening is that for that particular intent, you know, you start over here and you end over this, this is the whole intent. There are some parameters which are being set and those are, you can reference them or invoke them using this $intend.params.nameofentity, right?
Duration: 0:06:03
Using session params

(Autogenerated transcript) [00:00:00] Alright, so now let’s take a look at how to use session parameters and do something a little more useful. Okay, so in the getPlanet attribute, what I’m going to do is I’m going to create a new page whenever this fires and I’m just going to call it follow up because this page should be able to serve all the follow up questions coming from the user. Okay, so now I’m going to go into the follow up page and here let’s add another intent.
Duration: 0:05:33
Keeping track of session parameters

(Autogenerated transcript) [00:00:00] Alright, so now I’m in the follow up page and I’ve added one more intent called changesPlanet and if you were to go into the intent you can see that this is just changing the planet name. It’s asking more about the different planet name, okay, and save that and notice that I have three responses in the fulfillment. It is trying to echo the attribute, the planet and the plan attribute of planet based on the session parameter.
CX Webhooks using Python
Duration: 0:02:10
Before you start: Ngrok Tutorial

(Autogenerated transcript) [00:00:00] Alright, so as we go into the webhooks section of the planetspot, I would like to point out that I actually have a tutorial on how to debug the Dialogflow Python webhook using ngrok and I would like you to first go through this tutorial. Now, I am actually going to go ahead and update a few things in this tutorial. So maybe by the time you take a look at it, it might look a little different. But in any case, you have to take a look at this because it will be much easier for you to follow the lessons which are going to come after this.
Duration: 0:03:42
Handling multiple intents in ES Webhooks

(Autogenerated transcript) [00:00:00] Okay, so to provide some motivation as well as some contrast to what is going to follow in the next set of lessons, I want to show you how you had to do Webhooks in Dialogflow ES. Now, what we have here is a Webhook, which is I have it hosted on a site called Replit and it actually allows you to write code and run it online. So the code itself, if you take a look, it’s actually, it can handle two different operations.
Duration: 0:02:33
Skeletal Code

(Autogenerated transcript) [00:00:00] Alright, so now as we start creating our webhook, what I would like you to do is start with some skeletal code and I will provide this under the video lesson and what you have here is it’s nothing more than just a single route and you can see that it just returns the string hello world and then you can see that this is the code which starts the program and also I just want to point out that I am using the PyCharm IDE and all I have here is just a plain what they call as a pure Python project
Duration: 0:01:48
Webhook Response Object

(Autogenerated transcript) [00:00:00] So now that we have made sure that the skeletal Flask code is running on your computer, the next thing I have done is I have added another route in this flash app and that route is going to be slash webhook and you can see that it supports the POST method and also it actually does a few things. It gets the request object by using request.getJSON and then it actually dumps the entire request object into a file on the file system and then it constructs a JSON response object and then it just returns the JSON response.
Duration: 0:05:12
ngrok setup

(Autogenerated transcript) [00:00:00] Alright, so now let us set up the basic connection between the Dialogflow CX bot and our webhook over here. So what I’m going to do is, so first of all notice that this Flask app is running on port 8080. So what I’m going to do is I’m going to go to ngrok and you can start a terminal in the folder where I have the ngrok app and I’m going to do ngrok HTTP 8080 and as you know it’s going to create a URL for you to use.
Duration: 0:02:06
Webhook Request Object

(Autogenerated transcript) [00:00:00] Alright, so in this lesson we’ll take a minute to inspect the request object coming in. So if you remember in the code for that webhook method what I had is as soon as we got the request object I was actually writing it to a file called request.json and you have this file over here and let’s just format it so that it’s easier to read. I just want to take a little bit of time to see the exact format and all the fields.
Duration: 0:03:51
Handling getplanetattribute

(Autogenerated transcript) [00:00:00] Alright, so let’s write a webhook endpoint to handle the getPlanet attribute intent. So what I’ve done is added a new Flask route which is going to be getPlanet attribute and it corresponds to a method called getPlanet attribute and the first few lines are the same but what has changed here is I get this planet, the value of the planet by going through this request object where it’s request.intentInfo.parameters.planet.resolveValue
Duration: 0:02:27
Handling changesplanet

(Autogenerated transcript) [00:00:00] All right, so now let’s look at how to create a similar endpoint for the changesPlanetIntent. So what I have here is I’ve created a new Flask route called slash changesPlanet with the corresponding method. And other first few lines are the same, but what has changed here is that the planet information is going to come from the intent info object. But because the user does not specify the attribute in the query, they are not going to, you’re not going to get attribute from the intent info.
Duration: 0:02:42
Handling changesattribute

(Autogenerated transcript) [00:00:00] Alright, so now to complete out the full bots, all the intents that it has, the other endpoint I have is the changes attribute, which you can see is the web endpoint is going to be slash changes attribute. And in the same way, the planet value is going to be obtained from the session info object, while the attribute object is going to be obtained from the intent info object. All the other things are just the same.
Text Lesson
Sample Code

from flask import Flask, request import json app = Flask(__name__) @app.route(‘/’) # this is the home page route def hello_world(): # this is the home page function that generates the page code return “Hello world! ” @app.route(‘/getplanetattribute’, methods=[‘POST’]) def webhook(): req = request.get_json(silent=True, force=True) with open(‘request.json’, ‘w’) as outfile: json.dump(req, outfile) planet = req.get(‘sessionInfo’).get(‘parameters’).get(‘planet’) attribute = req.get(‘sessionInfo’).get(‘parameters’).get(‘attribute’)
Duration: 0:03:03
A bug in Dialogflow CX webhooks

(Autogenerated transcript) [00:00:00] Alright, so something very interesting happened just now. This was supposed to be a demo of me going ahead and deleting some webhook endpoints and then showing you that you can change the intent webhook to point to a different webhook, okay? And then showing you that you could combine all of these, you know, functionality into one. So, this is what the code will look like if you were to combine everything, okay?
Duration: 0:14:50
Reroute conversation flow based on webhook response

(Autogenerated transcript) [00:00:00] Alright, so in this lesson we are going to take a look at how you can reroute your conversation flow based on some parameter which was set in the webhook. Now before you do that the first thing that you need to understand is how can you change or update session parameters from your Dialogflow webhook and I actually have an article about this on my site. You can go and take a look. It’s called updating Dialogflow CX parameters from webhook and you’ll see that I explain how you can add, update and delete existing parameters.
Dialogflow CX Slot Filling
Duration: 0:03:32
What is slot filling?

Note: the slot filling article mentioned at the start of the video can be found here (Autogenerated transcript) [00:00:00] Alright, so if you go to my site, you will see this article where I talk about slot filling and you can see the URL is just slash dialogflow hyphen slot hyphen filling. And if you scroll down a little, you’ll see this video here, which is about 15 minutes long. And I actually provide an overview of slot filling and I also explain sort of how it works under the hood.
Duration: 0:03:29
Defining the slots

(Autogenerated transcript) [00:00:00] Alright, so now let’s build the flight booking bot using slot filling. So let’s go ahead and add an intent. So I’ll say new intent poop.flight and there’s something simple like I would like to book a flight and go ahead and save this. And then what we will do is we’ll just create a new page to get all the information and I’ll just call it get info page. So what happens is I’m going to add something here which is just to indicate enter get info or maybe let’s
Duration: 0:03:24
Demo of simple slot filling bot

(Autogenerated transcript) [00:00:00] Alright, so once we collect all this information, what we will do is we will add a transition route and this should be actually based on a condition, match at least one condition. This is a special formula which you can use to check if all the parameters which are collected in this page, if you have all of them already filled out. You can see an example of this is in the car rental pre-built agent where they say dollar page or parameters status equals final.
Duration: 0:06:21
Adding phrase variants

(Autogenerated transcript) [00:00:00] Alright, so now you might remember that when I gave you the motivation for creating a slot filling bot, I mentioned that the user might start the first, like the first question they ask could actually have a lot of variations, right? And this is the set of variations I showed you before. And what we have seen till now is a much simpler bot where I only took the first part of that statement, right? I want to book a flight.
Duration: 0:03:13

(Autogenerated transcript) [00:00:00] Okay, so the biggest benefit of using slot filling is that Dialogflow will keep prompting the user until the user provides an input which matches the type of entity that you are expecting. So to show that, to explain how that works, let me do the same thing in the simulator, book a ticket and it’s asking where are you flying from. Now just for the sake of the demonstration, let’s say that I type in some random like a, it’s just random text, it’s not even a valid city name and if I press enter, you can see that it’s just doing the same thing.
Duration: 0:03:41
Reprompts with no-match-default

(Autogenerated transcript) [00:00:00] Alright, so what you have seen now is that slot filling will keep re-promoting the user until they provide the expected value. Now this was actually a big problem in Dialogflow ES and the reason is when they had the slot filling it will just keep continuously re-promoting. There was the option to change the prompt message but often that wasn’t, in my view that still wasn’t good enough and there are a lot of reasons for that.
Duration: 0:06:47
Reprompt to selection

(Autogenerated transcript) [00:00:00] All right, so what I’m going to do in this video is I’m going to show you an example of how you can provide Reproms which gives the user some help and makes them give a better input for your for the particular Entity that you are trying to collect. So what I’m going to do is create a new entity and I’m going to call it class as in the Flight class which is first class and business class and economy. Let’s stick with those three for now
Duration: 0:05:10
Exiting the slot filling loop on first retry

(Autogenerated transcript) [00:00:00] Alright, so one of the places where slot filling can get really stuck is where you are collecting the value of an entity and it so happens that it’s quite impossible to list all the possible values for that entity. A really good example is the user’s name and if you try to collect information about the user’s name in Dialogflow ES, you know that that can be pretty tricky. So what the CX does is it gives us a really nice way of handling this issue and of course you still will have some small limitations but as you will see it’s just a much more elegant way of solving the problem.
Duration: 0:05:04
Exiting the slot filling loop after second retry

(Autogenerated transcript) [00:00:00] Alright, so the previous lesson what you saw was there’s a way to fill the parameter value using the event handler and that was short circuiting the loop and then you might be thinking well why don’t we at least give the user at least one more chance to provide their input and if it still fails maybe we will do that short circuiting, right? And Dialogflow CX makes that also very easy. So what I’m going to do this time is I’m going back to this booking name parameter.
Conditional routes with expressions
Duration: 0:02:37
Introduction to the quiz bot

(Autogenerated transcript) [00:00:00] Alright, so the next thing that we are going to take a look at is the quiz bot and I’ll use this to explain how the conditional equations work in CX, okay, that is the conditional references. What the quiz bot allows you to do is it’s going to ask the user some questions. So here it’s asking which of these is used to keep track of what happened within a conversation and let me give an answer. So this is the correct answer, so it says correct
Duration: 0:01:16
Start quiz intent

(Autogenerated transcript) [00:00:00] Alright, so we will get started by creating an intent which allows the user to start the quiz. So let’s create a new intent and call it start quiz and you can trigger this intent by saying the word quiz or using start over. Let’s go ahead and save that and as soon as this happens what we want to do is we want to go to a new page and this page is going to be Q1 which stands for question one because we as soon as they start the quiz we want to go to the first question.
Duration: 0:03:47
Question 1 Page

(Autogenerated transcript) [00:00:00] All right, so now that we have the Q1 entry dialog set up to ask the question, let us consider what the user might do. They might either say, give the correct answer, in this case it’s going to be context or they may give the wrong answer. So the way you can handle this is you will add a transition route and this one will be called Q1.correct. And this will be just the word context. Let’s go ahead and save that.
Duration: 0:08:19
Question 2 Page

(Autogenerated transcript) [00:00:00] Alright, so now that we have the first step of Q2 page setup where it asks the question, let’s do the intents for the Q2. And in the same way as in Q1, that is the question 1, what we will do is we will create a new intent called Q2 dot correct. And in this case, the correct answer is going to be ml threshold. Okay, so let’s go ahead and save that. And here is where we start using the extra features that you get in dialogflow CX.
Duration: 0:06:21
Question 3 Page

(Autogenerated transcript) [00:00:00] Alright, so now that you understand how the intent routes are defined, that is the transition routes, I am just going to quickly go ahead and do the same with question 3. And the question 3, the correct answer is supposed to be fallback intent. Alright, so let’s go ahead and save it. So what you have to check now is, you have to check a couple of things, right? If the session.params.score, if it is still at 0, then you have to make sure that the score has become 1, okay?
Duration: 0:07:26
Display Score Page

(Autogenerated transcript) [00:00:00] Alright, so to wrap up we will just do a display of the score. We already have done all the hard yards which is we have calculated the score maturing that we have checked all the conditions and all that. So the only thing which is left to do is we are going to in the display score page what we are going to do is we can say thanks for taking the quiz. Our final score is and then you say something like dollar session dot params dot score out of three because we know that they had answered three questions right and this is going to say let’s say the score is two you might say your final score is two out of three.
Duration: 0:05:06
Scope and the flow start page

(Autogenerated transcript) [00:00:00] Alright, I just wanted to make one more final note about this quiz bot. And what I did is, if you remember, I had a transition route at the end of this display score where I just had true equals true and had the transition over to the start. I have deleted the transition route here and I’m just going to show you what happens in that case. So let’s start with quiz and I’m going to give all the correct answers, context and ML threshold fallback intent.
Building a Dialogflow CX Custom Integration
Duration: 0:04:12
4 Layers of a Dialogflow Bot

(Autogenerated transcript) [00:00:00] Alright, so as we talk about Dialogflow CX integrations and Dialogflow integrations in general, the first thing that I would like to talk about is this concept of four layers of Dialogflow bots that is every Dialogflow bot in my view has four layers and these are the four, the first one which is closest to the end user is the user interface and then you have a middleware or an integration layer which connects the user interface layer with the conversation layer and in this case I refer to everything which you do inside of the Dialogflow web application as the conversation layer and then you also have the fulfillment layer which is your webhook code and fulfillment layer is a terminology that Dialogflow team itself uses.
Duration: 0:03:30
Set up the bot

(Autogenerated transcript) [00:00:00] I’m going to show you how you can integrate Zoho Sales IQ with Dialogflow CX. Now I wanted to show this as a code demo, but I’ve not been able to set it up properly on my computer. Even though the code works separately and all that, the screen recording software is set up on a different user profile and I’m not able to get the code and the screen recording going at the same time. So unfortunately this is going to be more of a pictures based setup, but I think that you will still be able to understand what is going on and follow how I’m doing this.
Duration: 0:02:15
Download service account credentials file

(Autogenerated transcript) [00:00:00] When you are setting up your integration with your Dialogflow CX agent, what you have to do in your Python code or whichever programming language you are using is you have to first download something called a service account credentials file. It’s a JSON file and you have to store it in the same folder where the code is running. Of course, sometimes some people prefer to put it outside that folder for security reasons and then call that from the code, but no matter what it has to be residing in the same file system as your code for the integration to be able to work.
Duration: 0:04:54
Code walkthrough

(Autogenerated transcript) [00:00:00] Now that you have the service account JSON file downloaded to your computer. So this is what the file is going to be. I’m going to call it client-key.json. Um, the Python code that I use is going to use the code. I’m sorry, it’s going to use the file and it’s going to generate credential. So this piece of code, what it’s really doing is it’s going to go and get. So this, this line of code here from service account file is going to use the credentials key path.
Duration: 0:02:57
Why I don’t recommend the client library

(Autogenerated transcript) [00:00:00] Now that you’ve seen the code in action, this is a good time for me to explain why I am calling the API URL, I’m constructing this URL in the code instead of using the client library which is provided by Google or by the dialogue protein. So the reason I do that is when you use the client library which is provided by Google, what happens is that the client library will allow you to construct these rich responses corresponding to whatever channel that you’re using by using certain specific library methods.
Duration: 0:01:56
Defining the custom payload inside Dialogflow CX

(Autogenerated transcript) [00:00:00] So in a video which I showed you before, I showed you how when the user typed the message hello there, it came back with a rich response which is shown inside the SalesIQ widget. And you notice that it was already able to show like a input box where the user was able to type in their name, right? So the way that works is now I’m inside my Dialogflow agent and this is the Default Welcome intent. Notice that this is a very simple agent.
Duration: 0:03:15
Rich responses supported by Zoho SalesIQ

(Autogenerated transcript) [00:00:00] What you saw in the previous video is that the custom payload that I created inside CX is sent back to the Zoho Sales IQ chat window and it’s able to render it in a format which looks like this where they have this control which allows the user to input that name. This is a specific type of response but if you look at Zoho, the Zobot responses which are supported, there are actually quite a few. So you have these input cards where the user is actually going to provide an input based on whatever is showing up on their screen.
Duration: 0:03:44
Hosting the middleware code on PythonAnywhere

(Autogenerated transcript) [00:00:00] I’m going to talk a little bit about where you would want to host this middleware code. Now if you already made up your mind and you already have something that you are very comfortable with and you use all the time, then you should just go with that. Always familiarity is better than trying to find the optimal solution. But in case you are not very sure where to host it, I’m just going to give you a few ideas and I’ll also point out the pluses and minuses of using these different systems.
Duration: 0:01:41
Hosting the middleware code on Heroku

(Autogenerated transcript) [00:00:00] The other option that you have for deploying your middleware code is the very famous Heroku. And Heroku allows you to do this for free. The only limitation that you have is that in Heroku, the free tier, it gets shut down periodically. It’s not like, it’s some, most of the time it won’t affect things like chatbots, but it’s still something to keep in mind. And the other issue with Heroku is that it’s not really a file system.
Duration: 0:09:27
Hosting the middleware code on Google Cloud

(Autogenerated transcript) [00:00:00] Now we come to the third option and I think this is sort of the most, I would say most people want to learn it and most people prefer it but it’s also in my view not the best choice. So I’m talking about using Python Cloud Functions on Google Cloud. So Google allows you to use these things called Cloud Functions and it actually supports a lot of languages right now. You can see that all these languages are available now.
Text Lesson
Flask App Sample Code

from flask import Flask, render_template, request, session from google.auth.transport import requests as google_requests from google.oauth2 import service_account import os import json import requests from dotenv import load_dotenv load_dotenv() app = Flask(__name__) app.secret_key = ‘!secret’ @app.route(‘/’, methods=[‘GET’, ‘POST’]) def hello_world(): if request.method == ‘GET’: CREDENTIAL_SCOPES = [“”%5D CREDENTIALS_KEY_PATH = ‘client-key.json’ credentials = service_account.
Exception Handling
Duration: 0:05:50
DF Chooser Bot Demo

(Autogenerated transcript) [00:00:00] Alright, so in this chapter I am going to talk about exception handling and this is something which is a topic which was sort of raised by someone who has gone through the course and they are going through the course rather and asked me about exception handling in Dialogflow CX. Now I want to distinguish two different concepts before we get started. When I think of exception handling I am thinking of a user who wants to continue in the topic in the same topic but they provide a response which is not something that your bot is able to actually understand which is why it is sort of like an exception or an error and you want to have a way to handle it.
Text Lesson
Download the agent ZIP file

Duration: 0:06:49
Does a flowchart help when creating a Dialogflow CX bot?

(Autogenerated transcript) [00:00:00] When I first started working with Dialogflow ES, I actually came up with a system for designing a flowchart using a mind mapping software which will make it easy for people to first map out the conversation flow and then translate it easily into Dialogflow ES intents. And the interesting thing about this, and by the way I have this course on my website, this is a free course, you can just go and take a look at it.
Duration: 0:04:41
Bot Design Part 1

(Autogenerated transcript) [00:00:00] All right, so now that you have seen the Mindomo flow chart, what I’m going to do is I’m just going to quickly go through these pages that you have in this in my CX bot and quickly tell you what’s going on. So you have the start flow and of course you have the Default Welcome intent and notice that it’s going to come back with the prompt for the with the suggestion chips. And it’s going to ask you need help choosing between ES CX and actions builder and suppose the user and it’s going to transition over to this page called await underscore help.
Duration: 0:06:15
Bot Design Part 2

(Autogenerated transcript) [00:00:00] Alright, so now let’s move on to the next few pages. If they were to say, let’s go actually to look at the Get Channel. And remember that if they said if there was a no match, then what it does is it goes to the Get Higher Programmer page. And it asks, do you have the budget to hire a programmer to build a custom integration? So now let’s go and look at Get Higher Programmer. And the user could say yes. And if they say yes, that means they have the budget to hire a programmer.
Duration: 0:08:56
Bot Design Part 3

(Autogenerated transcript) [00:00:00] Alright, so with the get follow-up questions, it’s going to say if the user says yes, then you can, the agent will just answer with use Dialogflow CX and allow the user to start over. If the user says no, it’s going to ask them this question, how many intents will you have in your bot? The interesting thing about this question is that it actually expects a number, okay? So you can see that the structure of this page looks quite different from the other ones we have seen before and I’m going to go over this very shortly.
Changing conversation topic
Duration: 0:04:40
CCAI Vaccine Bot Demo

(Autogenerated transcript) [00:00:00] Alright, so in this chapter we are going to take a look at how to handle conversation topic changes in Dialogflow CX and for this I am going to take an example of a YouTube video demo which has been posted by the Google Cloud tech channel where they provide a demo for the contact center AI vaccine hotline bot and it’s actually supposed to be a demo for the contact center AI technology which is not exactly the same thing that we are using in Dialogflow it’s a little different but it’s actually a good illustration of a case where the user changes the topic.
Duration: 0:01:27
Start Page Routes

(Autogenerated transcript) [00:00:00] Alright, so we are in the agent in the Dialogflow CX console for the agent and what I have here is the Start Page and you can see that it has six routes in total, I’m sorry six intent routes in total and these are the six. The first two are the first one is the Default Welcome intent and the second one or the second and third ones are the questions where the user is going to ask is the vaccine free and is the, are there any animal based ingredients in this and the fourth question is where the user asks about eligibility, the fifth one is where can I get the vaccine and then the final one is where the user says I would like to talk to a representative.
Duration: 0:01:21
Simple FAQ Routes

(Autogenerated transcript) [00:00:00] Alright, so let’s quickly go over the simple FAQ type answers. When the user asks, is the vaccine free? So I’m going to click on that intent route. And if you go and edit the intent to see the training phase, you can see that that’s just this phrase is the vaccine free. And the bot is going to respond with the COVID vaccine will be available at no cost and then what that’s going to help you with. And then it doesn’t do any page transitions.
Duration: 0:07:26
Eligibility Flow

(Autogenerated transcript) [00:00:00] All right, so now let’s take a look at the flow which handles the user’s question about whether they are eligible. So I have clicked on this user asked about eligibility transition route and if you were to go and take a look at the intent training phrase, it just says am I eligible for the COVID vaccine. Now when the user asks this question, the bot is going to say in order to determine your eligibility, I need to ask you a few questions.
Duration: 0:07:00
Eligibility Flow Conflict Part 1

(Autogenerated transcript) [00:00:00] Alright, so in this video, I’m going to show you a behavior in dialogue for CX, which I think is a little strange. And it could be a good thing or a bad thing, but it’s it I think it depends on the situation. So what I’m going to do is I’m going to add another intent route into the Start Page. And I’m going to call it Yes, yes, says yes, that and this is intended to be a response where when the bot asks, is there anything else that I can help you with the user might say, Yes, there is.
Duration: 0:05:01
Eligibility Flow Conflict Part 2

(Autogenerated transcript) [00:00:00] Alright, so in the previous video I explained why you needed this anything else page which is supposed to handle the case where the user says yes after they answer a question. Now you might be wondering, so what I did wasn’t exactly the best way to go about it. After all there is one more thing I could have done, right? What if I had simply added the same route instead of going after like a new one, if I simply say yes, user says yes
Duration: 0:03:00
Vaccine Location Flow

(Autogenerated transcript) [00:00:00] All right, so now let’s go to the last conversation flow that we are going to handle. So, which is where can I get the vaccine and the user asks where can I get the vaccine, I just have this training phrase where can I get the vaccine, then the bot is going to transition to this page called get zip code. Now, if you come to this get zip code page, you will notice that it is expecting this parameter called zip code, ok.
Duration: 0:02:34
Vaccine Location Flow – Testing the agent

(Autogenerated transcript) [00:00:00] Alright, so let’s test the behavior of this agent now. Where can I get the vaccine? So it’s first going to ask for the five digit zip code. And I’m going to say, I don’t know. So you can see that it actually asks you, you must enter a five digit zip code. So if I say again, I don’t know. It’s just going to say, sorry, there was a problem. Please try again later. So let’s start again. Where can I get the vaccine?
System Functions
Duration: 0:00:52

(Autogenerated transcript) [00:00:00] Alright, so in this video we are going to talk about system functions in Dialogflow CX and how you can use them to, usually the idea is that you can do things so that you don’t have to call the webhook, you can add like logic, business logic directly into your Dialogflow CX inside the CX conversation builder itself. And as you can see, there are a few different ways that you can use the system functions or rather a few different places where you can use it.
Duration: 0:05:04
The quiz bot

(Autogenerated transcript) [00:00:00] So to demonstrate the use of system functions, I’ve created an agent called sysfunk, as you can see over here. And it just has no intents right now. It just has the Start Page with the Default Welcome intent. And as you know, the Default Welcome intent will answer to messages like hi and hello and all that. And what I’m going to do is, as soon as the user says that, I’m going to just, this is sort of a pretend quiz bot.
Duration: 0:05:45
Text response

(Autogenerated transcript) [00:00:00] So now that you have created this quiz, the first thing that we want to do is tell the user the score that they got at the end of the quiz. So the first thing that I’m going to do for that is I’m going to create the, in the answer.write, you can actually set a parameter and parameter is just going to be score underscore 1 and the value is going to be 1. And correspondingly what you want to do is in the case of the wrong answer, you will create the same parameter instead of 1 you will say the score is 0 because they didn’t get any points for that answer.
Duration: 0:04:45
Conditional response

(Autogenerated transcript) [00:00:00] As you can see in the documentation, you can also use these system functions inside of conditional responses. And to show you an example of what the conditional response might look like, you can see that you can construct these if-else and end-if blocks. You can construct these kind of blocks as text responses rather in your fulfillment section. I’m going to take the same example and I’m just going to show you how you can do that.
Duration: 0:02:02
Custom Payload

(Autogenerated transcript) [00:00:00] You can also use system functions with the .2 text in any text you use inside custom payloads. I’m going to show you a very quick example. So this is the description response in Dialogflow Messenger. So let’s go ahead and copy this and I’m going to paste it over here and what I’ll do is I’m just going to say results as the title and then in the text I’m just going to copy the whole thing from the agent over here
Duration: 0:06:04
Parameter Presets

(Autogenerated transcript) [00:00:00] All right, so let’s take a look at how we can use system functions inside parameter presets. And I think this one is a much cooler application of system functions, because you can actually do certain things, which I think are much harder to do. Well, I shouldn’t say much harder, but it’s just that you will be able to do certain things without calling the webhook. And you might not have actually expected that.
Duration: 0:04:27
Condition Routes

(Autogenerated transcript) [00:00:00] So finally, we can also use the system functions inside conditions. And I’m going to show you how you can do that. So this time, what I’m going to do is I’m going to tell the user. So let’s go to the end of the quiz. And here, I’m going to add another message where I tell the user if they got all the answers right, I’m just going to congratulate them. And the way I’m going to do that is going to be a bit, once again, it’s a bit like convoluted, you might say, but I think it is a very nice way to showcase the power of those conditions inside of the Dialogflow CX.
Quickstart Templates Resources
Text Lesson
1 Getting a list of inputs from user

Video tutorial Download agent ZIP file
Text Lesson
2 Initiate conversation from CX

Read the full tutorial Download agent ZIP file
Text Lesson
3 Save data to Airtable

Watch the video tutorial Download agent ZIP file import os from flask import Flask, request from dotenv import load_dotenv from pyairtable import Table import json load_dotenv() api_key = os.getenv(‘AIRTABLE_API_KEY’) base_id = os.getenv(‘AIRTABLE_BASE_ID’) table_name = os.getenv(‘AIRTABLE_TABLE_NAME’) app = Flask(__name__) @app.route(‘/’) # this is the home page route def hello_world(): # this is the home page function that generates the page code return “Hello world Airtable!” def save_to_db(req): try: session_info = req.get(‘sessionInfo’) name = session_info.get(‘parameters’).get(‘person’).get(‘name’) email = session_info.get(‘parameters’).get(’email’) url = session_info.get(‘parameters’).get(‘url’) table = Table(api_key, base_id, table_name) result = table.create({‘Name’: name, ‘Email’: email, ‘Website’: url}) return ‘Thanks.
Text Lesson
4 Basic slot filling

Watch the video tutorial Download agent ZIP file
Text Lesson
5 Confirm or update user input after slot filling

Watch the video tutorial Download agent ZIP file
Text Lesson
6 Advanced slot filling

Watch video tutorial Download agent ZIP file
Text Lesson
7 List and composite entities

Watch video tutorial Download agent ZIP file
Text Lesson
8 Get user date of birth

Watch video tutorial Download agent ZIP file
Text Lesson
9 Decision Tree Bot

Watch video tutorial Download agent ZIP file
Text Lesson
10 Quiz Bot

Watch video tutorial Download agent ZIP file
Text Lesson
11 Use Google Sheets as a database

Watch video tutorial Download agent ZIP file from flask import Flask, request import json import os from dotenv import load_dotenv import requests app = Flask(__name__) load_dotenv() SHEET_BEST_API_KEY = os.getenv(‘SHEET_BEST_API_KEY’) SHEET_BEST_ID = os.getenv(‘SHEET_BEST_ID’) def set_planet_attribute(req): intent_info = req.get(‘intentInfo’) planet = intent_info.get(‘parameters’).get(‘planet’).get(‘resolvedValue’) attribute = intent_info.get(‘parameters’).get(‘attribute’).get(‘resolvedValue’) value = intent_info.get(‘parameters’).get(‘value’).get(‘resolvedValue’) url = f’{SHEET_BEST_ID}/search?Planet={planet}&Attribute={attribute}’ requests.patch( url, json={ ‘Value’: value, }, headers={ ‘X-Api-Key’: SHEET_BEST_API_KEY } )

About this website

BotFlo1 was created by Aravind Mohanoor as a website which provided training and tools for non-programmers who were2 building Dialogflow chatbots.

This website has now expanded into other topics in Natural Language Processing, including the recent Large Language Models (GPT etc.) with a special focus on helping non-programmers identify and use the right tool for their specific NLP task. 

For example, when not to use GPT

1 BotFlo was previously called MiningBusinessData. That is why you see that name in many videos

2 And still are building Dialogflow chatbots. Dialogflow ES first evolved into Dialogflow CX, and Dialogflow CX itself evolved to add Generative AI features in mid-2023