If you are a Github user and also interested in building SMS apps, please feel free to “watch” that repo and follow along with my own experiments. Code will probably be a mixture of python and Node.js, with occasional other languages thrown in.
Today Voxeo launched SMSified a new service that lets you use a really simple RESTful API to send text messages within the US for only 1 cent per message. I and other colleagues have been writing about SMSified on the SMSified blog and after writing a tutorial about using SMSified with curl, I figured I’d play around with python a bit and code up an example of sending a SMS via python.
So here it is… stored up in my Github account, but also here:
#!/usr/bin/env python # Really simple python app for playing with sending SMS messages # via SMSified - http://www.smsified.com/ # Created by Dan York - May 2011 import json import urllib senderid = "dandemo" #SMSified account password = "notmyrealpassword" #SMSified password sendernum = "5853260800" #SMSified phone number apiurl = "https://"+senderid+":"+password+"@api.smsified.com/v1/ smsmessaging/outbound/"+sendernum+"/requests" address = "14079678424" # Phone num to which you want to send message = "Hello there" # Whatever msg you want to send data = urllib.urlencode((('address',address),('message',message))) f = urllib.urlopen(apiurl,data) print json.loads(f.read())['resourceReference']['resourceURL']
As you can see in the code, there are really only three lines of importance: the one building “apiurl”; the one urlencoding the data; and the one opening the URL. The rest are really just for the convenience of using variables.
The final line simply prints out the info included in the result JSON. I was going to (and still may) make that print out prettier or say something more… and if you are reading this sometime in the future, the version on Github may have already morphed and evolved into something different. The point is that now that you get JSON back, you can parse it and start to take action on it.
Anyway, this was just a quick sample app to experiment with SMSified. If you have checked out the new service, it’s free to set up a developer account and currently is free entirely during the beta period.
 In full disclosure, Voxeo is my employer.
If so, check out the Tropo blog for some cool examples, tutorials and videos. As I was catching up on my Twitter feed this morning, I noticed a great post there about responding differently to different types of users and a short video about using SMS to find the time and date of tweetchats. Cool stuff!
P.S. And yes, in full disclosure Tropo.com is a cloud communications service of my employer, Voxeo, and I do myself sometimes write on the Tropo blog, particularly about python or Node.js. However, if I didn’t think what they are writing about there is in fact interesting, I wouldn’t mention it here. 🙂
Over on the Voxeo Developers Corner blog today, I published a post about a series of tutorial articles we have there:
We’re planning to pick the series back up and continue writing about some of the interesting apps you can build using VoiceXML. (And if you have no idea what VoiceXML is about, you can check out www.vxml.org in addition to this tutorial.)
For those of us who enjoy working in XML, there are some rather powerful dialog-driven applications you can create using VXML. Stay tuned for more!
As noted previously, I’m a huge fan of git and an avid user of Github. Given that, I appreciate learning new ways to do cool things with git. Here was a new one to me – using git “submodules” to build a package consisting of other git repositories. In this case, Adam Kalsey wrote about how he used the “git submodule” command to package up a number of different components for a USB key drive.
The key point is: each of the components remains in its OWN git repository – yet the overall “package” is ALSO under git revision control.
This is cool to me as I’ve wanted to do something similar in the past – I’ve now added “git submodule” to my internal “git toolbox” list. Looking forward to trying it out at some point.