Reputation: 67
I was just wondering about the best way to handle when a users intent cannot be understood multiple times.
e.g. In the case of a chat bot a user may enter an intent that cannot be understood multiple times, after the third time I would like the chat bot to call a webservice.
What is the best way to handle this scenario? Possible scenarios I have come up with are:
1) Each time the default fallback intent is called we call a web service that keeps track of the number of times the default fallback intent has been called for the current user and on the third time call another service.
2) Chain multiple default fallback intents together in DialogFlow and on the call to the third fallback intent we make the call (Is this even possible or a good idea?)
3) Keep track of the number of times the default call back is called within DialogFlow (By using an Entity I believe) and then on the third attempt we call the Web Service.
Any recommendations or ideas happily received as I am new to DialogFlow
Upvotes: 1
Views: 998
Reputation: 50741
If you mean "Followup Intent" in (2), this would be a bad idea. Just about anything involving chains of Followup Intents are a bad idea.
I'm not sure how you would pull off (3), to be honest. Dialogflow itself has very little ability to include logic of this sort.
The best approach is (1) - for everything, call your fulfillment webhook and have it handle the logic. Typically, you want to count consecutive times the user hits the Fallback Intent, rather than the total times you do so. You can keep this counter in a short-lived Context.
(Libraries such as multivocal keep track of the counter for you, as an aside, and let you use it in responses or in other logic handling.) (Disclaimer, I'm the lead developer for multivocal.)
Upvotes: 2