← ClaudeAtlas

clerk-webhookslisted

Receive and verify Clerk webhooks. Use when setting up Clerk webhook handlers, debugging signature verification, or handling user events like user.created, user.updated, session.created, or organization.created.
bertbertov/claude-stack · ★ 0 · AI & Automation · score 73
Install: claude install-skill bertbertov/claude-stack
# Clerk Webhooks ## When to Use This Skill - Setting up Clerk webhook handlers - Debugging signature verification failures - Understanding Clerk event types and payloads - Handling user, session, or organization events ## Essential Code (USE THIS) ### Express Webhook Handler Clerk uses the [Standard Webhooks](https://www.standardwebhooks.com/) protocol (Clerk sends `svix-*` headers; same format). Use the `standardwebhooks` npm package: ```javascript const express = require('express'); const { Webhook } = require('standardwebhooks'); const app = express(); // CRITICAL: Use express.raw() for webhook endpoint - verification needs raw body app.post('/webhooks/clerk', express.raw({ type: 'application/json' }), async (req, res) => { const secret = process.env.CLERK_WEBHOOK_SECRET || process.env.CLERK_WEBHOOK_SIGNING_SECRET; if (!secret || !secret.startsWith('whsec_')) { return res.status(500).json({ error: 'Server configuration error' }); } const svixId = req.headers['svix-id']; const svixTimestamp = req.headers['svix-timestamp']; const svixSignature = req.headers['svix-signature']; if (!svixId || !svixTimestamp || !svixSignature) { return res.status(400).json({ error: 'Missing required webhook headers' }); } // standardwebhooks expects webhook-* header names; Clerk sends svix-* (same protocol) const headers = { 'webhook-id': svixId, 'webhook-timestamp': svixTimestamp, 'webhook-signature': svixSignatu