Clerk
Use Clerk's signed user.created webhook as signup proof — no backend database hook required.
- A Clerk application (development or production instance).
Webhook events
| Event | What it signals | Growth Rail action |
|---|---|---|
user.created | A new Clerk user was created through any signup flow. | Record signup proof; join to pending SDK attribution claim. |
How attribution works
A verified provider event proves the signup happened — but not that the user was referred. Growth Rail completes a referral only when that event joins to the opaque attribution claim previously captured by the SDK on the referring user's device.
Create the Growth Rail connection
Open Dashboard → Integrations → Auth, choose Clerk, and create a Sandbox or Production connection. Copy the generated webhook endpoint URL — you will paste it into Clerk in the next step.
Register the webhook in Clerk
In Clerk Dashboard → Webhooks, add the copied endpoint and subscribe to user.created.
Return to Growth Rail and save the Clerk/Svix signing secret (whsec_…). Growth Rail encrypts and stores it — the raw value is never returned by the API after saving.
Pass attribution data from your app
No Clerk metadata is required. The Clerk user ID passed to the Growth Rail SDK must be the same data.id delivered by Clerk.
import { GrowthRail } from '@growth-rail/core';
// Run after Clerk has resolved the signed-in user.
// The SDK automatically sends its stored referral attribution token.
await GrowthRail.initAppUser(clerkUser.id);Verify end-to-end in test mode
Create a new Clerk user through your normal signup UI. Confirm one user.created delivery in Clerk and a Completed or Awaiting attribution outcome in Growth Rail.
| Outcome | Meaning |
|---|---|
| Completed | Signup proof and SDK attribution token matched. The referral reward has been triggered. |
| Awaiting attribution | The webhook signature was valid, but the SDK claim has not arrived yet — or the stable user ID did not match a pending claim. The event is held; Growth Rail completes the referral when the claim arrives. |
| Ignored | The event was verified but no matching attribution claim exists and the hold window has expired, or the event type is out of scope. |
- Clerk can also emit user.created for dashboard or API-created users. Growth Rail records the proof but only rewards it when the same user has a pending SDK attribution claim.
- Do not pass an email address to initAppUser. Use Clerk's stable user ID.