Module Puppy - Giving Hubot a drop of Drupal knowledge

31 Jan 2012

We've been using the delightful Hubot chat bot with Campfire for a while now and I've been looking to ways to add Drupal-related features to it.

One idea was to add a module me <query> command that searches for modules. Unfortunately doesn't offer an API, but the update module uses a humongous XML file that contains some useful information like name, short name, creator and url for all projects hosted on

I wrote a little Sinatra app called Module Puppy that pulls down and parses relevant data from this XML file and makes it available via a simple JSON API. The app is hosted on Heroku which uses PostgreSQL as the default database. This meant that I could use the very nice multi-column search feature in PostgreSQL (easy with the texticle gem).

Hubot talks to the Sinatra app using a small CoffeeScript plugin, part of the hubot-scripts community scripts collection.

This makes Hubot listen for the phrase:

there's a module for <something>

and also, the more direct command:

<bot name> module me <something>

In practice, it looks like this: