Setting Up SMS Account Verification with Twilio

As a part of the verification during signup procedure, SMS account activation is designed to prevent fake signups and, simultaneously, to encourage real users for upgrading their accounts to billing instead of creating another trial one after the provided free trial period has expired.

SMS verification becomes operable only in case the mandatory account activation is already enabled, so make sure you’ve performed the necessary configurations beforehand.
In order to have an opportunity to use this activation type, you are required to preliminary set up the appropriate messaging tool, intended to automatically send authorization SMS notifications. As an example for this guide, we’ll use Twilio (however, you can configure any other preferred service in a similar way). It provides a number of features, like using custom name as sender ID instead of the phone number, support of non-English character sets, tracking message status in real-time, etc.

So, to accomplish the required configurations for enabling the additional SMS verification during signup, you’ll need to perform the following steps:

Purchase a Phone Number

  1. First of all, navigate to the Twilio website and either Sign up for a new account or just Log in (if you already have one) with the appropriate button. 1

  2. Once inside your account console, navigate to the All Products & Services > Phone Numbers section through the left-side menu. 2

  3. Then, switch to the Buy a Number tab. 3

Here, you need to specify the required search options to find a phone number that will satisfy your needs:

  • Country - select the preferred region with enabled SMS capability and without Domestic SMS only restriction (to check the latter option state, find the chosen country within either Dual Functionality or SMS Enabled Only section of the Twilio phone numbers capabilities list) 4
    We recommend to purchase US numbers as commonly available and the most cost efficient ones.
  • Number/Location - optionally, enter the required search parameters (e.g. specific digits or area code) or leave this field blank. Herewith, search over Location is available for US and Canada only.
  • Capabilities - obligatory tick the SMS option

When all the options are defined, select Search to output the list of 10 suitable random numbers.

  1. Click the Buy button next to the preferred number. 5

  2. Within the appeared pop-up window, review the number parameters and click the Buy This Number button to confirm the purchase. 6 In a moment this phone number will appear at your Manage Numbers list.

  3. Lastly, to ensure global service availability, go to the Programmable SMS > Settings > Geo Permissions page and tick all countries within the list, making registration possible for any user throughout the world (use common check-boxes next to the world part names to accomplish this faster). 7

If deliberately limiting the area your Public Cloud platform could be used at, be aware of possible complains and decreasing your platform ranking within Cloud Union catalogue. Also, all related issues with registration will have to be handled on your side.
Now, after you’ve got the suitable number, proceed with adjusting the appropriate SMS verification control script.

Configure Script

Now, you need to adjust a dedicated platform script, which is responsible for sending the appropriate SMS messages to the newly registered users, with the acquired number and your messaging tool credentials.

By default, our script is configured to work with the above mentioned Twilio tool, thus, if using any other SMS sending service, you’ll need to adjust or rewrite this script at first.
  1. Access your hardware node via SSH and edit the /home/hivext/scripts/sendsms script within all HCore containers (i.e. search for the ones with a hcore1, hcore2, etc in hostname). In the opened file, adjust the CHANGE THIS PARAMETERS section with your Twilio data, namely:



  • {phone_number} - the previously purchased number; can be found within the Numbers > Twilio Numbers section

  • {Twilio_SID} - your Twilio account security identifier from the Settings > General frame (circled below) 9

  • {Twilio_token} - security authentication token, located under the previously specified SID (to see its value, click on the eye button to the left)

After the above mentioned parameters are specified, don’t forget to save the changes, applied to the script.

  1. In order to check everything is configured properly, you can execute this script manually, right from the container:

/home/hivext/scripts/sendsms -n {phone_number} -c {activation_code} -l {language}

Here, the highlighted parameters should be substituted with the following values:

  • -n {phone_number} - mobile phone number the SMS should be sent to
  • -c {activation_code} - the preferred activation code of 4 digits (for example 4545)
  • -l {language} - SMS notification language, stated with the ISO 639-1 format (herewith, the exact message text for every used language is defined within the script’s GRETINGS_lang parameter)

In response to this, a JSON object with the result property will be received.


The result should be equal to 0 (as underlined above) - this means that SMS has been sent successfully, so you can make sure it matches the inputted properties. Otherwise, you need to recheck the settings within your sendsms script for being specified properly.

If everything is OK here, you can navigate to the JCA panel to enable SMS verification and configure its parameters at the platform side.

What’s next?