hubot-slackアダプタだとcallback url設定しないと動かないっぽかったので、ローカルでも動くhubot-ircアダプタを試したメモ
Slack側の設定
Gateway設定の有効化
https://{team_name}.slack.com/admin/settings
上記ページの左側のメニューから、Administration > Settingsを選択。
Gatewaysのペインを開いて"Enable IRC gateway(SSL only)"にチェックを入れる。
Bot用ユーザの作成
適当にメールアドレス用意して
https://{team_name}.slack.com/admin/invites
から招待。
Bot用IRCログイン情報の取得
Bot用ユーザでslackにログインしなおし、下記ページにアクセス
https://{team_name}.slack.com/account/gateways
hubot側の設定
hubotやらredisやらは既に入ってるものとする。
hubotのテンプレ作成
hubot -c mybot
hubot-ircアダプタ追加
npm install hubot-irc --save && npm install
hubot起動スクリプト作成
こんな感じのスクリプトを作成
#!/bin/sh
export HUBOT_IRC_SERVER="${TEAM_NAME}.irc.slack.com"
export HUBOT_IRC_ROOMS="#${CHANNEL_NAME}"
export HUBOT_IRC_NICK="${USER_NICK}"
export HUBOT_IRC_UNFLOOD="true"
export HUBOT_IRC_PASSWORD="${PASSWORD}"
export HUBOT_IRC_PORT=6667
export HUBOT_IRC_USESSL=true
bin/hubot -a irc --name ${BOT_NAME}
USER_NICK、PASSWORDにはそれぞれ、"Bot用IRCログイン情報の取得"で取得したUser、Passの値が入る。
hubot起動
sh ./run_hubot_with_irc.sh
bot以外のアカウントでCHANNEL_NAMEに指定したchannelにログインし、@mybot: ping
とかやって返事が返って来たら成功。
確認環境
MacOSX 10.9.4
node 0.10.21
hubot 2.8.1
hubot-irc 0.2.7