0

I am trying to build a bot with the help of google dialog flow. The use case is to book a ticket. I did build a BOT. But the user can say yesterday's or already completed date and time. I want to add conditions to check whether the said time and date are in the past or future. If they are in the past, I want to ask date and time again. Can you point me to some links and blogs to learn how to do so?

  • Hey, Saishantan. I suggest taking a dive into the Dialogflow Essentials documentation. You would be looking at creating two intents, one where a valid data is provided and one where the date is invalid. When you add training phrases with dates, they will automatically be recognized as a `@sys.date-time` parameter https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters Then you can validate the dates as needed, and return the re-prompt intent if the date is not valid – Yael Araizaga Jul 05 '21 at 16:56
  • It's very likely that since this system is going to book tickets and might interact with a database, you will also need to look into fullfillments https://cloud.google.com/dialogflow/es/docs/fulfillment-overview where a chatbot will interact with other parts of your systems to determine the best response. – Yael Araizaga Jul 05 '21 at 17:00
  • Here is a blogpost of somene listing doing something similar, do note they are using node.js and the blogpost is from 2018, so it might be a bit outdated. https://joeywhelan.blogspot.com/2018/04/google-dialogflow-input-validation.html – Yael Araizaga Jul 05 '21 at 17:04
  • Hi @YaelAraizaga, the mentioned methods were tried already. But did not work – Saishantan goli Jul 06 '21 at 07:35
  • Could you elaborate on how it did not work? Please note that Dialogflow is not designed for conditional responses like a programming language would do (e.g. `if`, `else` clauses), instead it is meant to use intents and [fulfillments](https://cloud.google.com/dialogflow/es/docs/fulfillment-overview) to give the best response possible. This means that if you want a conditional, you would build it around Dialogflow itself. You can read further into this in this other answer https://stackoverflow.com/questions/51464824/dialogflow-respond-based-on-values-and-other-conditional-responses – Yael Araizaga Jul 06 '21 at 14:25
  • Also, you can use the [inline editor for fulfillments if you want to test it out](https://cloud.google.com/dialogflow/es/docs/fulfillment-inline-editor) – Yael Araizaga Jul 06 '21 at 15:06

0 Answers0