Appearance
Webhook Endpoints
Clerk User Sync
POST /api/webhooks/clerk
URL: https://g2-elite-webhook.2pw.workers.dev/api/webhooks/clerk
Receives Clerk webhook events and syncs user data to the D1 core database. Signatures verified using svix.
Events Handled
| Event | Action |
|---|---|
user.created | Insert into platform_users (clerk_id, email, firstName, lastName, phone, avatarUrl) |
user.updated | Update platform_users fields |
user.deleted | Soft-delete (set deleted_at) |
Required Headers
| Header | Description |
|---|---|
svix-id | Webhook event ID |
svix-timestamp | Event timestamp |
svix-signature | HMAC signature for verification |
Verification
The webhook secret (CLERK_WEBHOOK_SECRET) is used to verify the svix signature. Requests with missing or invalid signatures return 401.