After successful Bing-Vs-Google.com that compares search results from Bing and Google side by side, and very popular WallOfSilver.net, a Twitter wall used on many conferences and events around the world, few day ago I’ve launched another project called TwBirthday. The basic idea is very simple – if you enter your Twitter username, you’ll find out when have you started using Twitter (that’s your TwBirthday), your age index (your Twitter age compared to Twitter’s first tweet – March 21, 2006) and your Twitter godfather, a person you have followed the first. TwBirthday doesn’t require authentication nor it will send any tweets on your behalf, but it will remind you of your twbirthday when that day comes – it will post a tweet starting with your username, so you can see it in your mentions feed. Furthermore, if you follow @TwBirthday on Twitter (please do :-)), you will see when your friends celebrate their birthdays in your timeline.
That’s basically it. The service is quite simple, but I must emphasize that development was not so easy as it may look. Let me share some facts and thoughts about that:
- it took me four months from first lines of code until launch
- one of major issues was Twitter API request limiting – it defaults to 150 or 350 requests per hour (depends if you’re authenticated or not) – I’ve applied for more (20,000 per hour) few months ago, I was rejected three times but when I’ve finally get in touch with Twitter support service (one of the best support services I’ve ever got in contact with!), I’ve explained my intentions in details and everything was fine
- I’ve optimized the system to use only two or three API requests per search, and two-hours caching of all retrieved data – that was fun
- posting tweets about one’s birthday is really challenging – the idea was to post it just after midnight, but people live in different time zones and you don’t want them to get a birthday reminder on a wrong day. Another problem is Twitter update limit – you can post a maximum of 1000 tweets per day and “the daily update limit is further broken down into smaller limits for semi-hourly intervals”. This means that I have to distribute posting during the day not to hit the limit, be aware of user’s time zone while doing it and when I (hopefully) reach 1000 users with twbirthday per day, the system will have to choose which users deserve the greeting tweet more than the others in their and several neighboring time zones (currently, I’ve implemented a simple formula that calculates user’s activity base on number of followers and last tweet date, but that is subject to change)
- users can change their usernames, so I update their info few days before twbirthday, to have accurate data
- during the peaks, a database is automatically turned off – the most important thing is to display a birth certificate to a user – if there are too many visitors and database underneath is dying in pain, logging will be disabled
- “calculating” godfather can be a slow task (some people follow 000s of users), so it is displayed with a small delay, using AJAX (of course); API request for that is on background thread
- all API requests must be from a specific IP address (not the default one on the server), because only that IP address has higher API limit; using ASP.NET’s simple WebRequest or XDocument.Load doesn’t work here
To sum it all up – it was really fun and challenging to work on this project. I’ve learned a lot so the main goal is reached. Hope you like the final result! Tweets, comments, mentions and bug reports are appreciated!
And the most important, a big thanks goes to a friend of mine – Emanuel Blagonić – for a great design. You don’t want to know how it looked in beta version. :-)
Login