Registry / http-networking / klaviyo-node

klaviyo-node

JSON →
library1.0.8jsnpmunverified

Unofficial Node.js client for Klaviyo's HTTP API (v1.0.8, last updated 2020). Designed for server-side tracking of customer events and profile identification. Uses public token for track/identify and private API key for metrics/lists. No TypeScript types; requires Node 6+. Minimal abstraction over Klaviyo's REST API. Not affiliated with Klaviyo.

npm install klaviyo-node
INSTALL
IMPORT
SIG · KLAVIYO-NODE
K
klaviyo-node
http-networkingjavascriptv1.0.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import Klaviyo from 'klaviyo-node';
const { Klaviyo } = require('klaviyo-node');
Default export is the constructor. CommonJS: const Klaviyo = require('klaviyo-node');
Klaviyo (constructor)
const client = new Klaviyo('PUBLIC_TOKEN');
new Klaviyo();
Public token is required. Private API key is an optional second argument.
track
client.track('Event Name', 'email@example.com', { property: 'value' });
client.track({ event: 'Event', email: '...' });
First argument is event name string, second is email (or customerProperties object), third is optional event properties, fourth is optional profile properties.
identify
client.identify('email@example.com', { '$first_name': 'John' });
client.identify({ email: '...', properties: {...} });
First argument is email string or object with $email key, second is profile properties.

Initializes client with public token from env, tracks a purchase event with profile properties, and identifies a profile with custom properties.

const Klaviyo = require('klaviyo-node'); const client = new Klaviyo(process.env.KLAVIYO_PUBLIC_TOKEN ?? ''); // Track an event client.track( 'Purchased Item', { $email: 'customer@example.com' }, { item: 'Shoes', price: 59.99 }, { $first_name: 'Jane', $last_name: 'Doe' } ); // Identify a profile client.identify( { $email: 'customer@example.com' }, { Plan: 'Premium', $city: 'New York' } ); console.log('Events tracked successfully');
Debug
Known issues
gotchaThe 'track' method requires a public token; using a private API key will cause authentication failures.
fix
Ensure you use your Klaviyo Public API Key (found in Klaviyo > Settings > API Keys) for track/identify calls.
affects: >=1.0.0
deprecatedThe package uses deprecated Klaviyo v1 API endpoints which may be removed in the future.
fix
Migrate to the official Klaviyo SDK (klaviyo) which uses v2 API.
affects: >=1.0.0
breakingNo breaking changes documented; package is stable but unmaintained.
fix
No fix needed; but consider switching to official SDK.
affects: all
Errors
Common errors & fixes
TypeError: Klaviyo is not a constructor
Using named import instead of default import (ESM) or wrong require destructuring (CJS).
fix
Use: const Klaviyo = require('klaviyo-node'); // CJS
or
import Klaviyo from 'klaviyo-node'; // ESM
Error: You must pass a public API key
Constructing Klaviyo instance without arguments or with undefined token.
fix
Pass your Klaviyo public token as first argument: new Klaviyo('pk_...');
Request failed with status 403
Using private API key for track/identify endpoints which require public token.
fix
Use the public API key (starts with 'pk_') for client instantiation when calling track or identify.
Upgrade
Version history
1.0.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
37 hits · last 30 days
node
34
OpenAI (training)
1
Resources
klaviyo-node — npm install klaviyo-node · libregistry