Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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