Why Data Validation Matters

Why Data Validation Matters
Photo by Lukas S / Unsplash

When a bot asks for a phone number and the user types "Hello," a standard bot might break or save useless data. Cornblue handles this with Exception Handling, providing specific "Wrong Answer" responses until the user provides high-quality data.


1. The Basics: Text & Numbers

  • Free Text (free): The "wildcard" rule. Use this when you want to capture open-ended feedback or comments without any restrictions.
  • Letters & Numbers (letter_number): Perfect for usernames or SKU codes. You can set a Minimum ($L) and Maximum ($M) length to ensure the input fits your database constraints.
  • Only Letters (letter): Ideal for capturing names. It rejects numbers and special characters, ensuring you don't get "John123" in your CRM.
  • Only Numbers (number): Used for quantities, ages, or any numeric value. Unlike text length, this validates the value of the number (from $L$ to $M$).

2. Contact & Identity

  • Email (email): Uses a complex Regex to ensure the user enters a valid format (e.g., name@domain.com). It prevents typos from ruining your email marketing list.
  • Phone with Prefix (phone_prefix): Specifically looks for numbers starting with 0 (e.g., 0812...). Great for local Indonesian businesses.
  • Phone without Prefix (phone_wo_prefix): Validates international-style numbers or those without the leading zero.
  • Credit Cards (cc): A powerhouse rule that recognizes major card types (Visa, Mastercard, Amex, etc.) by their unique numerical patterns.

3. Specialized Formats

  • Date (date): Enforces the DD-MM-YYYY format. It even accounts for leap years and specific month lengths, so no one can enter "31-02-2026."
  • Time (time): Restricts input to the HH:MM (24-hour) format, essential for booking nodes and appointment scheduling.

4. Logical Choices (Smart Options)

  • Gender (gender): A quick validation that only accepts "Male" or "Female" (case-insensitive).
  • Yes/No (yesno): Filters the conversation down to a binary choice, preventing users from derailing the flow.
  • Custom Options (option2 to option5): These are incredibly powerful. You can define up to 5 custom "keywords" (e.g., "Regular", "Premium", "VIP"). If the user doesn't type one of your specific options, the bot gently asks them to try again.

5. The Professional Tier: Custom Regex

  • Custom Regex (regex): For advanced developers. If you have a very specific requirement—like a license plate number, a specific employee ID format, or a complex password—you can write your own Regular Expression ($R) to enforce it.

Stop Cleaning Data, Start Using It

With these rules in place, your Analytical Report Summary (which we discussed in the previous article) becomes even more powerful. Because the data is validated at the source, your reports will always be 100% accurate and ready for action.

Ready to tighten your chat logic? Open a Question Node in the Cornblue and select your Validation Type today!