Twitter Feed Tutorial for Web Developers
My last article about feeds covered RSS, and that's pretty calm compared to the firehose that Twitter can be. Twitter is real-time to the max (try doing a real-time search for the...now imagine if they actually showed you all the results!). Dealing with Twitter directly can be a bit intimidating, and they can't just give anyone access to everything, or it would break. Look at all you have to learn about counting 140 characters, for instance.
So for most people, putting a layer of well-written software between you and Twitter will help insulate both of you from each other, and minimize the chance of errors.
Feed Me, Twitter
To read and embed a Twitter feed in your own website, the simplest way is to get an RSS version, then convert it using a free service such as Feed2JS, RSS2HTML, or Grazr. Where can you find an RSS feed for a Twitter account? Believe it or not, there's one on every Twitter page, right under the Following section, and cleverly hidden next to the RSS icon :-) That's probably the best solution if you want to use just one or two Twitter sources, generally yours. But wait, there's more.
Let's say you want to go a bit further, and import directly from Twitter. Then your best bet is using code like Remy Sharp's Twitter.js, which lets you specify parameters and play with CSS if you want.
Going the other way is often more useful. Many people these days no longer check their friends' blogs or favorite websites; they just follow them on Twitter. So how to get their attention to your own site without lots of extra work? That's the reason behind feeding Twitter from your own content. It's similar to having Twitter read your RSS feed, but different because, as mentioned above, Twitter processes everyone's messages in real time and can't afford to get bogged down with invalid input.
As usual, things are easiest if you're on a blogging platform. If you use WordPress, then in my opinion the only sane thing to do is to pick up a free copy of Brave New Code's amazing plugin WordTwit, which I've been using exclusively since I found it (while you're at it, you might as well get their WPTouch as well, which automagically and transparently reformats your site for iPhones). Joomla users can check out Tomasz Dobrzyński's Twitter Status. Both these addons allow configuration and customization, as well as their basic function of auto-publishing a Tweet whenever you post a new blog entry.
The granddaddy of all Twitter updating services is the aptly-named Twitterfeed, which can read an RSS 2.0 or Atom feed from any website, blog, or device that outputs them. It then validates the data, massages it as needed, and sends it to your Twitter account. Even Twitter itself recommends using Twitterfeed.
If you're seriously into code, willing to get a bit down
and dirty, and want to do things that haven't been addressed here (or perhaps
never even thought of), then you'll probably want to look at the official Twitter API. There you can find all the specifications and documentation for direct program access to Twitter. If you
have an interest in real-time publishing, you should also know about Google's PubSubHubBub open source/open protocol project, which allows large sites to deal with the problem of updates without polling.