Method reference for the Pipelines client. See the README for installation and cross-cutting behavior (regions, retries, and promise handling).
The Pipelines API is Customer.io's ingestion endpoint for the Segment-compatible identify/track/page/screen/group/alias event model. It runs at a different host (cdp.customer.io) from the Track and App APIs and authenticates with a Pipelines write key (set up under Data Pipelines → Sources in the dashboard).
Need client-side batching, buffered flushes, or retries? Use
@customerio/cdp-analytics-nodeinstead.PipelinesClientin this package is a thin, stateless client that issues one HTTP request per call — same asTrackClientandAPIClient.
const { PipelinesClient, RegionUS, RegionEU } = require("customerio-node");
const pipelines = new PipelinesClient("YOUR_PIPELINES_WRITE_KEY", {
region: RegionUS, // or RegionEU; defaults to RegionUS
});Constructor options (second argument):
region:RegionUSorRegionEU. Defaults toRegionUS.url: Override the region-derived host. Useful for testing against a proxy.strictMode: Whentrue, sendsX-Strict-Mode: 1on every request so the Pipelines API validates payloads and returns proper HTTP error codes instead of accepting malformed events silently.defaultContext: Defaultcontextvalues merged under every outgoing payload (per-callcontextalways wins on key conflicts). Useful for setting things likeiporlocaleonce per client instance.timeout: HTTP timeout in ms. Defaults to10_000.
Pipelines payloads use camelCase (userId, anonymousId, groupId, previousId, messageId) because that's what the API accepts on the wire. This differs from the rest of this SDK, which is snake_case to match the Track and App APIs.
Every payload is augmented before sending:
messageId: A UUID v4, when not supplied.timestamp: The current time as an ISO-8601 string, when not supplied.context.library:{ name: 'customerio-node', version }, when not supplied.
Per-call values always win, so passing your own messageId (e.g. for idempotency) or timestamp (e.g. for backfilling) is supported.
Add or update a person and their traits.
pipelines.identify({
userId: "1",
traits: { email: "customer@example.com", plan: "pro" },
});At least one of userId or anonymousId is required.
Record an event.
pipelines.track({
userId: "1",
event: "Order Completed",
properties: { price: 23.45, product: "socks" },
});At least one of userId or anonymousId is required. event is required.
Log a page view.
pipelines.page({
userId: "1",
name: "Pricing",
properties: { path: "/pricing", referrer: "https://example.com" },
});Capture a mobile screen view from a server-side handler.
pipelines.screen({
userId: "1",
name: "Settings",
});Create an object/group and associate a person with it.
pipelines.group({
userId: "1",
groupId: "acme-co",
traits: { plan: "enterprise" },
});groupId is required, along with at least one of userId or anonymousId.
Merge profiles by reconciling identifiers.
pipelines.alias({
userId: "1",
previousId: "anon-abc-123",
});Both userId and previousId are required.
Submit up to 500 KB worth of identify/track/page/screen/group/alias events in a single request. Each item must include a type discriminator naming the endpoint it would otherwise have been sent to.
pipelines.batch([
{ type: "identify", userId: "1", traits: { plan: "pro" } },
{ type: "track", userId: "1", event: "Subscribed", properties: { plan: "pro" } },
]);Each item is enveloped (auto-filled messageId, timestamp, context.library) before sending.