0

I'm using Hubot on flowdock and I'm trying to make Hubot post automatically the respond of a user command.

With the help of https://leanpub.com/automation-and-monitoring-with-hubot/read#leanpub-auto-periodic-task-execution , I've managed to make Hubot talk at a specific time creating a cron.coffee script, so no issues with that.

The thing is that I have another script (trello.coffee) that makes Hubot respond to the command "show cards" and I want the result of this command to be posted in a specific time without the need of me telling Hubot to do this.

How exactly can I do this without the need to write another script (ie. trello.auto.coffee) and the whole robot.emit -> robot.on procedure?

Monolo
  • 18,205
  • 17
  • 69
  • 103

1 Answers1

0

What about using the http listener? This page has a section for HTTP Listener and has this code example:

module.exports = (robot) ->
  robot.router.post '/hubot/chatsecrets/:room', (req, res) ->
    room   = req.params.room
    data   = if req.body.payload? then JSON.parse req.body.payload else req.body
    secret = data.secret

    robot.messageRoom room, "I have a secret: #{secret}"

    res.send 'OK'

Would that work?

nomadic_squirrel
  • 614
  • 7
  • 21