Skip to content
This repository
branch: master


This is a Hubot adapter to use with Slack.
Build Status

Getting Started

Creating a new bot

  • npm install -g hubot coffee-script
  • hubot --create [path_name]
  • cd [path_name]
  • npm install hubot-slack --save
  • Initialize git and make your initial commit
  • Check out the hubot docs for further guidance on how to build your bot

Testing your bot locally

  • ./bin/hubot

Deploying to Heroku

This is a modified set of instructions based on the instructions on the Hubot wiki.

  • Make sure hubot-slack is in your package.json dependencies
  • Edit your Procfile and change it to use the slack adapter:

    web: bin/hubot --adapter slack
  • Install heroku toolbelt if you haven't already.

  • heroku create my-company-slackbot
  • heroku addons:add redistogo:nano
  • Activate the Hubot service on your "Team Services" page inside Slack.
  • Add the config variables. For example:

    % heroku config:add HEROKU_URL=
    % heroku config:add HUBOT_SLACK_TOKEN=dqqQP9xlWXAq5ybyqKAU0axG
    % heroku config:add HUBOT_SLACK_TEAM=myteam
    % heroku config:add HUBOT_SLACK_BOTNAME=slack-hubot
  • Deploy and start the bot:

    % git push heroku master
    % heroku ps:scale web=1
  • Profit!

Adapter configuration

This adapter uses the following environment variables:


This is the service token you are given when you add Hubot to your Team Services.


This is your team's Slack subdomain. For example, if your team is, you would enter myteam here.


Optional. What your Hubot is called on Slack. If you entered slack-hubot here, you would address your bot like slack-hubot: help. Otherwise, defaults to slackbot.


Optional. If you entered blacklist, Hubot will not post in the rooms specified by HUBOT_SLACK_CHANNELS, or alternately only in those rooms if whitelist is specified instead. Defaults to blacklist.


Optional. A comma-separated list of channels to either be blacklisted or whitelisted, depending on the value of HUBOT_SLACK_CHANNELMODE.


Optional. By default, Slack will not linkify channel names (starting with a '#') and usernames (starting with an '@'). You can enable this behavior by setting HUBOT_SLACK_LINK_NAMES to 1. Otherwise, defaults to 0. See Slack API : Message Formatting Docs for more information.

Under the Hood

Receiving Messages:

The slack adapter adds a path to the robot's router that will accept POST requests to:



Expected parameters:

  • text
  • user_id
  • user_name
  • channel_id
  • channel_name

If there is a message and it can deduce an author from those paramters, it'll create a new TextMessage object and have the robot receive it, from there proceeding down the regular hubot path.

Sending Messages

When a script calls send() or reply() this adapter makes a POST request to your team's specific URL webhook:


with a JSON-formatted body including the following dictionary:

  • username
  • channel
  • text
  • link_names (optionally)
Something went wrong with that request. Please try again.