1

There is some way to validate a user input and request it again, either by webhook or intents, for example asking the user a number from 1 to 10 and if the user enters a larger or a smaller one ask him to enter another number until the number this within this range?

2 Answers2

1

When you design a Dialogflow conversation, one needs to study the concept of intents. When an intent is matched, this can invoke a component called a fulfillment which is passed the information supplied by the user. For example, if the user says "Set the value to be 7" then this will be matched (perhaps) to an intent called "set_value" with an entity parameter value of "7". The fulfillment logic that you write will then receive this data and process it. Based on the supplied data, it could detect that the parameter (a number) is out of range and could dynamically respond with an indication that the number is invalid and ask the user to try again.

Here is the documentation on Configure fulfillment. My recommendation is to study this area. What you respond with in when the fulfillment is invoked is completely up to your own processing and is not a "static" response as would otherwise occur without using fulfillment.

Kolban
  • 13,794
  • 3
  • 38
  • 60
0

Let's assume the intent name is ask_number which is asking the user a number from 1 to 10.

It can be achieved in a few ways:

  • If the intent ask_number has some input context defined already, then you need to set that context again as output_context and reply something like you have entered a smaller/bigger number, please enter again.

  • If the intent does not have any input context then you can simply reply you have entered a smaller/bigger number, please enter again and your intent should be able to catch that as well. But this can cause problems as well.

  • What I would recommend is having another intent ask_number_followup with an input_context number_validation_failed, in the logic if the number is smaller/bigger you set this in output context and reply to the user.

Hope it helps.

sid8491
  • 6,622
  • 6
  • 38
  • 64