This is a version of GitHub's Campfire bot, hubot. He's pretty cool.
Included in the
/scripts directory is a file called github.coffee.
That enables github post-commit hooks to automatically be deployed to Heroku.
The chatroom adapter is Partychat by default.
Set up these environment variables:
PROD_URL: The url for production. (Hubot tells you when it's done.)
STAGE_URL: Same as above, but for staging.
PRIV: Set up your private key for Heroku and Github.
GITHUB_URL: Your github repo to pull from.
HEROKU_PROD_REPO: Your heroku production repo URL to push to.
HEROKU_STAGE_REPO: Your heroku stage repo to push to.
HEROKU_URL: The url of your hubot on heroku. (Used to keepalive, I think)
HUBOT_POST_ENDPOINT: Used for partychat. (check hubot-partychat-hooks)
Playing with Hubot
You'll need to install the necessary dependencies for hubot. All of those dependencies are provided by npm.
Hubot has a HTTP listener which listens on the port specified by the
You can specify routes to listen on in your scripts by using the
module.exports = (robot) -> robot.router.get "/hubot/version", (req, res) -> res.end robot.version
There are functions for GET, POST, PUT and DELETE, which all take a route and callback function that accepts a request and a response.
If you are going to use the
redis-brain.coffee script from
you will need to add the Redis to Go addon on Heroku which requires a verified
account or you can create an account at Redis to Go and manually
% heroku config:add REDISTOGO_URL="..."
If you don't require any persistence feel free to remove the
hubot-scripts.json and you don't need to worry
about redis at all.
Testing Hubot Locally
You can test your hubot by running the following.
You'll see some start up output about where your scripts come from and a prompt.
[Sun, 04 Dec 2011 18:41:11 GMT] INFO Loading adapter shell [Sun, 04 Dec 2011 18:41:11 GMT] INFO Loading scripts from /home/tomb/Development/hubot/scripts [Sun, 04 Dec 2011 18:41:11 GMT] INFO Loading scripts from /home/tomb/Development/hubot/src/scripts Hubot>
Then you can interact with hubot by typing
Hubot> hubot help Hubot> animate me <query> - The same thing as `image me`, except adds a few convert me <expression> to <units> - Convert expression to given units. help - Displays all of the help commands that Hubot knows about. ...
Take a look at the scripts in the
./scripts folder for examples.
Delete any scripts you think are silly. Add whatever functionality you
want hubot to have.
Adapters are the interface to the service you want your hubot to run on. This can be something like Campfire or IRC. There are a number of third party adapters that the community have contributed. Check the hubot wiki for the available ones.
If you would like to run a non-Campfire or shell adapter you will need to add
the adapter package as a dependency to the
package.json file in the
Once you've added the dependency and run
npm install to install it you can
then run hubot with the adapter.
% bin/hubot -a <adapter>
<adapter> is the name of your adapter without the
There will inevitably be functionality that everyone will want. Instead of adding it to hubot itself, you can submit pull requests to hubot-scripts.
To enable scripts from the hubot-scripts package, add the script name with extension as a double quoted string to the hubot-scripts.json file in this repo.
% heroku create --stack cedar % git push heroku master % heroku ps:scale app=1
If your Heroku account has been verified you can run the following to enable and add the Redis to Go addon to your app.
% heroku addons:add redistogo:nano
If you run into any problems, checkout Heroku's docs.
You'll need to edit the
Procfile to set the name of your hubot.
More detailed documentation can be found on the deploying hubot onto Heroku wiki page.
Deploying to UNIX or Windows
Restart the bot
You may want to get comfortable with
heroku logs and
if you're having issues.