Send SMS via Twilio
And twilio.com offers a trial account to programmatically send an SMS.Below is a python script that interfaces with the twilio api.
Usage:
# twilio_sms.py - a command-line tool to send SMS
# python twilio_sms.py <recipient> <message>
# Get twilio-python library from http://twilio.com/docs/libraries
from twilio.rest import TwilioRestClient
import sys
def send_sms(number,msg):
# number:str - Phone number that will receive the SMS
# msg:str - Message content
account_sid = "xxxxxxxx"
auth_token = "yyyyyyyy"
client = TwilioRestClient(account_sid, auth_token)
message = client.sms.messages.create(to=number, from_="+1234567890",body=msg)
if __name__ == '__main__':
[number,msg] = sys.argv[1:3]
send_sms(number,msg)
Send SMS via Google Calendar
It is also possible to send an SMS using the Google Calendar API. The general idea is as follows:- Create a Google calendar with Notifications enabled to send SMS zero minutes before the appointment
- Create a program to add events into that calendar
Comparing the two options
All points in favour of Twilio Trial Account SMS:- Twilio Trial SMSes are sent immediately, Google Calendar SMS needs a delay (30s-45s).
- Google Calendar SMS requires a one-time manual authentication, Twilio Trial SMS doesn't.
- Both options adds text around the actual sms text; but Twilio adds less:
- Twilio Trial SMS Text:
- Sent from your Twilio trial account - <SMS Body>
- Google Calendar SMS Text:
- Reminder: <SMS Body> @ Sat May 25, 2013 08:30 (_)
No comments:
Post a Comment