Skip to content

Instantly share code, notes, and snippets.

@myouju
Created January 22, 2016 05:15
Show Gist options
  • Save myouju/6d89af4965a75833a6d9 to your computer and use it in GitHub Desktop.
Save myouju/6d89af4965a75833a6d9 to your computer and use it in GitHub Desktop.
外からslackにpostするbot
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
curl -F room="maeno_test" -F message="test dayo" http://<host>/hubot/send
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