People do mistakes. Either intentionally or not. That’s a fact of life, and your chatbots should be prepared.
When you ask your chatbot users for data (like numbers, emails, or phone numbers), sometimes the response will be unexpected. So, it makes sense to check what exactly is in the user’s reply before placing that value into the user attribute and using it further in the conversation.
Example use of the VALIDATION block to check if the email is correct
Once this block is executed, you can check the value of the $_validation_result system attribute to see if the value has a correct format. It will be true if everything is ok, and false otherwise.
This approach is a bit more complex than the common one used by other chatbot platforms like Manychat, for example, when you indicate the type of content you expect and add a hard-coded message to display if the value has an incorrect format. But it allows you to build much more flexible and intelligent conversations!
Checking if the email and phone number have correct formats