Data EngineeringFDE integration and deployment foundations

Design a webhook receiver that tolerates duplicate events

PK
Pankit Kumar
Sr. Data Scientist at Parexel (a Goldman Sachs–backed company) · 20 September 2026 · 2 min read
Technically reviewed by Ishaan Sharma
In this article (3 sections)

Webhook delivery is commonly at least once. A provider retry after timeout must not create another order, payment or message.

Deduplicate fixture events

The integration lab receives E1 twice.

python
from integration_cases import webhook_case

result = webhook_case()
assert result["responses"] == ["processed", "duplicate", "processed"]
assert result["effects"] == {"E1": 10, "E2": 20}
assert result["processed_count"] == 2
assert result["signature_verified_fixture"] is True
assert result["network_called"] is False

Verify signature over the exact raw body, timestamp tolerance and expected source before parsing. Store provider event ID with a uniqueness constraint in the same transaction as accepted work, or use an inbox table. A duplicate returns the stored state.

Acknowledge quickly after durable acceptance and process asynchronously. Handle out-of-order events by version/time rules. Keep signature secrets out of logs and rotate them with overlap.

The FDE for Freshers course uses webhook idempotency in its integration core.

Exercise

Send one signed fixture event twice and one tampered event. Prove the effect count is one and the invalid signature is rejected before parsing.

Continue learning

This article is part of the FDE integration and deployment foundations sequence. Use the neighbouring tasks when you need the prerequisite or the next application.

Reference: Standard Webhooks specification.

PK
Pankit Kumar
Lead Instructor, NeuraPath Academy

Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.

This article is part of our FDE for Freshers programme — 6–7 months. Build your engineering foundations, then take AI from discovery to delivery.

Explore FDE for Freshers
Counselling is free · no obligation

Not sure which programme fits?

Tell us your background and we will map it to the right entry point — including saying so when a cheaper programme is the better fit. A counsellor replies within one working day.