WaitKitWaitKit
JavaScript SDK

Subscribers

Create subscribers and retrieve waitlist counts using the SDK.

The subscribers resource handles waitlist signups and counts.

create

Adds a subscriber to the waitlist.

Call this method from the browser only. Server-side calls will record your deployment server's IP and location instead of the actual subscriber. See Integration Guide for framework-specific setup.

const result = await wk.subscribers.create({
  email: "user@example.com",
});

Parameters

ParamTypeRequiredDescription
emailstringyesSubscriber email address
namestringnoSubscriber display name
sourcestringnoOverrides the default source for this signup
metadataRecord<string, unknown>noArbitrary metadata (JSON-serializable)

Source precedence

The source value is resolved in this order:

  1. create({ source }) — per-call override
  2. new WaitKit({ source }) — instance default
  3. "landing-page" — built-in fallback
// Uses instance default ("referral")
const wk = new WaitKit({
  apiKey: "...",
  projectSlug: "...",
  source: "referral",
});

// Override per-call ("partner-page")
await wk.subscribers.create({ email: "a@example.com", source: "partner-page" });

// Uses instance default ("referral")
await wk.subscribers.create({ email: "b@example.com" });

// No instance default specified — falls back to "landing-page"
const wk2 = new WaitKit({ apiKey: "...", projectSlug: "..." });
await wk2.subscribers.create({ email: "c@example.com" });

Response

Returns the created subscriber entry with its generated ID and timestamps.

interface JoinResult {
  id: string;
  email: string;
  name?: string;
  source?: string;
  createdAt: string;
}

count

Returns the total number of subscribers for the project.

const count = await wk.subscribers.count();
// => 42

Optionally pass a different project slug to query another project's count:

const count = await wk.subscribers.count("other-project");

Errors

Both methods throw WaitKitError on failure. See the Error Handling guide for details.

On this page