I’m facing some issues while validating some data. I’m building a “market” in which you ask for a product and a quantity with it’s units ( kg for example). In the validation I check an API so i can ensure that the given units goes with the product, so nobody could ask for 2 liters of fish, which makes no sense.
The problem here is that while fetching the data from the API I want to utter a message saying something like: Searching… But, if I try dispatcher.utter_message it waits til the validation is over to utter the message. Is there any way to solve this? Because the API calls are too slow.
What you could do is implement the required_slots() method, and if it’s the turn of that slot, you can dispatch the message before return, and the validate() method will take place after that.
The problem here is that I only need to dispatch the message if a condition is met, so, it makes no sense to ask the bot to say a phrase at the beginning of the validation, it must be while validating, at least to let the user know that the chatbot is thinking.