Search code examples
coffeescripthubotchatbot

How to intercept/hook into Hubot responses


Is there any way to intercept all Hubot triggers/response globally? The interception should be able to inspect, modify, forward, or reject Hubot response before being sent.

Some goals I would like to achieve:

  • Throttle all message sent by Hubot (from all plugins/scripts) to prevent flooding.
  • Apply some kind of ACL (Access Control List) to limit who can use a command.
  • etc.

I cannot find it in the official Hubot documentation. Am I missing some things?


Solution

  • For controlling access to listeners, check out listener middleware: https://hubot.github.com/docs/scripting/#listener-middleware https://hubot.github.com/docs/patterns/#restricting-access-to-commands

    For rate limiting command execution, check out hubot-rate-limit: https://github.com/michaelansel/hubot-rate-limit

    For controlling responses, keep an eye on the response middleware PR: https://github.com/github/hubot/pull/1021