Hubot http adapter
An adapter (not a plugin) for Hubot to work via HTTP using Json as data format.
Useful for headless chat.
inspiration: https://github.com/wichon/hubot-json-rest
Setup
Set environment variable:
HUBOT_POST_RESPONSES_URL
this is the url to send (POST
method) Hubot responses.
you need a webapp "listening" on this url, eg:
// This is an Express applicationapp;
Hubot response is sent in json format, with the following structure:
from: 'bot name' message: 'Hello 🌍'
Send message to Hubot
Typically messages to Hubot have three parameters: Message, User and Room:
// post: /receive/:room from: 'user name' message: 'Hello 🤖'
You can use fetch
(https://www.npmjs.com/package/node-fetch):
// POST message to the `general` room