Skip to content

Instantly share code, notes, and snippets.

@horie1024
Created June 14, 2017 06:03
Show Gist options
  • Save horie1024/eda7953d98b4ab9ede898e7e49e45424 to your computer and use it in GitHub Desktop.
Save horie1024/eda7953d98b4ab9ede898e7e49e45424 to your computer and use it in GitHub Desktop.
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