twilio.com - create account put some $$$$
Ger SID and Token in account
Use them in script to get the number to sent SMS from
1) Get the info about account
2) get available number
3) purchase via curl request
4) test
account_sid="ACXXXXXXXXXXXXXXXXXX"
auth_token="bXXXXXXXXXXX"
#####Get the account info - check if it is in trial mode
#####Trial accounts cannot send messages to unverified numbers;
#####In order to continue with trial account verify recipients' numbers at #####twilio.com/user/account/phone-numbers/verified,
#####or purchase a Twilio number to send messages to unverified numbers.
curl -G "https://api.twilio.com/2010-04-01/Accounts/${account_sid}.json" \
-u "${account_sid}:${auth_token}"
#########Lets get and purchase §the number to send sms from
#available_number=`curl -X GET \
# "https://api.twilio.com/2010-04-01/Accounts/${account_sid}/AvailablePhoneNumbers/US/Local" \
# -u "${account_sid}:${auth_token}" | \
# sed -n "/PhoneNumber/{s/.*<PhoneNumber>//;s/<\/PhoneNumber.*//;p;}"` \
# && echo $available_number
create .twilio_rc with creadentials in script path dir
SID="ACXXXXXXXXXXXX"
AUTH="bXXXXXXXXXXX"
SERVER_URL="http://zabbix.somesite.com"
Script to send SMS, replace From=%2B15592063354 with the number purchased
#!/bin/bash
SCRIPT_PATH="`dirname \"$0\"`"
. $SCRIPT_PATH/.twilio_rc
TO=$1;
BODY=$2;
RESPONSE=$(curl -q -XPOST https://api.twilio.com/2010-04-01/Accounts/${SID}/SMS/Messages \
-d "Body=${BODY}" \
-d "To=%2B${TO}" \
-d "From=%2B15592063354" \
-u "${SID}:${AUTH}" )
SMS_SID=$(echo $RESPONSE | sed -e 's,.*<Sid>\([^<]*\)</Sid>.*,\1,g' )
SMS_STATUS=$(echo $RESPONSE | sed -e 's,.*<Status>\([^<]*\)</Status>.*,\1,g' )
if [ "x${SMS_STATUS}" != "xqueued" ]
then
exit 1;
fi
for (( c=1; c<=12; c++ ))
do
RESPONSE_STATUS=$(curl -q -G https://api.twilio.com/2010-04-01/Accounts/${SID}/SMS/Messages/${SMS_SID} -u "${SID}:${AUTH}" )
STATUS=$(echo $RESPONSE_STATUS | sed -e 's,.*<Status>\([^<]*\)</Status>.*,\1,g')
if [ "x${STATUS}" == "xsent" ]