clerk-webhooks
БесплатноБез исполняемых скриптовНе проверенClerk webhooks for real-time events and data syncing. Listen for user creation, updates, deletion, and organization events. Build event-driven features like…
от vvedantb★ 100 звёзд на GitHubОб этом скилле
Webhooks
Prerequisite: Webhooks are asynchronous. Use for background tasks (sync, notifications), not synchronous flows.
Documentation Reference
| Task | Link |
|---|---|
| Overview | https://clerk.com/docs/guides/development/webhooks/overview |
| Sync to database | https://clerk.com/docs/guides/development/webhooks/syncing |
| Debugging | https://clerk.com/docs/guides/development/webhooks/debugging |
| Event catalog | https://dashboard.clerk.com/~/webhooks (Event Catalog tab) |
Quick Start
- Create endpoint at
app/api/webhooks/route.ts - Use
verifyWebhook(req)from@clerk/nextjs/webhooks - Dashboard → Webhooks → Add Endpoint
- Set
CLERK_WEBHOOK_SIGNING_SECRETin env - Make route public (not protected by middleware)
Supported Events
User: user.created user.updated user.deleted
Organization: organization.created organization.updated organization.deleted
Organization Domain: organizationDomain.created organizationDomain.updated organizationDomain.deleted
Organization Invitation: organizationInvitation.created organizationInvitation.accepted organizationInvitation.revoked
Organization Membership: organizationMembership.created organizationMembership.updated organizationMembership.deleted
Roles: role.created role.updated role.deleted
Permissions: permission.created permission.updated permission.deleted
Session: session.created session.updated session.ended session.removed session.revoked session.pending
Communication: email.created sms.created
Invitations: invitation.created invitation.accepted invitation.revoked
Waitlist: waitlistEntry.created waitlistEntry.updated
Full catalog: Dashboard → Webhooks → Event Catalog
When to Sync
Do sync when:
- Need other users' data (social features, profiles)
- Storing extra custom fields (birthday, country, bio)
- Building notifications or integrations
Don't sync when:
- Only need current user data (use session token)
- No custom fields (Clerk has everything)
- Need immediate access (webhooks are eventual consistency)
Key Patterns
Make Route Public
Webhooks come unsigned. Route must be public:
Ensure clerkMiddleware() doesn't protect /api/webhooks(.*) path.
Verify Webhook
Use correct import and single parameter:
import { verifyWebhook } from "@clerk/nextjs/webhooks";
const evt = await verifyWebhook(req); // Pass request directly
Type-Safe Events
Narrow to specific event:
if (evt.type === "user.created") {
// TypeScript knows evt.data structure
}
Handle All Three Events
Don't only listen to user.created. Also handle user.updated and user.deleted.
Queue Async Work
Return 200 immediately, queue long operations:
await queue.enqueue("process-webhook", evt);
return new Response("Received", { status: 200 });
Webhook Reliability
Retries: Svix retries failed webhooks for up to 3 days. Return 2xx to succeed, 4xx/5xx to retry.
Replay: Failed webhooks can be replayed from Dashboard.
Common Pitfalls
| Symptom | Cause | Fix |
|---|---|---|
| Verification fails | Wrong import or usage | Use @clerk/nextjs/webhooks, pass req directly |
| Route not found (404) | Wrong path | Use /api/webhooks |
| Not authorized (401) | Route is protected | Make route public |
| No data in DB | Async job pending | Wait/check logs |
| Duplicate entries | Only handling user.created |
Also handle user.updated |
| Timeouts | Handler too slow | Queue async work |
Testing & Deployment
Local: Use ngrok to tunnel localhost:3000 to internet. Add ngrok URL to Dashboard endpoint.
Production: Update webhook endpoint URL to production domain. Copy signing secret to production env vars.
Установить clerk-webhooks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
WebFetchВложенные файлы
FAQ
Что делает скилл clerk-webhooks?
Clerk webhooks for real-time events and data syncing. Listen for user creation, updates, deletion, and organization events. Build event-driven features like database sync, notifications, integrations.
Как установить скилл clerk-webhooks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл clerk-webhooks запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic