Migrating a hubot from HipChat to Slack

My work recently migrated from HipChat to Slack.  Not wanting to leave our beloved hubot behind, I set about changing the configuration to bring it over.  It turned out to be pretty straightforward, but since existing articles covered setting it up from scratch, I used the excuse to dust the cobwebs off my blog and write a specific guide.

Existing setup

In Slack

In your hubot code

  • Add the Slack module "hubot-slack":"^4.3.4" to hubot’s dependencies in package.json
  • Amend the hubot command option in Procfile to use the Slack option:
    web: bin/hubot -a slack --alias <bot name>

In Heroku

  • Add a config variable HUBOT_SLACK_TOKEN and give it the value of the Slack token (should start with xoxb-)
  • Deploy the code through Heroku

And that’s it!  hubot should then show up as active user on the Slack (if running in Heroku) and respond to script prompts.