LiquidFiles Documentation
LiquidFiles Documentation

SMS Delivery Actionscript

SMS Delivery Actionscript adds custom delivery for SMS tokens. You can use this if your SMS provider uses HTTP POSTS or other more complex configurations than what's possibly using a simple HTTP GET request that's builtin to LiquidFiles as standard.

You can install or upload scripts by going to Admin → Configuration → Actionscripts. Please see the Actionscript Installation instruction for more details. When you have installed the script, you can enable the SMS Delivery Actionscript in Admin → Configuration → Strong Auth SMS.

When the script is executed, it will be executed like:

your_actionscript.ext phonenumber token

So the first argument passed to the script is the users phone number and the second is the random token. Any additional messages or anything like that, you will need to add yourself in the script.

Example Actionscripts

Please see the following examples Actionscript that will send a SMS using Clicksends API with a HTTP POST

Clicksend.com SMS API

#!/bin/bash

# fill in your Clicksend's base64 authentication header
# (encode base64 ClicksendApiUsername:ClicksendApiKey)
CLICKSEND_AUTH="YourBase64String"

phone_number="$1"
message="LiquidFiles 2FA Token $2"

/usr/bin/curl -s -X POST --header "Authorization: Basic $CLICKSEND_AUTH" "https://api-mapper.clicksend.com/rest/v2/send.json?to=$phone_number&message=$message"

Twilio.com SMS API

#!/bin/bash

# type your TWILIO attributes
TWILIO_ACCOUNT_SID="YourSID"
TWILIO_AUTH_TOKEN="YourToken"
TWILIO_FROM_PHONE="1234567890"

phone_number="$1"
message="LiquidFiles 2FA Token $2"

/usr/bin/curl -X POST https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Messages.json \
  --data-urlencode "Body=$message" \
  --data-urlencode "From=+$TWILIO_FROM_PHONE" \
  --data-urlencode "To=+$phone_number" \
  -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN