Module 7 · Webhook & carrier error lab

Interactive DLR Webhook Normalizer, Carrier Error Classifier & HMAC-SHA256 Verifier

Classify SMPP, SIP, SMTP, and WhatsApp Meta Graph errors into failover vs hard-bounce actions, then copy HMAC-SHA256 verified webhook payloads and verifier middleware.

Router verdict

Retry on Failover Rail

Error
SMPP_0x00000014 · SMPP_GSM
Action
failover_immediately
Failover delay
150ms
Category
carrier congestion
Rails
Beem Africa → ClickSend

Downstream SMSC queue is saturated. Reroute immediately to secondary partner with independent MNO bind.

Live Signature & Idempotency Inspector

eventId
evt_dach_sms_smpp0x00000014
idempotencyKey
idem_dach_sms_99481a
timestampUnix
1794240000
X-IOSOR-Signature-256: t=1794240000,v1=53b05d376efc5e5b53b05d376efc5e5b53b05d376efc5e5b53b05d376efc5e5b

Normalized DLR Webhook Payload

{
  "schema": "https://iosor.com/schemas/normalized-dlr-webhook-v1.json",
  "eventId": "evt_dach_sms_smpp0x00000014",
  "idempotencyKey": "idem_dach_sms_99481a",
  "timestampUnix": 1794240000,
  "corridor": "DACH",
  "workload": "sms",
  "originRail": {
    "role": "primary",
    "partnerId": "beemafrica",
    "partnerName": "Beem Africa"
  },
  "telemetry": {
    "protocol": "SMPP_GSM",
    "errorCode": "SMPP_0x00000014",
    "errorTitle": "Message Queue Full / MSC Congestion (0x14)",
    "category": "carrier_congestion"
  },
  "routerDecision": {
    "retryableOnFailover": true,
    "action": "failover_immediately",
    "targetFailoverPartnerId": "clicksend",
    "targetFailoverPartnerName": "ClickSend",
    "failoverDelayMs": 150,
    "idempotencyTtlSec": 86400
  }
}

HMAC-SHA256 Verifier Middleware

Replay window + timing-safe compare + idempotency key store stubs for TypeScript, Python, and Go.

Open JSON API
// IOSOR 2027 Webhook HMAC-SHA256 + Replay & Idempotency Guard (Node / Edge)
import crypto from 'node:crypto';

export function verifyAndClassifyWebhook(
  rawBody: string,
  signatureHeader: string,
  secret: string,
  seenIdempotencyKeys: Set<string>,
  toleranceSec = 300
) {
  const parts = Object.fromEntries(signatureHeader.split(',').map((p) => p.split('=')));
  const ts = Number(parts.t || 0);
  if (Math.abs(Math.floor(Date.now() / 1000) - ts) > toleranceSec) {
    throw new Error('WEBHOOK_REPLAY_WINDOW_EXPIRED');
  }
  const expected = crypto
    .createHmac('sha256', secret)
    .update(`${ts}.${rawBody}`)
    .digest('hex');
  if (!crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1 || ''))) {
    throw new Error('WEBHOOK_SIGNATURE_MISMATCH');
  }
  const event = JSON.parse(rawBody);
  if (seenIdempotencyKeys.has(event.idempotencyKey)) {
    return { status: 'duplicate_ignored', action: 'noop' };
  }
  seenIdempotencyKeys.add(event.idempotencyKey);
  return {
    status: 'verified',
    action: event.routerDecision.action,
    failoverPartnerId: event.routerDecision.targetFailoverPartnerId,
  };
}
VERIFIED BY IOSOR EXPERT · B2B ROUTING, SLA & PROVIDER Q&A

IOSOR Expert — Verified Q&A & B2B Messaging Decisions

Every Q&A decision below is audited by the IOSOR Telecom Architecture Expert against live 90-day uptime telemetry, carrier compliance rules (10DLC, DLT, GDPR), and real partner TCO.

All Q&A Triggers
#01 · Compliance & Sender ID📖 Knowledge hub · US A2P / 10DLC

US A2P / 10DLC

“Why do US 10DLC TCR campaigns get rejected and which partner handles fast onboarding?”

✓ Verified by IOSOR Expert

10DLC brand and campaign programs for US A2P traffic — not general privacy compliance.

All Q&A Triggers
#02 · OTP & verification📖 Knowledge hub · India DLT

India DLT

“How do engineering teams prevent India TRAI DLT template scrubbing drops on OTPs?”

✓ Verified by IOSOR Expert

DLT and PE-TM registration for India A2P — not an India corridor coverage guide.

All Q&A Triggers
#03 · OTP & verification📖 Knowledge hub · Verify / OTP

Verify / OTP

“How do we eliminate OTP p95 timeout spikes and trigger a 20–30s multi-rail fallback?”

✓ Verified by IOSOR Expert

Login codes without chaos: abuse, latency, and cost control.

All Q&A Triggers
#04 · Transactional email📖 Knowledge hub · Email

Email

“Why do password reset and 2FA emails land in Spam when sharing bulk marketing IPs?”

✓ Verified by IOSOR Expert

Transactional email alongside SMS, voice, and WhatsApp in one routing architecture.

All Q&A Triggers
#06 · WhatsApp Business📖 Knowledge hub · WhatsApp & RCS

WhatsApp & RCS

“How do Meta per-conversation fees and template pauses impact WhatsApp Business TCO?”

✓ Verified by IOSOR Expert

Rich channels when profiles and templates are ready: honest setup.

All Q&A Triggers
#08 · Failover & backup routing📖 Knowledge hub · Failover & rails

Failover & rails

“How do we keep a second standby provider warm for failover at $0/month idle cost?”

✓ Verified by IOSOR Expert

Ordered backup paths when a primary rail fails - distinct from DLR status truth.

All Q&A Triggers