Created
June 14, 2017 06:03
-
-
Save horie1024/eda7953d98b4ab9ede898e7e49e45424 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('request'); | |
module.exports = (robot) => { | |
// Slackへの全ての投稿を監視 | |
robot.catchAll((msg) => { | |
// チャンネル名で絞り込み | |
if (msg.envelope.room === 'Channel name to monitor.') { | |
// Slack APIのreactions.addを使用してemojiリアクションを投稿に付ける | |
let options = { | |
url: 'https://slack.com/api/reactions.add', | |
qs: { | |
token: process.env.HUBOT_SLACK_TOKEN, | |
name: 'ok_woman', | |
channel: msg.message.rawMessage.channel, | |
timestamp: msg.message.rawMessage.ts | |
} | |
} | |
// requestモジュールを利用しPOSTリクエスト | |
request.post(options, (err, res, body) => {}); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment