Hi! I'm Nathan Hoad


How to: Hubot with Campfire on Heroku

Github's Hubot is an open-source chat bot that can join your Campfire and do all sorts of cool things. Getting your own Hubot is easy - in a few minutes you'll have it deployed to Heroku and chatting on Campfire.

First, grab a copy of the Heroku verion of Hubot or fork and clone mine. I'm assuming you already have a working knowledge of Git.

Now might also be a good time to give your bot a name. Open up the Procfile and change the name there (depending on where you got Hubot from the name is currently either Hubot or Alfred). Commit the change to Git.

Make sure you have a Heroku account and get the Heroku gem:

gem install heroku

Then set up the Heroku app:

heroku create --stack cedar
git push heroku master
heroku ps:scale web=1

Then set your HEROKU_URL environment variable:

heroku config:add HEROKU_URL="http://crazy-panda-3184.herokuapp.com"

Where http://crazy-panda-3184.herokuapp.com is the URL on Heroku where your app is technically living.

If you have a verified Heroku account then you can make use of Redis To Go:

heroku addons:add redistogo:nano

If not, then remove it from your scripts list. Open hubot-scripts.json and remove the "redis-brain.coffee" reference.

Campfire settings

Now you just need to tell it about your Campfire setup. Create a new user for your bot and sign in as them. Click the 'My Info' link in the top right of the screen:

Campfire My Info

Then copy your API token and send it up to Heroku:

heroku config:add HUBOT_CAMPFIRE_TOKEN="..."

Now you need to tell it which rooms you want to join and for which subdomain. Assuming the URL to one of your rooms is http://thing.campfirenow.com/room/12345 then you would send:

heroku config:add HUBOT_CAMPFIRE_ROOMS="12345"
heroku config:add HUBOT_CAMPFIRE_ACCOUNT="thing"

Where 12345 is the room ID and thing is the subdomain.

Make sure you sign out of Campfire now - you can't be signed in and have the bot running with the same user.

Now for good measure you can restart your bot (you might need to do this every now and then):

heroku restart

And that's all.

The next step is to start hacking and see what cool stuff you can get your bot to do

If I just made your day a little better then thank me with a coffee or maybe a a pizza