IOSOR Learn
Carrier DLR Webhook Idempotency and Replay Gate
Verify exactly-once DLR processing across multi-carrier webhooks to prevent duplicate billing and state corruption before comparing route partners for idempotency guarantees.
Lead Telecom & Routing Architect · Lausanne, CH
Engineers must enforce exactly-once semantics on every inbound DLR webhook by combining carrier message IDs with deterministic deduplication keys stored in an idempotency ledger. Replay gates reject late or duplicate payloads before they mutate billing or delivery state.
Idempotency Key Construction
Compose keys from carrier_id, message_id, and status_timestamp truncated to second precision. Normalize carrier-specific field names (e.g., messageId, msg_id, sid) into a canonical schema before hashing. Store the resulting SHA-256 digest in a Redis SET with TTL matching the longest carrier retry window plus 24 hours.
Replay Gate Logic
On webhook receipt, compute the key and attempt SETNX. If the key exists, respond 200 OK with X-Replay: true and discard the payload. If SETNX succeeds, persist the raw payload to an append-only log, then process asynchronously. This guarantees at-least-once delivery to downstream systems while preserving exactly-once business effects.
During pre-flight verification, validate that automatic failover thresholds trigger deterministic rerouting without duplicating outbound segments or exhausting retry backoff budgets under peak regional load.
Carrier Retry Window Alignment
Map each carrier's documented retry schedule (typically 5 min, 15 min, 1 hr, 6 hr, 24 hr) to the idempotency TTL. Extend TTL by 24 hours beyond the final retry to absorb clock skew. Monitor TTL exhaustion alerts to detect carriers deviating from published schedules.
Webhook Latency and Ordering Safeguards
Enforce a 500 ms p99 processing SLA per webhook. Use per-carrier consumer groups with max.poll.records=1 to preserve ordering. Reject payloads where status_timestamp drifts >30 seconds from receipt time — route to a dead-letter queue for manual reconciliation.
Sender and Template Gates
Bind idempotency keys to the original sender_id and template_hash to prevent cross-campaign collision. Validate that the inbound DLR references a message previously accepted by the outbound gateway. Drop mismatches with 400 and alert.
Start with IOSOR
Compare verified route partners for idempotency guarantees and webhook reliability using the Decision Brief. Cross-reference deduplication audit patterns in carrier DLR duplicate receipt deduplication audit, timestamp drift handling in carrier DLR receipt timestamp drift audit, and sequence gap reordering in Carrier DLR Sequence Gap and Reordering Audit.
IOSOR takeaway
Compose keys from carrier_id, message_id, and status_timestamp truncated to second precision. Drop mismatches with 400 and alert (/tools/brief · DLR / webhook).
Was this guide helpful?
Related guides
- Inbox Placement Seed List Rotation: Audit and Partner Comparison
Audit seed-list rotation across ESPs and warmup tools for unbiased inbox-placement signals, then compare verified deliverability partners via /tools/brief.
- Verify GSM7 Extension Table Cost, SLA Enforcement Gate on Deliverability Routes
Operational gate to verify GSM7 extension table cost and SLA enforcement before raising SMS volume, then compare partner routes in /tools/brief for deliverability.
- Delivery Latency SLA Verification: Handoff Gate for Route Selection
Verify each candidate route's claimed delivery-latency SLA at the handoff boundary before comparing partners in Decision Brief and committing SMS volume.












