いつの間にかheroku deployからnow推奨になっていたのでメモ。
slackin?
slackの招待を自動化する子。メアドを入れた人へ招待メールを送る
https://github.com/rauchg/slackin
now?
いわゆるクラウドデプロイ環境。パスワードの代わりにメールのリンクをクリックするとログインできます。
ここでアカウントを先に作っておく。loginを押して出てくる入力欄にメールアドレスを入れると、メールが送られるのでクリックして認証する。
https://zeit.co/
事前準備
npmでデプロイ環境を整える
$ npm install -g now
Slack tokenを取得する
ここで生成する。
https://api.slack.com/custom-integrations/legacy-tokens
デプロイ
slack apiとslackのチーム名を入れて下記を実行
$ now -e SLACK_API_TOKEN="<token>" -e SLACK_SUBDOMAIN="<team-name>" now-examples/slackin
途中でnowで使っているメールアドレスを聞かれるので入力。入力したメールアドレスへメールが届くので、リンクをクリックして認証。
$ now -e SLACK_API_TOKEN="<token>" -e SLACK_SUBDOMAIN="<team-name>" now-examples/slackin
> Enter your email: now-no-mailadress@example.com
> Please follow the link sent to now-no-mailadress@example.com to log in.
> Verify that the provided security code in the email matches Gentle Sea Turtle.
✔ Confirmed email address!
> Didn't find directory. Searching on GitHub...
> Deploying GitHub repository "now-examples/slackin"
> Using Node.js 7.6.0 (default)
> Ready! https://now-examples-slackin-xxxxxxxxxx.now.sh (copied to clipboard) [3s]
> Initializing…
> Building
> ▲ npm install
> ⧗ Installing:
> ‣ slackin@^0.13.0
> ✓ Installed 144 modules [3s]
> ▲ npm start
> > now-examples-slackin@1.0.0 start /home/nowuser/src
> > slackin --coc "$SLACK_COC" --channels "$SLACK_CHANNELS" $SLACK_SUBDOMAIN $SLACK_API_TOKEN
> Wed Mar 08 2017 13:07:05 GMT+0000 (GMT) – fetching
> Wed Mar 08 2017 13:07:05 GMT+0000 (GMT) – listening on 0.0.0.0:3000
> WARN: no logo configured
> Wed Mar 08 2017 13:07:06 GMT+0000 (GMT) – online 1, total 1
> Wed Mar 08 2017 13:07:06 GMT+0000 (GMT) – ready
> Deployment complete!
https://now-examples-slackin-xxxxxxxxxx.now.sh
にあたるurlをクリックすれば、slackinのページを利用可能です。
参照リンク
Slack APIのTokenの取得・場所
http://qiita.com/ykhirao/items/0d6b9f4a0cc626884dbb