Validations Tab
Introduction
In Validations tab, you can choose the way the data provided by the caller is validated against preset rules. You can add multiple validations and prioritize them accordingly or you can use your own custom validation by providing a URL and a token.
Custom validation overrides any other validation.
If multiple validations are set, with different prompts, only the prompts of the last validation will be used if validation fails.
Validation in minApps
Validation is available for the below miniApps.
Alpha miniApps
In Alpha miniApps, you have the following options:
Min Length: Set the minimum number of characters
Max Length: Set the maximum number of characters
Regex: Set the regex pattern
Javascript: Provide JS code that will return a boolean value (true/false) that indicates if it passes the validation
In list: Set a preset list of accepted string values
You can use any combination of these options in a single validation.
Alphanumeric miniApps
In Alphanumeric miniApps, you have the following options:
Min Length: Set the minimum number of characters
Max Length: Set the maximum number of characters
Regex: Set the regex pattern
Javascript: Provide JS code that will return a boolean value (true/false) that indicates if it passes the validation
In list: Set a preset list of accepted string values
Prebuilt: Use either the US zip code, or the CA zip code prebuilt list
You can use any combination of these options in a single validation.
Amount miniApps
In Amount miniApps, you have the following options:
Min Value: Set the minimum number of characters
Max Value: Set the maximum number of characters
Javascript: Provide JS code that will return a boolean value (true/false) that indicates if it passes the validation
Amount Unit: Set the unit that the amount is measured ($, €, %)
Amount Type: Set the amount type (monetary, percentage)
You can use any combination of these options in a single validation.
Date miniApps
In Date miniApps, you have the following options:
Date Range: Choose the date range of the expected caller reply by selecting a specific date, the time of he call, or in general a point in the past or in the future
Javascript: Provide JS code that will return a boolean value (true/false) that indicates if it passes the validation
Numeric miniApps
In Numeric miniApps, you have the following options:
Min Length: Set the minimum number of characters
Max Length: Set the maximum number of characters
Min Value: Set the minimum value
Max Value: Set the maximum value
Regex: Set the regex pattern
Javascript: Provide JS code that will return a boolean value (true/false) that indicates if it passes the validation
In list: Set a preset list of accepted string values
Prebuilt: Use Credit Card Number prebuilt list. The prebuilt credit card validation ensures the provided card number length is between 15 to 20 digits long and validates it using the
Luhn
algorithm.
You can use any combination of these options in a single validation.
Text miniApp
In Text miniApps you have the following options:
Regex: Set the regex pattern
Javascript: Provide JS code that will return a boolean value (true/false) that indicates if it passes the validation
Entity miniApp
In Entity miniApps you have the following options:
Regex: Set the regex pattern
Javascript: Provide JS code that will return a boolean value (true/false) that indicates if it passes the validation
Javascript validation test
When a Javascript validation is selected it is possible to run a test to confirm that the validation works.
Javascript validation requires params.valueToValidate
variable.
Example:
if(params.valueToValidate === "abc123") {
true;
} else {
false;
}
Enter the JS validation code in the JS script box.
Set the params object. (For example,
{"valueToValidate":"abc123"}
)Click the Run button to see the result.
Custom Validation
In all of the above miniApps you can also have a Custom Validation which overrides any other validation. Once enabled from the corresponding toggle button, you can create your own web service that validates the n-best results based on the logic you want and returns true
or false
.
In case of true,
it needs to return the selected n-best result.
In case of false,
it needs to return the first value on the list (i.e. the one with the highest confidence, as values are arranged by confidence level).
The end point you specify by providing the URL and the request token will get all n-best results as input in the following format:
{
"allValues": [
{ "value": "a b c", "confidence": 97.0 },
{ "value": "a d c", "confidence": 82.0 }
],
"normalizedValues": [
{ "value": "abc", "confidence": 97.0 },
{ "value": "adc", "confidence": 82.0 }
]
}
If the validation has been successful, the result you need to return should look the following:
{
"isValid": true,
"nBestValue": "adc",
"nBestConfidence": 82.0
}
If it hasn’t been successful, the result should be the following:
{
"isValid": false,
"nBestValue": "abc",
"nBestConfidence": 97.0
}
For these examples, we are assuming that in the successful case "adc" has passed the validation (e.g. been found in the dictionary) - that’s why it’s returned. And in the unsuccessful case neither "abc" or "adc" were found - thats’s why the first value is returned.
Step related properties
Here you can set up step-specific properties.
Property | Description | Value |
---|---|---|
ASR Timeout | Activate and set an ASR timeout | 100ms to 10000ms; increments of 100ms |
The active properties set up here will always override the general properties in the Properties tab.