7

I'm writing a Hubot script to connect with our tracking system at work. It should be triggering a PHP script with various parameters, and then that script will send the response into the room.

How can I tell which room the message that Hubot is responding to came from, so I can send it in my AJAX request?

This is what my script looks like:

module.exports = (robot) ->

robot.hear /RT \d+$/, (msg) ->
    ticket = msg.match[1]

    msg.send "test"

    $.ajax 'YourScriptHere',
          data :
            room : room // This is what I need to find.
            ticket : ticket
Morgan Estes
  • 223
  • 3
  • 16
Ben Craig
  • 308
  • 9
  • 19

1 Answers1

13

This is how you get the room:

room = msg.message.room

Spajus
  • 7,356
  • 2
  • 25
  • 26