Wendung.identify(userId) in the browser and send the same ID from your server. Server steps for anonymous visitors, before they sign up, are not supported.
Create a secret key
- Open the project’s Settings → API keys and click Add API key.
- Choose Secret key and give it a name, such as
Billing webhooks. - Copy the key. Wendung stores only a hash of it, so it is shown once.
- Add it to your server environment, for example as
WENDUNG_SECRET_KEY.
sk_. Never put one in frontend code: ingest rejects any request that uses a secret key from a browser with HTTP 403 and the reason secret_key_in_browser. If a secret key was exposed, delete it in settings and create a new one.
Agents connected through the Wendung MCP server can’t create or reveal secret keys. They see them masked, so the key never passes through the agent.
Send a step from Node.js, Workers, or edge functions
Install the SDK and import the server entry point. It uses onlyfetch, so it runs on Node.js 18 or newer, Cloudflare Workers, Vercel Edge Functions, and Deno. Full reference: WendungServer.
appUserId is the ID you pass to identify() in the browser. Look it up from your own records, for example from metadata you stored on the Stripe customer.
step() waits until ingest accepts the step. It retries rate limits, server errors, and network failures up to three attempts with backoff, and your handler waits through those retries before it responds. It never throws, so a Wendung error or an invalid timestamp can’t fail your webhook. It returns { ok: true, status } on success and { ok: false, status, error } otherwise, and logs failures with console.warn. Pass debug: true to also log accepted steps. The WendungServer constructor does throw if the secret key is missing or doesn’t start with sk_.
Send a step over HTTP
From other languages, send aPOST request to the ingest endpoint with the secret key in the X-API-Key header and no Origin header. One request carries up to 100 events.
202 with accepted, batchId, and requestId. Retry 429 and 5xx responses with backoff. Don’t retry other 4xx responses: the request will fail the same way again.
Retries and duplicates
Wendung stores an event once per project, event ID, step name, and timestamp. A retry with the sameid and timestamp replaces the earlier copy instead of adding a second one. A retry with a new timestamp, such as the time the retry ran, is stored as a separate event and counted twice. That is why timestamp should come from the source event, not from the current time.
How server steps appear in reports
A server step has no browser, device, location, or traits of its own. For filters and segment breakdowns, Wendung uses the context of the user’s most recent browser event at or before the server step: country, city, device, browser, operating system, source, plan, and traits.- A user who signs up on a phone and pays from a webhook counts as a mobile user at the payment step, even if they later visit on a laptop.
- Wendung looks for that context in the selected date range. In some reports, such as conversion trends and step timing, it looks only at events that are steps of the same funnel.
- If no browser event comes before the server step in that range, the step’s context is unknown. Filters on device, location, source, plan, or traits leave it out.
- Property filters apply to the server step’s own
properties.
Consent
Server steps don’t pass through the browser SDK’s consent state. You decide whether you may record a step for that user under the rules that apply to you. If a user declined analytics in your consent manager, skipstep() for them on the server too. Wendung does not store consent choices. See Consent.
Limits
- Server steps count toward the workspace’s monthly event quota on every plan, including Free.
- Secret keys have their own rate limit bucket at the plan’s rate, separate from the project’s browser traffic. See Plans and limits.