PRIYANKA VERGADIA: Welcome to Deconstructing Chatbots.
I am Priyanka Vergadia, and in this episode,
we are going to build our first chatbot.
[MUSIC PLAYING]
Like a promise, we are going to jump right
into the Dialogflow interface.
Navigate to console to Dialogflow.com and sign in.
If you're a first time user, then just use your email
to sign up.
Accept all the terms and conditions,
and you'll be in the console.
Now, create new agent.
Let's call this appointment scheduler.
Dialogflow creates a GCP project for you
to access logs and Cloud functions.
You can select an existing project as well.
Then, just create.
You get two default intents as a part of your agent.
The default welcome intent helps greet your users.
And the default fallback intent helps catch all the questions
that your bot does not understand.
At this point, you have a functional bot.
All it does is greet the users.
Well, let's test it.
If we say hi, our bot responds back
with a hi, and a how I can help message.
Once you ask for help, such as, set an appointment,
it does not know what to do.
So it kicks in the fallback intent,
obviously because we've not created any intent
to catch that particular request.
So let's add that now.
Let's create a new intent and call it schedule appointment.
We will skip context and events for now.
Let's get down to the training phrases
and add some phrases here.
As you're putting these in, you will
see date and time are automatically identified
as system entity date and time.
Now, to make this functional, we need
to respond back to the user.
So let's add a response.
You could just say, you're all set, see you then.
Or you could make it a little bit more interesting and say,
you're all set for this date and this time.
See you then.
The dollar sign here helps you access the entity values.
Let's test it with, set an appointment for 4:00
PM on Thursday.
And as expected, you get the right response
with the right date and time.
Now, what if somebody just said, set an appointment?
Well, that is not really specific,
and we have not yet handled that scenario in our bot.
To support this, we use something called slot filling.
We make the entities as required,
and Dialogflow will make sure to ask for both date and time
before it responds back.
Let's add, what time would you like
to come in, for the time prompt, and what date,
for the date prompt.
You can add other variants, too, and then just save.
OK, let's test one more time to see if things are working.
Let's say, set an appointment.
Our bot responds with, what time would you like to come in?
And I say, 10:00 AM.
And then it asks for the date, and I say February 12.
All right, got all that.
It's all working.
OK, so all the testing we did so far has been in the simulator.
But what if you wanted to share this win with a friend?
Let's go into integration and enable the web demo.
And just like that, you have a link to your bot
that you can share or a iFrame into your website
or mobile application.
You can test to see if it's working.
All right, so today we set up a simple appointment scheduler
that takes date and time as input variables,
and responds back to the user with an appointment
confirmation.
We also learned about slot filling.
If a user only provided us with a date, or time, or nothing,
how you can prompt the user to provide the missing information
seamlessly.
And finally, we learned how to test our bot in the simulator
and integrated it into a website.
Don't miss the next episode of Deconstructing Chatbots
because we are going to make our appointment
scheduler a little bit smarter.
[MUSIC PLAYING]