User Asks For Balance

Autogenerated YouTube transcript

[00:00]. All right so as I pointed out in the

previous video a page represents a state in your vending machine flow diagram so what I’m going to do now if you remember the vending machine flow diagram you had four states you had the state of zero balance 25 cent balance 50 cent balance and 75 cent balance so what we are going to do now is create a page representing each of these states I’m going to add a

[00:30] page

. And I’m going to call it state 0. And I want you to notice that it comes it gets added under the list of pages. But it’s also added into a new section so that you don’t confuse it with the defaults which are always present in any given flow. And then you have state 25 then you have state

[01:00] 50. And then you have

state 75 all right. So I’m just making it very simple calling the name of the state by the remaining balance at that point in the interaction you can say All right, now the next thing I’m going to do is when the user asks what is my balance I want the bot to provide the balance to the user based on what state they are

[01:30] in

. Okay now there is a question that should be on your mind right now which is how does the user go to any of these states and that’s a good question but we’ll come to that later. So for now what I’m going to do is I’m going to just go into the start page And notice that the start page is actually different from the state 0. And I have a reason for that and you will understand why as I go through this set of videos

[02:00] what I’m going to do is create a new

intent. And notice that here in the selection you can either select a new intent or you can select an existing intent I’m going to say new and here I’m going to say what is my balance that’s just an indication that the user is asking for their balance okay now it says what is my balance that’s the training phrase let’s press enter and let’s go ahead and save it

[02:30] now ignore this condition but come down

to this fulfillment section And here the agent should say you haven’t yet added any money please begin by adding a quarter all right. So that’s all and you don’t do anything else after that just go ahead and save it. Okay now if I were to go to the test agent and if I were to say

[03:00] hello you can see that it got mapped to

the default welcome intent as expected and if I were to say what is my balance it just says you haven’t added any money please begin by adding a quarter. So what I’m going to do now is I’m going to add another intent here called into the intent routes of the start state and this time I’m going to create a new

[03:30] intent and call it

add a quarter. Let’s just go ahead and type that in add a quarter and Let’s just go ahead and save that All right, now in the fulfillment the agent is simply going to say. I added a quarter and we don’t want anything else the agent to say anything else other than

[04:00] sort of like echo back what the user did

. But this is the important thing after this has happened that is the the agent has responded back with okay. I added a quarter the next thing that I want you to do is go down to this transition and click on state 25 so what are we doing here this is a example of moving from one state to another that is

[04:30] what this transition means

. So if based on the fact that it’s called page transition you should be able to somewhat understand that it is effectively saying that you’re moving from one state to the other state and if you remember the vending machine part if you had to add a quarter from the start state it should go to the state called the 25 cent state which is what we represent here as state 25 right. And I don’t want you to do any of the other things over here

[05:00] just ignore

all these things and just save this intent that we have created so right now in the start state we have default. Welcome what is my balance add a quarter. And the thing is let’s say that the user says add a quarter right and that actually fires this intent as you can understand and it also goes to this new page called state 25 by doing this page

[05:30] transition

. But how do you know that you are in state 25 see right now state 25 is completely empty. Right so what I’m going to do now is I’m just going to edit fulfillment. And I’m going to say something like you have entered state 25. Okay let’s just make it simple right let’s do that. And as I test the agent I think it will become

[06:00] quite clear what’s going on here.

Transcript auto-formatted using ATF

Free: Dialogflow ES Crash course for non-programmers

I recently changed the name of my website from Mining Business Data to BotFlo. To help spread the word, and to hopefully get people to bookmark my website, I am making a set of my training courses free for a few weeks. 

Learn more
"The magic key I needed as a non-programmer"

The custom payload generator was the magic key I needed (as a non-programmer) to build a good demo with rich responses in DialogFlow Messenger. I've only used it for 30 minutes and am thrilled. I've spent hours trying to figure out some of the intricacies of DialogFlow on my own. Over and over, I kept coming back to Aravind's tutorials available on-line. I trust the other functionalities I learn to use in the app will save me additional time and heartburn.

- Kathleen R
Cofounder, gathrHealth