Question

I've been hacking away with hubot for a few weeks now and loving it but have been stuck for a couple of days on the code snippet below. I have a listener that is receiving events via webhooks from our ticket system. That's working great! The problem I'm having is how do I then send some of this data to a room and update the topic?

Normally this is done via the msg.send or msg.topic callback that is sent with functions such as robot.respond but when using robot.router.post, I'm not clear on what object I should be referencing to send the message. Basically, how/where do I get msg defined within robot.router.post?

Apologies for newbness, I'm pretty new to all things javascript/coffeescript. Thanks!

module.exports = (robot) ->

  robot.router.post "/hubot/ticket_change", (req, res) ->
    ticket_info = req.body.issue.name + ": " + req.body.issue.summary
    robot.send ticket_info
    robot.topic ticket_info
Was it helpful?

Solution

room = <room id>
robot.messageRoom room, ticket_info
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top