SMS Authentication using Twilio (pre 2.3.19)

Christopher Dakin
This article is marked as obsolete.

This article describes how to use LogonBox to send SMS messages via Twilio.

 

First, log on to your Twilio account.

On your main console you will find your Account SID and your Auth Token, copy both of these.

 

In a text editor put these together separated by a colon. eg:

AC1393695cfaa6a975ab478592ad411903:d5136f869940a7ad3a4bb76f479c45f1

 

Now take that resulting text and use a service such as https://www.base64encode.org/ to base64 encode this value, which will result in something like:

QUMxMzkzNjk1Y2ZhYTZhOTc1YWI0Nzg1OTJhZDQxMTkwMzpkNTEzNmY4Njk5NDBhN2FkM2E0YmI3NmY0NzljNDVmMQ==

You will need this authentication value in a moment.

 

In LogonBox navigate to Authentication Flows and ensure you have SMS in your password reset flow (or it's being used as part of User Selective 2FA).

 

Navigate to Authentication Flows->Authentication Options->SMS and change the Provider to CUSTOM.

Click Apply then navigate to the SMS Code tab.

Here you can review how your one time password gets generated.

 

We now need to create a Trigger to react to an SMS event, Navigate to the Triggers menu in Business Rules.

Create a new Trigger and give it a name (such as Send SMS to Twilio).

For Event, start typing SMS Generated and select it when it appears in the list.

Set Triggers On to Success.

For Triggers Task, start typing HTTP Form and select it when it appears.

 

Click the Headers tab and click the + to add a new header.

In the left field type Authorization, in the right field type Basic followed by a space and your Base64 encoded authorization created above.

 

Click the HTTP Form tab, set the Request Method to POST.

For the URL, this need to contain your Twilio account SID which will look something like this:

https://api.twilio.com/2010-04-01/Accounts/AC1393695cfaa6a975ab478592ad411903/Messages.json

Click the + icon 3 times in Variables.

For the first variable, type Body in the left field and your message in the right field, making sure to use the replacement attribute ${attr.sms} in that message. This attribute will be replaced with your one time password at the time of sending.

For the second variable, type From in the left and your Twilio sending number in the right.

For the last variable, type To in the left and in the right we will use a replacement representing the user's mobile number, ${phone.e164}.

 

Finally click the Response tab, type in 201 for Response Status Codes and click the + to add it to the list. Click Create to complete the trigger.

 

Your configuration is now complete and you should be able to start sending SMS messages from your LogonBox via the Twilio service.