2013-06-25 60 views
1

我一直在使用hubot幾個星期,並喜歡它,但在代碼段中停留了幾天下面。我有一位聽衆通過我們的票務系統的webhook接收活動。這很好!我遇到的問題是如何將這些數據發送到一個房間並更新主題?如何使用hubot中的robot.router.post塊中的發送/主題

通常這是通過msg.send或msg.topic回調完成的,該回調與諸如robot.respond之類的函數一起發送,但是在使用robot.router.post時,我不清楚應該引用哪個對象發送消息。基本上,我如何/在哪裏獲得msg定義在robot.router.post內?

新手道歉,我很新的JavaScript /咖啡的所有東西。謝謝!

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 
+0

你使用哪種室系統?篝火或xmpp或irc? –

回答

2
room = <room id> 
robot.messageRoom room, ticket_info 
+0

這工作。謝謝! – Maxwell

相關問題