segment-webhook
Koa middleware for Segment Webhooks Integration.
API
const JSONStream = const app = const webhooks = webhookswebhooks const webhook = webhooks app webhook webhookstream
Returns Koa middlweare.
const fn = SegmentWebhooks(webhooks)
webhooks
is a required Map
of path -> project_name
.
The project_name
will be set on each object as .project
.
This allows you to differentiate against different projects and environments
while using the same webhook for all of them.
fn.pipe([dest])
Pipe all the objects into another stream.
The destination must also be in objectMode
fn.stream.on('data', obj => )
Listen for all objects being passed.
fn.stream.on(type, obj => )
Filter by data types, ex. page
, identify
, track
, etc.