- Flow of Input -> Output is managed via Adapters and Hubot's "core" robot functionality. Adapters are initialized with a Hubot instance. They forward messages directly to the robot instance. They are also responsible for building a reply back to the source.
- Architecturally the Hubot (robot core) is aware of the adapter, and the adapter is aware of hubot.
Here's what a quick implementation looks like with SlackBot: https://github.com/slackhq/hubot-slack/blob/master/src/bot.coffee
create Hubot instance -> create adapter instance -> run
To view the sequence diagram, use jay's chrome extension
sequenceDiagram
participant ChatSource
participant Adapter
participant Robot
ChatSource->>Adapter: incoming message
Adapter->>Adapter: parse the message
Adapter->>Adapter: handle message type
Adapter->>Robot: tell robot message has been received
Robot->>Robot: uses heuristics to construct reply
Robot->>Adapter: send replied message
Adapter->>Adapter: wrap reply in ChatSource format
Adapter->>ChatSource: send reply
-> handle the message (these messages are abstracted in hubot here)