clerk-webhooks

Implement verified Clerk webhook handlers for user, organization, and billing event synchronization.

Updated Jul 9, 2026
One-click install
npx skills add https://github.com/DimonikRV/ghost-pilot-project --skill clerk-webhooks-dimonikrv
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clerk-webhooks
Source: https://github.com/DimonikRV/ghost-pilot-project/tree/main/.agents/skills/clerk-webhooks
Command: npx skills add https://github.com/DimonikRV/ghost-pilot-project --skill clerk-webhooks-dimonikrv

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building webhook endpoints for Clerk authentication events requires correct signature verification, public route configuration, and framework-specific request handling, and mistakes lead to 401 errors, spoofed events, or missed database syncs. ## Core Features & Use Cases - Verified Webhook Handlers: Generate complete handlers using verifyWebhook from framework-specific packages like @clerk/nextjs/webhooks and @clerk/express/webhooks. - Event Coverage: Handle user, session, organization, organization membership, subscription, and payment events with typed payload access. - Use Case: Sync new signups to a Postgres users table via Prisma, send welcome emails through Resend, and post Slack notifications when user.created fires, all from one verified endpoint. ## Quick Start Set up a Clerk webhook handler in my Next.js app that verifies the signature and inserts new users into my database when user.created fires.

Frequently Asked Questions about clerk-webhooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up a Clerk webhook handler in Next.js?▼

Create a POST route at app/api/webhooks/route.ts that calls verifyWebhook from @clerk/nextjs/webhooks, which reads CLERK_WEBHOOK_SIGNING_SECRET automatically. Handle events like user.created by checking evt.type, and exclude the route from Clerk middleware protection.

How to sync Clerk users to a database with webhooks?▼

Listen for user.created, user.updated, and user.deleted events in a verified webhook handler. Extract id, email_addresses, first_name, and last_name from evt.data, then map them to your database columns such as clerkId, email, and name using Prisma or another client.

Why does my Clerk webhook return 401 unauthorized errors?▼

A 401 means the webhook route is protected by Clerk middleware. Add the webhook path to a public route matcher using createRouteMatcher(['/api/webhooks(.*)']) in clerkMiddleware so unauthenticated Svix requests can reach the endpoint.

Why does Clerk webhook verification fail in Express?▼

Verification fails because express.json() parses the body before signature checking. Use express.raw({ type: 'application/json' }) on the webhook route so verifyWebhook from @clerk/express/webhooks receives the raw body bytes required for signature validation.

Can I skip webhook signature verification for notification-only handlers?▼

No, every webhook handler must verify the signature, even for notification-only use cases like welcome emails or Slack alerts. Skipping verification exposes the endpoint to spoofed events from anyone who knows the URL.

When should I use Clerk webhooks versus the Backend API?▼

Use webhooks for asynchronous, eventually consistent tasks like database sync and notifications. For synchronous flows where you need data the user just created, read the session token or call the Backend API directly instead of waiting for webhook delivery.