LoginSignup
12
12

More than 5 years have passed since last update.

hubot+slackをIRCで動かす

Posted at

hubot-slackアダプタだとcallback url設定しないと動かないっぽかったので、ローカルでも動くhubot-ircアダプタを試したメモ

Slack側の設定

Gateway設定の有効化

https://{team_name}.slack.com/admin/settings

上記ページの左側のメニューから、Administration > Settingsを選択。

スクリーンショット 2014-09-10 0.06.06.png

Gatewaysのペインを開いて"Enable IRC gateway(SSL only)"にチェックを入れる。

スクリーンショット 2014-09-10 0.05.50.png

Bot用ユーザの作成

適当にメールアドレス用意して

https://{team_name}.slack.com/admin/invites

から招待。

Bot用IRCログイン情報の取得

Bot用ユーザでslackにログインしなおし、下記ページにアクセス

https://{team_name}.slack.com/account/gateways

スクリーンショット 2014-09-10 0.14.45.png

hubot側の設定

hubotやらredisやらは既に入ってるものとする。

hubotのテンプレ作成

hubot -c mybot

hubot-ircアダプタ追加

npm install hubot-irc --save && npm install

hubot起動スクリプト作成

こんな感じのスクリプトを作成

run_hubot_with_irc.sh
#!/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

12
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
12