Building a SMS App in the Cloud

I've written several Twitter bots, including WiiMe and Amazon Book Finder and have experimented with various ways of coding/running bots like that. With that in mind, after reading WebMonkey's Build an SMS Notification App I decided to build the same app that my amazon twitter app does, but this time powered by TextMarks and App Engine.

14 minutes later you can send 41411: isbn 0596517742 and it will SMS you the prices at Amazon.com within a minute. (half of the 14 minutes was figuring out how to parse XML using python on App Engine)

It took almost no code to interface Amazon on bookburro.org's appengine. (please forgive my hackish python as I spend most of my time in ruby)

class isbn:
    def GET(self, isbn):
        url = "http://webservices.amazon.com/onca/xml" + \
              "?Service=AWSECommerceService&AWSAccessKeyId=%s" + \
              "&Operation=ItemLookup&ResponseGroup=Medium&ItemId=%s"

        result = urlfetch.fetch(url=(url % (amazon_aws_access_key, isbn)), 
                                method = urlfetch.GET)

        prices = []
    
        if result.status_code == 200:
            dom = minidom.parseString(result.content)
            for node in dom.getElementsByTagName('FormattedPrice'):
                prices.append(node.firstChild.data)

            if len(prices) > 0:
                return "Amazon.com prices: %s" % ', '.join(prices)

        return "send an ISBN to find Amazon.com book prices"

Google, Amazon, and TextMark (and web.py) have made building an SMS app trivial and fun. Also the user experience is much nicer than with Twitter. Users of my twitter bots have to: 1) follow the bot, 2) private messages d amazon [ISNB].


Share/Save/Bookmark

Published

Wed, 17 Sep 2008

View Comments


Want more like this?

Subscribe via RSS
or by email:

New Relic