flowdock-stream

A streaming client for flowdock flows

flowdock-stream

A node module for streaming flowdock flows.

npm install flowdock-stream

var FlowdockStream = require('flowdock-stream');
var flowdockstream = FlowdockStream.createClient('organization', 'flow', 'apikey');
 
flowdockstream.on('data', function flowDockEventHandler(data) {
    if (data.event === 'message') console.log('a message!', data.content);
});
 
flowdockstream.on('error', function realGoodErrorHandler(err) {
    throw err;
});

A stream is created with the only exported function as follows:

FlowdockStream.createClient( organization, flow, apikey )

    - all three arguments are mandatory

The stream itself is a readable node.js stream, but added are a couple of methods for convenience:

FlowdockStream.flowUsers

    - Object that contains the ids and nicks of all the users in the flow at the time of joining, set once for your convenience

FlowdockStream.getUsers( callback )

    - Function that takes a *callback* which returns two arguments *error* (Error), and *users* (Object)

FlowdockStream.send( message, [commentToId], [callback] )

    - Function that can be used to send messages to the flow. Optionally you can pass an message-id as the second argument to send the message as a comment to a previous message. Also takes an optional callback which is passed to the underlying *request* module.

http://ok.mit-license.org