When you need specific information to be collected from customers, you can use Send a Message node to ask a question and save the answer to a certain variable, or use Build a Form node to collect a series of information easily. We recently updated validation feature for the data you collect from customers, so you don't need to worry about the quality of it.

The validation only works with String type variables. It’s not too hard to learn how this new feature works, but there are a few things you should remember to avoid possible mistakes.

Step 1. Create String type variables with validation setting

Option 1. Creating a variable under the Settings menu
Option 2. Creating a variable in the chat flow editor
  1. Login to your Alli dashboard and start creating String type variables. There're two ways to do this.
    Option 1 - Go to Settings > VARIABLES > CUSTOM and click '+ADD'. Check out this post to learn how to manage variables in general in the Settings menu.
    Option 2 - Start designing your chat flow and add new variables in supported nodes when necessary. Click on 'Create a new variable' from the dropdown menu when you select a variable to save customer response.
  2. As soon as you select the String type, you'll see validation setting appears. Select which validation type you'd like to apply to the variable and type in error message for invalid input.
You'll see Validation settings when you select String type

Currently, Alli provides Email and Phone number validation as default. Other than that, you should create custom validation using regex (regular expression). If you're not familiar with regex, check out some examples at the bottom of this post.

Step 2. Use the variables to design your chat flow

Currently, ’Send a Message’ or ‘Build a Form’ node supports the validation feature.

Step 3. Make sure if the validation works as intended

You can use PREVIEW and see if the validation works. If incorrect format is detected, customers will see this warning message and cannot proceed.

[Advanced Use] Examples of Custom Validation Using Regex

  • ^[0-9]{2,3}$ : Two or three digits of numbers
  • ^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d$ : Date in mm/dd/yyyy format
  • ^[0-9]{2,3}[-]+[0-9]{3,4}[-]+[0-9]{4}$ : Phone number format Alli provides
  • (^\w[a-zA-Z0-9_.+-]*@(\w[a-zA-Z0-9-]*\.)+[a-zA-Z]+$) : Email format Alli provides

You can always google 'regular expression for~' to find good examples of regex formats. For more information about regex, you can check out this website: https://netpeaksoftware.com/blog/regular-expressions-for-seos-and-digital-marketers-with-use-cases