Skip to main content

Conversation Element: Validating user-input


 This conversation element can be used to validate the current value of any variable.

Why validate a variable?

You may need to validate the value of a variable for a number of reasons. Suppose you have a script in which you ask the end-user, their age. You may use their age to show products that are relevant to that age group. Let's assume you stored the value of the end-user in a variable name "UserAge". In order to show age-related products, you need to validate the variable using this conversation element. e.g. If the value of "UserAge" is greater than, let's say 20, show products that are relevant to adults, otherwise show products relevant to teenagers. 

Configuring this Element?

  1. Click on the "Validate user input" icon to add this element to your auto-reply script.




  2. Once the "Validate the input" element is added to your bot design, click on the "cog" to open the settings page.
  3. On the settings page, select the variable whose that you want to validate.
  4. Select the criteria to validate the value of the variable and follow the prompts.

Validation criteria 

 You can validate a variable using multiple validations criteria this conversation element has two outputs "true" and "false" if the criteria is matched, the reply will start flowing in the "true" direction. If it is not matched, the reply will flow in the "false" direction as shown. 


  1. If the value is a Number: This criteria will check if the input provided by the user is a number. It is good practice to validate the input type before using it anywhere else. E.g. if you are expecting end-user to type their age, you can use this criterion to check whether the input is number or not.
    This criterion will only be "true" if the input is a number, otherwise, it will be "false"
    e.g. "true" : 5,10, 50,100
           "false": abc, ten, 5b
  2. If the value is a single word: This criteria will check if the input is a single word. e.g. If the input is without any space, then, this criterion will be "true". This type of validation is useful in scenarios where you are expecting the end-user to input a single word e.g. while providing first or last name while typing password etc. 
    "true": alec , b51, 28
    "false": John Doe, b 51
  3. If the Value is an email address: This criteria will check if the input is an email. This type of validate is useful when you are expecting an email address to be provided by the end-user. 
    "true": jame@example.com, john.doe@example.com
    "false": John Doe, abc, @example.com
  4. If the Value is equal to something : This criteria will check if the input is equal to any other value. For this criterion, you are also required to provide the comparison word.
  5. If the Value is greater to another number :This criteria will check if the input is greater than the comparison number. If the input is not a number, this criterion will always result in "false"
  6. If the Vlaue is less than another number : This criteria will check if the input is less than the comparison number. If the input is not a number, this criterion will always result in "false"
  7. If the value contains something :This criteria will check if the input is provided by the end-user contains the comparison word or sentence.

Comments