Created
January 18, 2012 16:11
-
-
Save insom/1633778 to your computer and use it in GitHub Desktop.
A Hubot HTTP -> talking script
This file contains hidden or 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/say", (req, res) -> | |
room = req.body.room | |
message = req.body.message | |
robot.logger.info "Message '#{message}' received for room #{room}" | |
user = robot.userForId 'broadcast' | |
user.room = room | |
user.type = 'groupchat' | |
robot.send user, "#{message}" | |
res.writeHead 200, {'Content-Type': 'text/plain'} | |
res.end 'Thanks' |
Check https://gist.github.com/4643449 for a version which runs with hubot 2.4.6.
I opened a pull request to add this to the hubot-scripts repo: github/hubot-scripts#730 . Hope you are okay with this?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code requires that you run
master
of Hubot, so something like: