Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.vibefollow.com/llms.txt

Use this file to discover all available pages before exploring further.

The VibeFollow class is the SDK’s single entry point. Construct it once per process with your API key; reuse it across requests.

Signature

import { VibeFollow } from '@vibefollow/sdk';

const vf = new VibeFollow({
  apiKey: process.env.VIBEFOLLOW_API_KEY!,
  baseUrl: 'https://api.vibefollow.com', // default
  timeoutMs: 10_000,                     // default
  maxRetries: 2,                         // default
  fetchImpl: globalThis.fetch,           // default
});
The constructor accepts a VibeFollowOptions object. Only apiKey is required; the rest have sensible defaults.

Options

apiKey
string
required
Your Vibefollow API key. Prefix sk_live_ for production, sk_test_ for the sandbox (when available). Must be kept server-side — the browser is not a supported runtime.
baseUrl
string
default:"https://api.vibefollow.com"
Override the API base URL. Useful for self-hosted deployments or pointing at a local mock during tests. Trailing slashes are stripped automatically.
timeoutMs
number
default:"10000"
Per-request timeout in milliseconds. Implemented with AbortController — the SDK throws NetworkError when the timeout fires.
maxRetries
number
default:"2"
Maximum number of retry attempts on transient failures (NetworkError, ServerError, RateLimitError). The total request count is maxRetries + 1. Set to 0 to disable retries entirely.
fetchImpl
typeof fetch
default:"globalThis.fetch"
Inject a custom fetch implementation. Useful in tests (pass a mock) or on edge runtimes that expose fetch under a different global.

Resources

After construction the instance exposes three readonly resource APIs:

vf.users

UsersAPI — identify users; emit lifecycle events.

vf.events

EventsAPI — track custom events; create batches.

vf.webhooks

Webhooks — verify signed webhook deliveries.
See users and events for the per-method reference.

Headers the SDK sets

Every outgoing request includes:
HeaderValue
AuthorizationBearer <apiKey>
Content-Typeapplication/json
User-Agentvibefollow-sdk/<SDK_VERSION>
Idempotency-Key<auto-generated v4 UUID>
The User-Agent lets the backend identify and warn on outdated client versions. SDK_VERSION is exported from the package if you need it elsewhere.

Lifecycle

The client is stateless — you can construct it on every request if you want, and there’s no close() method. Keep one instance per process if you prefer the conventional pattern.
The EventBatch instances returned by vf.events.batch() do carry state (in-memory queue + timer). Always await batch.flush() before process exit. See events resource.

Deprecated alias

AIFollowups is exported as a deprecated alias for VibeFollow to ease the @ai-revenue-manager/sdk@vibefollow/sdk rename. It will be removed in v2.0.0.
// Both of these work; prefer VibeFollow.
import { VibeFollow, AIFollowups } from '@vibefollow/sdk';