diff options
Diffstat (limited to 'src/authorization/anastasis-authorization-sms.sh')
-rwxr-xr-x | src/authorization/anastasis-authorization-sms.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/authorization/anastasis-authorization-sms.sh b/src/authorization/anastasis-authorization-sms.sh new file mode 100755 index 0000000..28da3ed --- /dev/null +++ b/src/authorization/anastasis-authorization-sms.sh @@ -0,0 +1,27 @@ +#!/bin/sh +set -eu +. telesign-secrets +# Set AUTH_TOKEN=... + +MESSAGE=`cat -` +TMPFILE=`mktemp /tmp/sms-loggingXXXXXX` +STATUS=$(curl --request POST \ + --url https://rest-api.telesign.com/v1/messaging \ + --header 'authorization: Basic $AUTH_TOKEN' \ + --header 'content-type: application/x-www-form-urlencoded' \ + --data account_livecycle_event=transact \ + --data "message=$MESSAGE" \ + --data message_type=OTP \ + --data "phone_number=$1" \ + -w "%{http_code}" -s -o $TMPFILE) +echo `cat $TMPFILE` >> /var/log/sms.log +rm -f $TMPFILE +case $STATUS in + 200|203|250|290|291|295) + exit 0; + ;; + *) + exit 1; + ;; +esac +exit 1 |