事前に、Hubot用のユーザをChatWorkに作成しておき、APIのアクセストークンを発行しておく。
申請方法は、公式ドキュメントを参考に。 http://developer.chatwork.com/ja/index.html
- node.jsがインストール済みであること
- Hubotがインストール済みであること
$ git clone [email protected]:tmknom/hubot-chatwork.git
$ cd hubot-chatwork
$ npm install
$ export HUBOT_CHATWORK_TOKEN="xxxxxxxx"
$ export HUBOT_CHATWORK_ROOMS="12345678"
$ export HUBOT_CHATWORK_API_RATE="600"
$ bin/hubot -a chatwork
先ほど環境変数でセットした、ChatWorkのグループチャット上で、「hubot ping」と入力。
HubotユーザがChatWork上で「PONG」と応答すればOK。
- Herokuのアカウントが作成済みであるとと
- Heroku Toolbeltがインストール済みであること
$ heroku login
$ heroku create
$ git push heroku master
$ heroku config:add HUBOT_CHATWORK_TOKEN="xxxxxx"
$ heroku config:add HUBOT_CHATWORK_ROOMS="1234"
$ heroku config:add HUBOT_CHATWORK_API_RATE="600"
heroku config:set HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s | grep web_url | cut -d= -f2)
$ heroku config:add TZ=Asia/Tokyo
ローカルの時と同様。