When you use required parameters in Dialogflow, you are telling Dialogflow - "please ensure that this parameter is actually collected from the user". When you mark a parameter as required, it will trigger slot filling - and Dialogflow will keep prompting the user until they provide the input. As of this writing (June 2019), there isn't any way to limit the maximum number of retries.
I don't recommend that people use slot filling in their Dialogflow chatbots. It makes your bot brittle, unpredictable and hard to reason about.
Why I avoid using slot filling
Slot filling requires quite a few things to work well:
- perfect entity recognition
- complete entity specification
- no typos in entity names (usually0
- full cooperation from user
Do you actually need slot filling?
This brings up a question - do you actually even need slot filling for your bot? I have seen my clients use it for all kinds of scenarios where it doesn't even make sense (and they cannot get it to work, and I fix their bots to stop using slot filling so it starts working).
There are some scenarios where slot filling is a reasonable fit (but I will still avoid it for the reasons mentioned before).
3 scenarios where you should avoid slot filling
Now that you have seen where slot filling might make sense, slot filling should definitely be avoided in the following scenarios:
- Do you need to ask user to confirm their input?
- Does user need to input entity values which Dialogflow doesn't identify consistently?
- Do you need to ask for a list selection?
What is slot filling using webhooks?
It is possible to fill some slots using webhook code. I don't recommend using this feature at all.
But you can read the following article to see what the feature promises.
Slot filling vs follow up intents
Sometimes, readers get slot filling and followup intents mixed up.
In the article below, I explain the difference.
Slot filling using REST API
Can you use the REST API if you are using the slot filling feature? Yes, you can.
What changes? Nothing changes, really. You just need to understand how contexts are maintained when using Dialogflow's REST API.
Reader Question: Do you still think slot filling is a mess?
Yes, I do.
I haven't seen any convincing argument in favor of using it yet.
Mini-Course: Understanding Slot Filling
You can check out my "Understanding Slot Filling" mini-course if you want to understand what is happening under the hood when you use slot filling, and why it is so difficult to build maintainable chatbots if you use the feature.
Get the mini-course for free
You can get the mini-course for free if you enroll in my Better Dialogflow Bots course.