WendungServer sends funnel steps from server code with a secret key. Each call sends one step and waits for ingest to accept it. There is no queue or flush timer, so it works in serverless functions that stop after the response.
fetch, so it runs on Node.js 18 or newer, Cloudflare Workers, Vercel Edge Functions, and Deno.
Constructor
The project’s secret key. It must start with
sk_; the constructor throws otherwise. Read it from the server environment, never from frontend code.step()
A unique ID for this step, up to 100 characters. Use the source event’s own ID, such as a Stripe event ID, so a retried webhook is stored once.
The user the step belongs to, up to 255 characters. Use the same ID you pass to
identify() in the browser.When the step happened, as a
Date or an ISO 8601 string. Ingest accepts steps up to 7 days old and at most 5 minutes in the future.Returns
Promise<ServerStepResult>. It never rejects.
step() retries 429 responses, 5xx responses, and network failures up to three attempts, waiting 0.5 and then 1 second between them. Other 4xx responses are returned without a retry. See Errors for the rejection reasons.