Using Twitter to Build a SMS Service

Twitter (http://twitter.com) is a social networking service that allows users to broadcast their goings-on to one another via SMS (as well as email and instant messenger). Its API is described at: http://twitter.com/help/api and a healthy developer community has grown around its API at http://groups.google.com/group/twitter-development-talk/web/api-documentation.

Twitter Overview

Fundamentally, Twitter is about updating your status—you tell Twitter what you're doing, and it tells all your friends.

For example, let's say you and I have registered with Twitter and we've marked each other as friends. If I were to send this SMS to Twitter's short code (40404):

I'm working on my SMS guide!

You and all my other friends on Twitter would receive an SMS from 40404 that reads:

Jordan: I'm working on my SMS guide!

Twitter also lets you send direct messages to specific users by prefacing a message with the letter "d" followed by the recipient's user name, or handle. So, if instead of sending a general "tweat" (that's what they call status update messages like the one above), I sent this SMS to Twitter:

d BrianR How's the sample code coming along?

my co-author Brian (and only Brian) would receive this message:

direct from JojoSchwa: How's the sample code coming along? (reply? Send: d JojoSchwa hi.)

The Twitter API

Because Twitter has already done the hard work of implementing an SMS service (not to mention picked up the tab), you can use its API to send and receive messages ...

Get How to Build an SMS Service now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.