{"id":27895,"library":"klaviyo-node","title":"klaviyo-node","description":"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.","status":"maintenance","version":"1.0.8","language":"javascript","source_language":"en","source_url":"https://github.com/itsolucas/klaviyo-node","tags":["javascript","klaviyo","email","klaviyo.com","client"],"install":[{"cmd":"npm install klaviyo-node","lang":"bash","label":"npm"},{"cmd":"yarn add klaviyo-node","lang":"bash","label":"yarn"},{"cmd":"pnpm add klaviyo-node","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export is the constructor. CommonJS: const Klaviyo = require('klaviyo-node');","wrong":"const { Klaviyo } = require('klaviyo-node');","symbol":"default","correct":"import Klaviyo from 'klaviyo-node';"},{"note":"Public token is required. Private API key is an optional second argument.","wrong":"new Klaviyo();","symbol":"Klaviyo (constructor)","correct":"const client = new Klaviyo('PUBLIC_TOKEN');"},{"note":"First argument is event name string, second is email (or customerProperties object), third is optional event properties, fourth is optional profile properties.","wrong":"client.track({ event: 'Event', email: '...' });","symbol":"track","correct":"client.track('Event Name', 'email@example.com', { property: 'value' });"},{"note":"First argument is email string or object with $email key, second is profile properties.","wrong":"client.identify({ email: '...', properties: {...} });","symbol":"identify","correct":"client.identify('email@example.com', { '$first_name': 'John' });"}],"quickstart":{"code":"const Klaviyo = require('klaviyo-node');\nconst client = new Klaviyo(process.env.KLAVIYO_PUBLIC_TOKEN ?? '');\n\n// Track an event\nclient.track(\n  'Purchased Item',\n  { $email: 'customer@example.com' },\n  { item: 'Shoes', price: 59.99 },\n  { $first_name: 'Jane', $last_name: 'Doe' }\n);\n\n// Identify a profile\nclient.identify(\n  { $email: 'customer@example.com' },\n  { Plan: 'Premium', $city: 'New York' }\n);\n\nconsole.log('Events tracked successfully');","lang":"typescript","description":"Initializes client with public token from env, tracks a purchase event with profile properties, and identifies a profile with custom properties."},"warnings":[{"fix":"Ensure you use your Klaviyo Public API Key (found in Klaviyo > Settings > API Keys) for track/identify calls.","message":"The 'track' method requires a public token; using a private API key will cause authentication failures.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Migrate to the official Klaviyo SDK (klaviyo) which uses v2 API.","message":"The package uses deprecated Klaviyo v1 API endpoints which may be removed in the future.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"No fix needed; but consider switching to official SDK.","message":"No breaking changes documented; package is stable but unmaintained.","severity":"breaking","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use: const Klaviyo = require('klaviyo-node'); // CJS\nor\nimport Klaviyo from 'klaviyo-node'; // ESM","cause":"Using named import instead of default import (ESM) or wrong require destructuring (CJS).","error":"TypeError: Klaviyo is not a constructor"},{"fix":"Pass your Klaviyo public token as first argument: new Klaviyo('pk_...');","cause":"Constructing Klaviyo instance without arguments or with undefined token.","error":"Error: You must pass a public API key"},{"fix":"Use the public API key (starts with 'pk_') for client instantiation when calling track or identify.","cause":"Using private API key for track/identify endpoints which require public token.","error":"Request failed with status 403"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}