
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
stream-based bot micro framework

Parse slack outgoing webhooks POST payload and convert it to an event object with properties user and input.
var parse = require('querystring').parse;
var through = require('through');
function slackParser(options) {
var buffer = [];
return through(function(data) {
buffer.push(data.toString('utf8'));
}, function() {
var parsed = parse(buffer.join(''));
// omit payload from @slackbot which causes infinite meesage loop
if (parsed.user_name !== 'slackbot') {
this.queue({
user: parsed.user_name,
input: parsed.text
});
}
this.queue(null);
});
};
Here we define some rules to compose the outgoing message. Action must be defined as a function which returns a through (both readable and writable) stream.
function hello() {
return through(function(event) {
event.output = "hello " + event.user;
this.queue(event);
});
}
function bye() {
return through(function(event) {
event.output = "bye " + event.user;
this.queue(event);
});
}
Convert event object to slack response format.
function slackOutgoing() {
return through(function(event) {
this.queue(JSON.stringify({ text: event.output }));
});
};
Integrate all the functions into a botstream application.
var botstream = require('botstream');
var actions = botstream.select()
.case(/hello/, hello)
.case(/bye/, bye)
.default();
var bot = botstream.app(slackParser)
.register(actions)
.register(slackOutgoing);
Pipe it from/to existing application. Whatever application which implements stream interface is available.
app.post('/bot', function(req, res) {
res.setHeader('Content-Type', 'application/json');
req.pipe(bot.stream()).pipe(res);
});
FAQs
stream-based bot micro framework
The npm package botstream receives a total of 4 weekly downloads. As such, botstream popularity was classified as not popular.
We found that botstream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.