By default, Hal uses Slack’s hubot integration. Currently Hal will
listen in on all public channels, or a custom list of channels if
HAL_SLACK_CHANNELS is declared. Private groups
require the IRC gateway to work around a current limitation of the Slack
API. See Using IRC Gateway. The IRC gateway is the author’s
preferred method as your bot will automatically join all channels and
groups to which it belongs, and removing Hal from a room is as simple as a
/kick hal command. Some advanced features like attachment uploading
are not supported at this time.
Start by adding the Hubot integration for your team (if you haven’t done so).
// blank import to register adapter import _ "github.com/danryan/hal/adapter/slack"
HAL_ADAPTER=slack # The adapter HAL_SLACK_TOKEN=blah # Your integration token # Default: none (required) HAL_SLACK_TEAM=acmeinc # Your Slack subdomain (<team>.slack.com) # Default: none (required) HAL_SLACK_BOTNAME=HAL # The username Hal will send replies as # Default: HAL_NAME HAL_SLACK_ICON_EMOJI=":poop:" # The emoji shortcut used as the response icon # Default: none HAL_SLACK_CHANNELS="" # not yet implemented HAL_SLACK_CHANNEL_MODE="" # HAL_SLACK_LINK_NAMES="" # not yet implemented
Specify how to treat the list of channels in
HAL_SLACK_CHANNELS`. Disabled if
HAL_SLACK_CHANNELS is empty.
- Options: whitelist, blacklist
- Default: whitelist
- Required: false
Using IRC Gateway¶
The default integration only works with public chats. If you want hal to listen in on private chats, you must utilize the IRC gateway. You’ll need a real user for hal, so be mindful of the username you choose for it and make sure you configure your bot to use that name so it can login to the IRC gateway. When enabled, hal will only use the IRC gateway to listen for messages. Hal can be configured to either respond using the API or the IRC gateway.
- Enable the IRC gateway in the admin settings
- Choose “Enable IRC gateway (SSL only)”. You don’t want your private messages sent unencrypted.
- Register a new user
- Sign in as this new user
- Capture your new IRC credentials
- Set the following environment variables
HAL_SLACK_IRC_ENABLED # Enable the Slack IRC listener # Default: 0 # Options: 0, 1 ; 0 is disabled, 1 is enabled HAL_SLACK_IRC_PASSWORD # The IRC gateway password # Default: none (required) HAL_SLACK_RESPONSE_METHOD # The method by which hal will respond to a message. # The irc option requires that the IRC gateway be configured # Default: http # Options: http, irc
For more information, please see the following link: * Connecting to Slack over IRC and XMPP