5 months ago

Twitter Marketplace

A while ago I decided that it would be interesting to learn the Twitter API to build an app using Twitter as a medium. More out of curiosity than anything else, I didn’t intend much to come of it [maybe figure out how to use applescript or something to send/receive twitter updates].

Last week, I posted to twitter about selling my Macbook Pro [I’m thinking of upgrading to an iMac] and immediately thought that it would be great to have some sort of mechanism that would allow people to post items they want to sell, and see what items people are selling.

Figuring this would be a great way to both a) learn the twitter API and further my PHP skills and b) create something worthwhile, I decided to build it as best I could.

I got to work, and after about 8-10 hours work over the last 5 or 6 days, I’ve created the Twitter Marketplace. It’s a PHP script that parses tweets sent to @market_place, looks for one of the trigger words (SELL, WANT, SOLD, HELP) and then performs one of the following:

• If it finds SELL, it reformats as “user is selling item for price”

• If it finds WANT, it reformats as “user wants to buy item for price”

• If it finds SOLD, it reformats as “user sold item for price”

and then posts the reformatted version to twitter, so anyone following @market_place will see it.

• If it finds HELP, it sends a direct message to the user listing what the various trigger words are.

• If it doesn’t find a dollar sign, or doesn’t find a trigger word, it sends a direct message to the user telling them there was a problem.

It’s currently running from my computer, refreshing in Opera every 2 minutes, but I will eventually host it and set up a cron job to do it automagically.

I also plan to develop a web interface for it [watch http://andrew.harrison.org/marketplace] to keep track of what is currently for sale, and what people want to buy, as well as setting up some system to remove items that were for sale etc.

Suggestions for improvement/feature requests should be sent to me by email.