The problem
Webhook providers like Stripe, GitHub and PayPal retry a webhook delivery if they don’t get a fast enough response — which means your workflow can genuinely receive the exact same event twice. An automation that charges a customer, sends an email, or creates a record for every webhook call it receives will do that twice for a retried event, not once.
Expected outcome
By the end of this guide you will have a small dedupe check that recognizes an already-processed event ID and skips it, so a provider’s retry doesn’t cause a duplicate action.
Requirements and costs
- Node.js (version 18 or newer), used inside an n8n Code node or any script your workflow calls.
- Cost: free. No dependencies.
Step-by-step implementation
- Download the starter from the link below.
- Check for a duplicate before acting, using whatever unique ID the provider sends (most webhook payloads include one, e.g. Stripe’s
event.id):const { isDuplicate, markSeen } = require("./dedupe-events"); if (isDuplicate(event.id)) return { skipped: true }; markSeen(event.id); // ...now safe to actually process the event... - Mark it seen only after you’ve decided to process it, not before — so a crash partway through doesn’t silently mark a never-actually-processed event as done.
A real example
isDuplicate("evt_123") // false -- never seen before
markSeen("evt_123")
isDuplicate("evt_123") // true -- this is the retry; skip it
isDuplicate("evt_456") // false -- a genuinely different event
Verification and troubleshooting
What we tested, on 5 October 2026 (record TNT-TEST-2026-10-05-024): a fresh event ID correctly reported as not a duplicate; the same ID, after being marked seen, correctly reported as a duplicate on a simulated retry; and a genuinely different event ID correctly reported as not a duplicate — confirming the check only flags the exact same ID, not anything that merely arrived around the same time.
Troubleshooting:
- The provider’s payload has no obvious unique ID. Check their webhook documentation specifically — most real providers include one (often called
id,event_id, or similar) precisely because retries are a known, documented behavior of webhooks generally. - You’re running multiple workflow instances in parallel. This file-based approach assumes one process reading/writing at a time; for genuinely concurrent workers, a shared database with a unique constraint on the event ID is the more robust equivalent.
- The seen-ids file keeps growing. It already auto-prunes entries older than 24 hours on every check — if your provider can plausibly retry later than that, raise
MAX_AGE_MSaccordingly.
Limitations and alternatives
This dedupes by exact event ID only — it cannot detect two genuinely different events that happen to describe the same real-world action through some other path. For that broader kind of duplicate, you’d need business-logic-specific checks on top of this, not a replacement for it.
Free resources
The download contains the dedupe module.
Download the webhook dedupe starter (ZIP, 1 KB)
Need help implementing this?
If you’d rather have this set up and adapted for your own systems than build it yourself, TNT Review can help implement practical automation and AI workflows like this one for your business. See how this works or go straight to contact.
Is there a paid version?
Not yet. This is the complete method. TNT Review has sold nothing to date and has no checkout, so any price we discuss in future should be read as a hypothesis, not an offer.