WaitKitWaitKit
JavaScript SDK

Subscribers

Create waitlist subscribers and retrieve signup counts using the WaitKit JavaScript SDK. Learn the create() and count() methods, parameters, and source precedence rules.

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. ?source= or ?s= URL parameter in the browser
  3. new WaitKit({ source }) - instance default
  4. "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 a confirmation of the signup.

interface JoinResult {
  message: string;
  email: 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 SDK Errors page for details.

On this page