Phone Validator Config
The config feature allows you to customize various parameters to enhance or adjust the behavior of the Phone Validator according to your company’s needs. When a validation is executed, these parameters override the default configuration we have stored for any validation performed in Truora, ensuring that customers have all models up to date. For example:
Parameter | Client Config | Default Config | Used Config (Client+Default) |
---|---|---|---|
Allowed Retries | 1 | 2 | 1 |
Timeout | 600 | 300 | 600 |
In this guide, you will learn how to update, retrieve, and delete a configuration for the Phone Validator. We will use a single example throughout this guide to demonstrate the use of the Update, Get, and Delete Config requests, helping you understand their essential functions and responses.
Phone Validator Parameters
You can set the following parameters:
timeout
: The amount of time, in seconds, that users will have to perform the validation before it times out. The default value is 300 seconds (5 minutes), with a maximum of 600 seconds (10 minutes) and a minimum of 1 second.allowed_retries
: The number of times the validation may be retried before failing. The default value value is 2 retries, with a maximum of 4 retries.custom_name
[Optional]: Custom text within the OTP verification messages, up to 30 characters. *
*NOTE: For example, setting custom_name
to “Acme Corp process” will show the message as follows: “Your Acme Corp process verification code is: 654321”.
Default Config
The Phone Validator has a default configuration, which you can leave as is or adjust to better suit your industry or use case. Below are the default values for this configuration:
Parameter | Default Value | Language (phone_locale *) |
---|---|---|
timeout | 300 | N/A |
allowed_retries | 2 | N/A |
custom_name * | el proceso process o proceso |
es en pt-BR |
*NOTES:
- The default
custom_name
depends on the language defined by thephone_locale
parameter in the Phone Validation process. - The default messages with the default
custom_name
for each language are as follows:
- es : Su codigo de verificacion para el proceso es: 654321
- en : Your process verification code is: 654321
- pt-BR : O seu código de verificação para o proceso é: 654321
Update Config - Phone Validator
To Update the configuration for the Phone Validator, follow these steps:
- Create a
PUT
request to the endpointhttps://api.validations.truora.com/v1/config
. - Set the Headers
Truora-API-Key
: enter the value of your Truora API-key.Content-Type
: the value should beapplication/x-www-form-urlencoded
.
- Set required values for the request body
validator
[Required]: Allowed:phone-verification
. Validator to be configured.timeout
[Optional]: The amount of time, in seconds, that users will have to perform the validation before it times out.allowed_retries
[Optional]: The number of times the validation may be retried before failing.custom_name
[Optional]: Custom text within the OTP verification messages, up to 30 characters.
For this guide’s example we will start by setting the following parameters:
timeout
: 600allowed_retries
: 3custom_name
: ACME
Sending the Update Config request with these parameters, the response should look similar to the following:
/v1/config
Among other details, you will identify the updated config:
- For
phone-verification
thetimeout
is set to 600,allowed_retries
is set to 3 andcustom_name
is set to ACME.
Get Config
The Get Config request allows you to fetch the current configuration state for all validators associated with your account. This request retrieves the configuration for the Phone Validator as well as the configuration states for all other validators linked to your account.
- To obtain the current validators’ configuration, send a GET request to the endpoint
https://api.validations.truora.com/v1/config
.
In the case of our current example, at this point you should receive the same response as the previous step:
/v1/config
Delete Config - Phone Validator
The Delete Config request allows you to delete a validator’s configuration or a specific parameter within the validator’s configuration. Deleting the configuration resets its values back to their defaults.
-
To delete a config, send a DELETE request to the endpoint
https://api.validations.truora.com/v1/config
with the following Query Parameters:validator
[Required]: Name of the validation config to delete. Set this value tophone-verification
.type
[Optional]: Allowed:timeout
|allowed_retries
|custom_name
. This specifies the configuration type to be reset. If provided, only the selected configuration will be reset. Otherwise, all configurations will be reset. *
*Note: If you omit the
type
parameter when sending the request, all configurations associated with the validator will be deleted, reverting all values to their default settings.
Deleting a specific config type
Following our example, we had updated the following configuration:
- For
phone-verification
thetimeout
was set to 600,allowed_retries
was set to 3 andcustom_name
was set to ACME.
To reset the timeout to its default value (300 seconds), set the following Query Parameters :
validator
: phone-verificationtype
: timeout
Now send the DELETE request to the endpoint https://api.validations.truora.com/v1/config
. In the response, you should see that for phone-verification
the timeout
has been reset to 300, allowed_retries
will remain unchanged at 3, and custom_name
will also remain unchanged as ACME:
/v1/config?validator=phone-verification&type=timeout
Deleting all configurations
Following our example, after deleting the timeout
config, we have the following configuration states:
- For
phone-verification
, thetimeout
was reset to its default (300),allowed_retries
is set to 3 andcustom_name
is set to ACME.
To reset all the configuration for the Phone Validator, set the following Query Parameters :
validator
: phone-verificationtype
: Omit this parameter. Remember that if this parameter is omitted, all configurations will be reset to their default values.
Now send the DELETE request to the endpoint https://api.validations.truora.com/v1/config
:
/v1/config?validator=phone-verification
Finally, in this response you should recognize the following changes:
- For
phone-verification
thetimeout
remains 300 (default),allowed_retries
is reset to 2 (default), andcustom_name
is reset to el proceso (default).