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 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 [m1] 50.
And then you have state 75.
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.
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 in.
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.
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 [m2].
What I’m going to do is create a new intent okay.
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.
OK, now it says what is my balance that’s the training phrase let’s press enter.
And let’s go ahead.
And save it 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
If I were to go to the test agent and.
If I were to say [m3] 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 okay
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 intent.
And call it add a quarter okay
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 okay I added a quarter.
And we don’t want anything else the agent to say anything else other than [m4] 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 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 [m5] 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 okay.
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 transition but how do – you know – that you are in state 25 see right now state 25 is completely empty right
What I’m going to do now is I’m just going to edit fulfillment okay.
And I’m going to say something like you have entered state 25.
Let’s just make it simple right.
So let’s do that.
And as I test the agent I think it will become [m6] quite clear what’s going on here