Assign or extract a stable unique identifier for each webhook event (many platforms provide an event ID in the payload or headers); store processed event IDs in a durable datastore.
Before processing any incoming webhook event, check whether the event ID has already been recorded in your idempotency store; if it has, return HTTP 200 immediately without reprocessing.
Respond to the webhook delivery with HTTP 200 as quickly as possible (ideally under a few seconds); offload actual processing to an async queue to avoid timeouts that would trigger source retries.
Design all processing logic to be safe to run multiple times with the same input (idempotent operations): use upsert semantics rather than blind inserts, and verify current resource state before applying updates.
Implement your own retry logic for downstream API calls (to the accounting platform) with exponential back-off and a maximum retry count; log failures with enough context to support manual reconciliation.
Set an expiry TTL on idempotency store entries (e.g., 30 days) to bound storage growth; most webhook platforms will not retry events indefinitely beyond their own retry window.
Known gotchas
HTTP 200 acknowledgment and actual processing must be decoupled; if processing fails after acknowledgment, your system must detect and recover the missed event through audit logs or periodic reconciliation jobs rather than relying on the source to redeliver.
Idempotency keys must be scoped to the source platform and event type; the same numeric ID can appear in payloads from different platforms, so prefix keys with a platform identifier to prevent cross-platform collisions.
Webhook delivery order is not guaranteed by most platforms; processing events out of order (e.g., a Delete before a Create) can corrupt state—build ordering tolerance by fetching the current resource state before applying changes.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp