Setting Up Mobile Call Account Verification with OnVerify

Account activation via mobile number at the platform is intended to ensure the complete protection from malefactors, which are trying to make profit on the provided free of charge trial period through the continuous generation of new accounts. By default, the SMS number confirmation is used. However, due to the fact of existing of a lot of public services that provide a temporary phone number (which can be used for just a single activation code receiving), the more secure option can be required.

According to the proposed below solution, the phone number verification via call can be used for that - as an example, we’ve chosen the OnVerify service. It allows to send activation code via voice message instead of notifying users by means of SMS. So, let’s find out how to configure this type of account activation.

Note: In order to work with a mobile call verification, the mandatory account activation should be enabled, with the mobile number verification being added to the form. Thus, before proceeding further, please make sure you’ve performed all the necessary preliminary configurations, described in the linked document.

Adjust Registration Form Texts

Before enabling service at production, it’s highly recommended to adjust the activation form’s texts in order to make users aware, that they will receive a call rather than SMS notification (as it is said in the default form template).

activation form

To substitute the old texts, you need to update the corresponding lang-{x}.js localization file(s) and upload them to the public_html/activation/locale folder of your platform resources (contact PaaS team if the detailed instruction on this is required).

We suggest the strings below to be changed in the following way:

Placeholder IDDefault text (for SMS)Recommended text (for mobile call)
titleSMSVerificationPlease enter your phone number to receive a code via SMS and complete your account activationPlease enter your phone number to receive a call with a code, being dictated by a robot, and complete your account activation
textNoSMSNo SMS? Edit the phone number if it’s incorrect, or contact support if you need further assistance.No call? Edit the phone number if it’s incorrect, or contact support if you need further assistance.
sendSMSButtonTextSENDGET A CALL
resendSMSTextSend SMS again.Get a call again.
errorSMSAlreadySentAn activation code was already sent to this number. Please use a different one or contact support for assistance.An activation code was already uttered for this number. Please use a different number or contact support for assistance.
errorSendSMSSome error has occurred - an activation code has not been sent. In order to complete the activation, please contact support.Some error has occurred - the call has not been made. In order to complete the activation, please contact support.
errorSendSMSCountryRestrictedSending SMS messages to the recipient country is not allowed.The phone call to the recipient country is not allowed.
errorSendSMSInvalidPhoneNumberAn activation code has not been sent. Please re-check the specified phone number and try again.The call has not been made. Please re-check the specified phone number and try again.

Note: Once all the necessary localization files are uploaded, you need to apply them to be used at your platform’s registration form through following the next link in your browser:

https://reg.{platform_domain}/activation/rebuild

Configure Mobile Call Verification

By default, the platform is configured to work with the Twilio SMS sending tool. Thus, if using any other code sending service (by means of SMS or voice, like in our case), you’ll need to change the corresponding control script.

1. Enter the 104 container of your host node via SSH and substitute the existing sendsms script’s content, located at /home/hivext/scripts, with the one presented below:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash

#OnVerify integration

#=======================================
# !!!! CHANGE THESE PARAMETERS !!!!

USER_ID="{user_id}"
TEMPLATE_ID="{template_id}"
API_PASS="{api_pass}"

#=======================================

function usage
{
    if [ -n "$1" ]; then echo $1; fi
        echo "Usage: sendsms -n number -c code -l language"
        exit 1
}

while getopts "n:c:l:" opt; do
    case "$opt" in
        n) PNUMBER=$OPTARG ;;
        c) MSG=$OPTARG ;;
        l) L=${OPTARG^^} ;;
        *) echo "Unknown param: $opt"; usage ;;
    esac
done

#Limit message to 160 characters
MSG=${MSG:0:160}

RESPONSE=$(curl -s "http://www.onverify.com/call.php?userid=$USER_ID&apipass=$API_PASS&pin=$MSG&template_id=$TEMPLATE_ID&number=$PNUMBER")
RESULT=$?
if [ $RESULT -gt 1 ]; then
    echo "{\"result\": \"$RESULT\", \"message\": \"Failed to send Voice Message to $PHONE: $RESPONSE\"}"
else
    echo "{\"result\": \"0\", \"message\": \"queued\"}"
fi

2. Then, to make the script to work properly, you need to adjust the highlighted lines (within the CHANGE THESE PARAMETERS section) with your OnVerify account data, namely:

  • {user_id} - UID of your account
  • {api_pass} - API password, used for authentication

Both of the abovementioned values can be found within the My Account > Details menu section:

2

  • {template_id} - identifier of the template, that should be played to your customers

In order to create it, switch to the Templates section at the top and click on the Add New Template string. In the opened frame, type the name of your sample and specify the message for being spoken by a robot line by line, with the Say action stated for each of them, e.g.:

3

The required template ID will be shown at the top of the frame. After you save the new message, it will be permanently listed within the Templates section of your account, being available for editing.

3. Subsequently, you can review the Reports (within the same-named section at the top panel) with details on all of the mobile phone numbers that have tried to register at a platform, date and result of confirmation call (i.e. whether it was performed successfully), and your OnVerify account charge for each such action:

4

That’s all of the operations required! For now, the service is integrated and once the mobile number verification is activated, it will start working for protecting your platform from account spammers.

What’s next?