curl -F room="maeno_test" -F message="test dayo" http://<host>/hubot/send
Created
January 22, 2016 05:15
-
-
Save myouju/6d89af4965a75833a6d9 to your computer and use it in GitHub Desktop.
外からslackにpostするbot
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
FROM cataska/hubot-slack | |
MAINTAINER Yuki Maeno | |
ADD send.coffee /home/yeoman/hubot/scripts/send.coffee | |
ENV SLACK_TOKEN XXXXX | |
WORKDIR /home/yeoman/hubot | |
CMD HUBOT_SLACK_TOKEN=${SLACK_TOKEN} bin/hubot --adapter slack >> /tmp/hubot.log 2>&1 |
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
module.exports = (robot) -> | |
robot.router.post "/hubot/send", (req, res) -> | |
if not req.body | |
res.end "body not found" | |
return | |
if not req.body.room | |
res.end "room not found" | |
return | |
if not req.body.message | |
res.end "message not found" | |
return | |
room_name = req.body.room | |
room = room: "#{room_name}" | |
message = req.body.message | |
robot.send room, message | |
res.end "send #{room_name} #{message}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment