Anthropic Claude Webhooks in n8n: Step-by-Step
Receive Anthropic Claude events in n8n via webhooks. Setup, signature verification, retries, and idempotency.
Key takeaways
- Return 200 fast — do work async.
- Always verify signatures with HMAC.
- Dedupe on event ID for idempotency.
- Log raw payloads to enable replay.
Webhooks are the fastest way to react to Anthropic Claude events. In this tutorial you'll build a production-grade endpoint that verifies signatures, deduplicates events, and gracefully handles retries.
Step 1 — Create the n8n webhook
Drag a Webhook trigger onto the canvas. Copy the URL. Switch mode from Test to Production once wired up.
Return a 200 immediately — do heavy work asynchronously in a queue-mode workflow.
Step 2 — Register the endpoint in Anthropic Claude
In Anthropic Claude, open the webhooks or developer settings and paste the URL. Select only the events you actually need.
Save the signing secret; you'll use it in the next step.
Step 3 — Verify signatures
Use a Code node with crypto.createHmac to verify the signature header against the request body. Reject anything that doesn't match with 401.
Never trust an unsigned webhook — even from a private service.
Step 4 — Idempotency and retries
Store the event ID in Postgres or Redis and short-circuit if you've seen it. Anthropic Claude will retry — you must be safe.
Log the raw payload for 30 days so replay is trivial when a downstream fails.
Frequently asked questions
- Why not poll Anthropic Claude?
- Polling adds latency and API cost. Webhooks are near-real-time and cheaper.
- What if my endpoint is down?
- Anthropic Claude retries with backoff. Idempotency ensures no duplicate work when it comes back.
- Where do I store the signing secret?
- n8n Credentials or an env var — never in the workflow JSON.
- How do I test locally?
- Use the Test URL n8n gives you; it stays open for one execution and streams the payload back.