clerk-webhooks

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

Updated Aug 7, 2026
One-click install
npx skills add https://github.com/Ramadan-Elgamal/Autobees --skill clerk-webhooks-ramadan-elgamal
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clerk-webhooks
Source: https://github.com/Ramadan-Elgamal/Autobees/tree/main/.agents/skills/clerk-webhooks
Command: npx skills add https://github.com/Ramadan-Elgamal/Autobees --skill clerk-webhooks-ramadan-elgamal

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, with automatic CLERK_WEBHOOK_SIGNING_SECRET reading. - Full Event Catalog Coverage: Handle user, session, organization, organization membership, subscription, subscription item, and payment attempt events with typed payload field references. - Framework Support: Ready-made handler patterns for Next.js, Express, Astro, Fastify, Nuxt, React Router, and TanStack Start, including Express raw-body parsing and middleware exclusion rules. - Use Case: Sync new signups to a Postgres users table via Prisma, send welcome emails through Resend, and post Slack notifications whenever a user.created event fires. ## Quick Start Set up a verified Clerk webhook handler in my Next.js app that syncs user.created events to my database.

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(req) from @clerk/nextjs/webhooks, then branch on evt.type such as user.created. Exclude /api/webhooks(.*) from clerkMiddleware protection so the route stays public.

Why does my Clerk webhook return 401 or fail verification in Express?

Express webhook routes fail verification when using express.json() because signature checks need the raw body bytes. Use express.raw({ type: 'application/json' }) on the webhook route and verifyWebhook from @clerk/express/webhooks with CLERK_WEBHOOK_SIGNING_SECRET set.

What events can Clerk webhooks send to my endpoint?

Clerk sends user, session, organization, organization membership, domain, invitation, email, SMS, waitlist, permission, role, subscription, subscription item, and payment attempt events. Each event type narrows evt.data to a typed JSON payload like UserJSON or OrganizationMembershipJSON.

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

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

How do I test Clerk webhooks locally during development?

Use the Clerk CLI tunnel with clerk webhooks listen --forward-to http://localhost:3000/api/webhooks, then add the printed relay URL as a Dashboard endpoint. Alternatively tunnel with ngrok or localtunnel and register the public URL in the Clerk Dashboard.

Should I use webhooks or the Clerk Backend API for reading user data?

Webhooks are asynchronous and eventually consistent, so use them for database sync, notifications, and integrations. For data needed synchronously after signup, read the session token or call the Backend API directly instead of waiting for webhook delivery.