Top / Hubot / TIPS集

Slackと連係

$ yo hubot 
... ウィザードにしたがって adapterを slackを選択
$ export HUBOT_SLACK_TOKEN=xoxb-xxxxxxxxxx   ←Slackの画面から取得
$ bin/hubot --adapter slack

httpモジュールでPOSTする

robot.respond /hoge/i, (res) ->
  url = "https://script.google.com/xxxx"
  res.http(url)
    .query(param1: "value1")
    .post() (error, response, body) ->
      res.send body

https://github.com/technoweenie/node-scoped-http-client これが使われているっぽい。

requestモジュールでPOSTする

request = require 'request'

url = "https://script.google.com/xxxx"
options =
  url: url
  method: "POST"
  timeout: 2000
  followAllRedirects: true
  form:{"param1": "value1"}

request options, (error, response, body) ->
  console.log response.statusCode
  console.log response.headers.location
  res.send body

この記事は

選択肢 投票
おもしろかった 0  
そうでもない 0  

Top / Hubot / TIPS集

現在のアクセス:2846


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS