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
| Param | Type | Required | Description |
|---|---|---|---|
email | string | yes | Subscriber email address |
name | string | no | Subscriber display name |
source | string | no | Overrides the default source for this signup |
metadata | Record<string, unknown> | no | Arbitrary metadata (JSON-serializable) |
Source precedence
The source value is resolved in this order:
create({ source })- per-call override?source=or?s=URL parameter in the browsernew WaitKit({ source })- instance default"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();
// => 42Optionally 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.
Installation & Configuration
Install the waitkit npm package and configure the JavaScript SDK for your project. Connect to the WaitKit waitlist API with your API key and project slug.
React Hook
Integrate waitlist signups into your React app with the useWaitlist hook from waitkit/react. Reactive state for join, count, loading, and error handling in React components.
