Skip to content

Instantly share code, notes, and snippets.

@ota42y
Created August 28, 2014 22:46
Show Gist options
  • Save ota42y/5b4342b36ba845d40197 to your computer and use it in GitHub Desktop.
Save ota42y/5b4342b36ba845d40197 to your computer and use it in GitHub Desktop.
When post /hubot/send_message, hubot send message to chat
module.exports = (robot) ->
robot.router.post "/hubot/send_message", (req, res) ->
if not req.body
res.end ""
return
room_name = req.body.room
message = req.body.message
room_name = process.env.HUBOT_DEFAULT_POST_ROOM unless room_name
robot.send {room: room_name}, 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