Oh hey! It’s been a few weeks (months?) since I’ve updated. It’s always tough to get motivated to blog because I totally hate writing… still trying to understand why I have a blog. Anywho, it’s been a busy few weeks! Lots of biking and working and biking. One of the more interesting things that has happened lately relates to Twitter. I teamed up with @nevko and @alexis039 to tackle an idea for a cool Twitter app. A few days later, @TweetCounter was born.

TweetCounter is a cool app that we designed and I coded. The purpose of this application is to notify you when you are getting close to reaching a Twitter update milestone. What’s a milestone and who cares? Well, we’ve noticed that tweeps (ourselves included) DO care! Whether it be 100 tweets, 500 tweets, or 2000 tweets, it’s fun to try to make these milestones memorable. Do a search for “100th tweet” or “1000th tweet” and you’ll find hundreds of other people who notice these milestones. After determining that there was no obvious way to track these milestones, we got working. To get these notifications, users just have to follow @TweetCounter and that’s it. We will post a @reply to you when you are within 5 tweets from an important milestone.

 *Nerd Alert* So, how does it work? Well it’s actually very simple. It’s only 2 pages of code and barely 200 lines total. Each morning a cron job runs which executes a simple PHP script. This script uses the Twitter REST API to request a list of TweetCounter’s current followers. We make additional calls to find out how many tweets each follower has made, and then we store all of this data in our database cache. We analyze these users and if an user is within 30 tweets from a milestone, we flag them for “hourly” monitoring. As you might guess, for each of these users we check every hour to get their current tweet count. This allows us to play nice with Twitter’s servers and only make API calls when we actually need them. There’s no point in making a call each hour for users who are 200 tweets away. Lastly, once an hourly user gets within 5 tweets of a milestone, we tweet a @reply to notify them.  We have a database of 20 fu tweets that we pick randomly when notifying our followers. (Thanks @alexis039 for the creativity!!)

That’s about it!! It’s been really fun and super easy to write an application for Twitter. Granted, I had some experience working with cURL and PHP before. But, that’s about all there is to it. If you haven’t taken a look at the API yet, I highly recommend it! 

If you don’t already follow @TweetCounter, do it today!