So the next assignment is to allow the user to actually buy a product.
What I’m going to do is as soon as I start I’m going to say give me a Snickers okay.
And you can see that it says you need at least 25 cents to buy Snickers your current balance is zero cents because we haven’t added anything right.
So I’m going to say add a quarter.
And it says okay I added a quarter you have entered state 25.
Now I’m going to say give me a Snickers .
And you can see that it says okay here is a Snickers bar your balance is now zero cents which is great wonderful.
And the next thing I’m going to do is I’m going to say give me a Twix you can see that it says your balance must be at least 50 cents to buy a Twix your current balance is 0 cents
What I’m going to do is I’m going to add a quarter.
And I’m going to say the same thing again give me a Twix [m1].
And once again it’s not going to allow you to buy because your balance is still not sufficient.
So let’s add another quarter and.
Now I’m going to say give me a 2x.
And this time it’s coming back with okay here is a Twix your remaining balance is 0 cents.
Let’s just change it a bit let’s add a quarter add another quarter and.
Now, the balance is 50 cents and.
If I were to say give me a Snickers you can see that okay here’s a Snickers bar your balance is now 25 cents.
And because I still have 25 cents left I should be able to get another Snickers bar.
So let’s check that give me a Snickers.
And you can see that it says okay here’s a Snickers bar your balance is now zero cents.
If I were to get try to get one more Snickers it should refuse it because [m2] I don’t have any balance left at the moment.
So this is the flow which you should again this you should be able to do all this just using page transitions.
And the state machine concept that you’ve already learned.
And you should be able to move the move the bot from state to state based on what balance is available based on the action that the user has performed.
So this is the second assignment
<— End of article —>
This website contains affiliate links. See the disclosure page for more details.
Check out the Learn Dialogflow ES and Learn Dialogflow CX courses if you would like to learn Dialogflow in depth.
"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