In this article, I will explain how you can use slot filling to get a list of user inputs in Dialogflow ES.
Before we go further, a couple of things to note: I usually avoid slot filling in Dialogflow ES If are quite sure you need to use slot filling, it is best to go with Dialogflow CX
This will be one of the canonical slot filling examples: booking a flight ticket
We need the following pieces of information
- Departure date
- Return date
- Flight class
- Number of passengers
The appeal of slot filling is that the user might provide this information in any order and Dialogflow’s slot filling is smart enough to extract as much useful information as possible from the user utterance and prompt for the rest automatically.
When it works, slot filling makes for an amazing demo! And when it fails, it is equally spectacular.
Create an entity called flightclass
Create an intent called book.a.flight and add the following training phrases
Number of passengers will be a system entity of type sys.number-integer
The departure and return dates are system entities of type sys.date-time
The from and to cities are system entities of type sys.geo-city
The flight class slot is a user defined entity we declared earlier – flightclass
Here is the full list of training phrases
Open the Parameters section and mark ALL the parameters as required
Now click on the “Define prompts..” for flightclass
Add the following prompt for the flightclass
Add the following prompt for the city of departure
Follow the table below for the rest of the prompts
|flightclass||What class are you flying? (Economy, Business or First)|
|fromcity||Where are you leaving from?|
|tocity||Where are you flying to?|
|departuredate||What date do you leave?|
|returndate||What date do you plan to return?|
|numpassengers||How many passengers?|
This is what your parameter table should look like after you add all the prompts
Now let us test this bot by trying different types of starting sentences
First, we start with just the intent phrase:
Next we start the number of passengers
Next we start by providing from and to locations
Next we start with the departure and return dates
But sometimes the bot can get into a loop. This is the biggest problem with slot filling, and usually the source of jokes online about how chatbots don’t work.
<— End of article —>
This website contains affiliate links. See the disclosure page for more details.
"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
"Much clearer than the official documentation to be honest" Thanks a lot for the advice (of buying and following your videos)! They helped a lot indeed. Everything is very clear when you explain, much clearer than the official documentation to be honest 🙂 Neuraz T Review for Learn Dialogflow CX
"I will strongly recommend this course because even I can learn how to design chatbot (no programming background)" I think Aravind really did a great job to introduce dialogflow to people like me, without programming background. He organizes his course in very clear manner since I have been a college professor for 20 years. It is very easy for me to recognize how great Aravind’s course is! Very use-friend and very easy to follow. He doesn’t have any strong accent when he gives the lectures. It is so easy for me to understand. Really appreciate it. Yes, I will strongly recommend this course because even I can learn how to design chatbot (no programming background) after studying Avarind’s course, you definitely can! Ann Cai Review for Learn Dialogflow ES