Managing multiple Twitter accounts via SMS

I have a handful of twitter accounts associated with specific events or websites. They’re often updated automatically with no regular intervention by me—I usually don’t even know their passwords. Everything works pretty smoothly until I need to do a manual update. Take the @hackerdrinkup account: It updates automatically with the week’s location, but if something unexpected comes up, I need to update it with the new venue. Many pro mobile twitter clients support multiple accounts and Brizzly supports up to five. I do these updates so rarely that it doesn’t feel worth the expense or setup time… and even if they were setup it still relies on my phone’s sometimes flakey data connection. I set out to build a simple solution that would work with a bare minimum connection.

I decided to use DMs as the update transport since SMS is almost always available. I modified Chris Finke’s retweet.py code (which I use for @SanMo) so it would work with direct messages. Chris added a ban list in the last version and I was able to change that to an admin list. You just run retweet-dm.py as a cron job and it will monitor incoming DMs on all configured accounts. If the sender is on the admin list it republishes the DM as a tweet. It uses the same settings.py file as before and you add admins like this:

$ python retweet-dm.py --account=retweeting_account --admin=approved_dm_sender

This code is also a handy solution if you need multiple people to update a Twitter account but don’t want to hand out the password. It has the caveats: 1) They won’t get the full 140 characters and 2) There’s currently no undo via DM.

Download: retweet-dm.py

Leave a Reply