Addicted to twitter.com
But not because of a craving to be loved. Honest. For a long time I’ve wanted to be able to interact with a computer/remote process via sms. Just this morning I was struck with what I thought was an amazing idea. I’d heard of twitter and wondered if I might be able to use it as a type of sms gateway. Turns out that I could. Yay.
To play along, you will need:
- One twitter account with a registered mobile
- One twitter account that is a friend of the first account (with the mobile)
- A tiny bit of ruby script
require 'rubygems'
require 'json'
RECEIVER_USERNAME = 'USERNAME_OF_MOBILE_ACCOUNT'
RECEIVER_PASSWORD = 'PASSWORD_OF_MOBILE_ACCOUNT'
js = `curl -u"\#{RECEIVER_USERNAME}:\#{RECEIVER_PASSWORD}" http://twitter.com/statuses/friends_timeline.json`
text = JSON.parse(js).first['text']
SENDER_USERNAME = 'USERNAME_OF_FRIEND'
SENDER_PASSWORD = 'PASSWORD_OF_FRIEND'
`curl -u"\#{SENDER_USERNAME}:\#{SENDER_PASSWORD}" -d"status=\#{text.reverse}" http://twitter.com/statuses/update.xml`
The script just reads the most recent message sent to your mobile twitter account, reverses the text and sends it back to your mobile.
This is all free stuff, and although the twitter terms of service don’t appear to explicitly disallow us doing this, I think you should probably be nice if you’re going to use it in this way.