Windback.
SDKs

Node.js SDK

Official Windback SDK for Node.js.

Node.js SDK

Official Node.js SDK for the Windback API.

Installation

npm install @windback/node
pnpm add @windback/node
yarn add @windback/node
bun add @windback/node

Quick Start

import { Windback } from "@windback/node";

const client = new Windback({
  apiKey: process.env.PAYBACK_SECRET_KEY, // sk_... from dashboard settings
});

// Get stats
const stats = await client.stats.get();
console.log(`Recovery rate: ${stats.recovery_rate}%`);

// List churn events
const events = await client.churnEvents.list({
  status: "new",
  limit: 10,
});

// Generate recovery emails
const variants = await client.churnEvents.generateVariants("event-id");

// Send a recovery email
await client.churnEvents.sendVariant("event-id", "variant-id");

// Mark as recovered
await client.churnEvents.markRecovered("event-id");

The SDK uses your secret API key (sk_...) for authentication, not JWT tokens. Get your API key from Settings in the dashboard.

API Reference

Windback(options)

OptionTypeDescription
apiKeystringYour secret API key (sk_...)
baseUrlstringAPI base URL (optional)

client.stats.get()

Returns aggregate statistics.

client.churnEvents.list(params?)

ParamTypeDescription
statusstringFilter by status
limitnumberItems per page
offsetnumberItems to skip

client.churnEvents.get(id)

Get a single churn event by ID.

client.churnEvents.generateVariants(id)

Generate 9 AI recovery email variants.

client.churnEvents.sendVariant(eventId, variantId)

Send a specific variant email.

client.churnEvents.markRecovered(id)

Mark an event as recovered.