Last weekend I made some updates to the TFF Ratio site to give it a little more “oomph”.
One of the things I noticed was that people would go to the TFF Ratio site, get their ratio and then post it on Twitter with something like “Hey my TFF Ratio is up to 1.09 now”. I thought it would be cool if I could bypass the step of them needing to go to the TFF Ratio site and instead have their TFF Ratio automatically posted to Twitter in some fashion.
The solution I came up with was pretty simple: built a bot to listen for a specific word in Twitter posts and if found respond with the user’s TFF Ratio stats.
The results look like this:
You can see that Michael Eaton made a Twitter post with @tffratio in it and TFF Ratio replied about a minute later with Mike’s TFF Ratio stats. I like to call this a ReTweeter, but I’ve been told that it is nothing more than Twitter Bot. (My Twitter client is TeleTwitter in case you’re interested)
Currently to use the @tffratio ReTweeter you should follow TFFRatio on Twitter. Once I receive the message of a new follower I will set TFFRatio to follow you back. After you get the message that TFFRatio is following you can post a tweet with @tffratio in it at any time. I know this “sign up” process is probably a little more difficult than it should be but I can’t currently come up with anything easier that doesn’t involve me trying to listen to the Twitter public timeline. That would be way too much info. I’m considering using hashtags instead, but I’ll have to play around with them first to see if they’ll work. Additionally, I plan on adding a small form to the TFF Ratio site that will allow you to enter your username so that TFFRatio will automatically start following you.
[Updated: TFFRatio no longer needs to follow you to hear your @tffratio requests - see details here]
I’ve got a post in the works entitled “How to built a Twitter ReTweeter” with code details for those that are interested in them. I should be able to publish it in a day or two, but for now here are the high level basics:
To begin I created a new Twitter account, TFFRatio of course. I then built a console app that would query the Twitter API once a minute for any mention of @tffratio, look up the user’s TFF Ratio who made the tweet and then send its own reply post back to twitter with that info.
To enable the TFF Ratio Re-Tweeter the only thing I needed to do was expose a web service on the TFF Ratio site so that I could make use of the existing code base. The console app (now a Windows Service) just calls that web service. The web service does nothing more than the existing little form on the site does. It takes three input strings: the Twitter username to query, your twitter username and your twitter password and passes back the TFF Ratio stats for the user you looked up. In a few days I will make the web service public for those interested in using it.
Since I now had the web service in place on TFFRatio.com I thought it would be fun to build a Graffiti Widget to make use of it. You can see the widget in action here: http://graffiti.danhounshell.com/. I’ll be releasing that widget soon as well. Once the web service is public I’m sure it will be just as easy to build a Community Server widget or a Wordpress plug-in or anything that you can think of to proudly display your TFF Ratio.
If you have any questions, give me a shout.
Please enjoy your TFF Ratio responsibly and remember not to take it too seriously.