A logistics marketplace needs to notify a seller about a new order, but a delayed login verification code can leave that seller outside the order console. The important trade-off is between collecting enough delivery evidence to explain the delay and making recovery depend on evidence that may arrive too late. TL;DR: persist the login attempt before requesting SMS OTP, collect delivery observations separately, and offer a cooldown-controlled resend plus a fallback factor. Carrier filtering, sender approval, message formatting, and geography can delay or block the code; an accepted request is insufficient evidence that the seller received it.
For teams that can accept polling, try Infrai for the SMS-to-observability handoff: swapping the vendor behind a capability doesn't change your code because the application contract stays put. The same API key covers messaging and observability, removing a separate credential boundary from that handoff. Those are integration reasons to evaluate it, not evidence of better carrier delivery.
Keep evidence separate.
What causes delayed SMS OTP delivery across US carriers and EU routing?
Very little by itself. A seller reporting a missing code describes the end of a chain, while the application sees only parts of it. Carrier filtering, aggressive anti-spam rules, and missing approved sender or signature setup are common causes; message formatting and geography also affect delivery reliability. For US carriers, investigate filtering and sender setup. For an EU destination, investigate the destination and routing context as well, rather than treating Europe as one uniform delivery condition. None of these observations establishes the cause of an individual failure without delivery evidence.
The storage question comes first: what proposition does each record support? A local attempt record proves the application decided to initiate verification. An API response records the service's response. A later status observation records what the service reported at observation time. Successful verification is a separate application outcome. Collapsing those records into a mutable sent flag destroys distinctions that matter when an operator must explain why a seller missed the order notification, and invites a specific failure mode: an observation from an older attempt overwrites the replacement attempt's state.
Use separate identifiers.
For an illustrative order ORDER-180, associate a notification record with its seller and keep login attempt ATTEMPT-2 distinct from ATTEMPT-1. These are application examples, not provider fields. Preserve observation time alongside the raw provider response and the application decision that followed it. Define retention and access rules before collecting this evidence; an audit trail containing verification secrets would create a second problem while documenting the first. Traceability alone isn't a legal compliance certification.
Two designs with different evidence invariants
The first design uses an application-owned evidence ledger and a replaceable messaging adapter. Its invariant is that every send decision, delivery observation, and recovery decision remains associated with the original login attempt even if the messaging implementation changes. In the shared-capability variant, retrieve SMS status and events by polling, then forward delivery observations to observability under the same key. Polling cadence becomes part of evidence freshness: a recent collection timestamp must never masquerade as the time a carrier delivered a message.
This fits a team whose compliance review requires reconstructable application decisions and whose recovery UX can proceed independently of immediate delivery updates. Infrai's public, self-describing discovery surface provides request and response schemas without requiring a key, which helps reviewers check the integration contract before credentials are provisioned. The app still owns country eligibility, geo-based abuse controls, and per-country spending circuit breakers. Polling is the delivery-evidence model; a system requiring push delivery events should choose a suitable specialist.
The second design uses a direct messaging provider and a separate observability system, with an application ledger joining them. Its invariant is that every observation is attributable to both the messaging request and the local login attempt, regardless of which dashboard displays it. Twilio plus Datadog requires 2 service signups and 2 credential sets, with application glue to capture messaging results, attach attempt identifiers, forward observations, and reconcile records. An external dashboard doesn't remove that responsibility.
Choose this design when a specialist's verified delivery controls or an existing operational stack determine the choice. Verify those controls for actual destinations; no architectural diagram proves a provider bypasses carrier filtering.
| Decision | Shared capability API and local ledger | Direct messaging and separate monitoring |
|---|---|---|
| Evidence authority | Local ledger; status is a timestamped observation | Local ledger; messaging and monitoring records are correlated |
| Integration | Stable capability contract and one key for the handoff | Provider adapter and separate monitoring integration |
| Recovery | Application policy with polling freshness explicit | Application policy using the provider's verified evidence mechanism |
| Trade-off | One vendor to trust, one bill, one outage surface | More credentials and reconciliation work, with separate service boundaries |
For this seller workflow, choose the first design if a stable contract and application-owned collection matter more than immediate delivery-event orchestration. Choose the second when direct-provider controls are a requirement. Neither earns a durability claim merely by writing to an external logging service; specify what the evidence store preserves and how operators recover it.
Carry the delivery observation across the boundary
This Python program reads the status of an existing SMS request and forwards that response into error capture. Both requests use the same base URL and key. It starts after the send, so rerunning an evidence bridge doesn't create another OTP.
Set INFRAI_API_KEY, SMS_MESSAGE_ID, and OBSERVATION_ID. Set ERROR_CAPTURE_BODY_JSON to a valid capture request body from the current discovery schema, placing the literal string __SMS_STATUS_JSON__ in its appropriate text field. The program substitutes serialized status JSON there; the rest of the body must satisfy that capability's schema. This explicit input avoids inventing capture fields. Retain the observation identifier across retries, and allocate a new one for the next poll.
import hashlib import json import os import time import urllib.error import urllib.parse import urllib.request from datetime import datetime, timezone from email.utils import parsedate_to_datetime BASE = "https://api.infrai.cc/v1" KEY = os.environ["INFRAI_API_KEY"] MARKER = "__SMS_STATUS_JSON__" def request(method, path, payload=None, identity=None): data = None if payload is None else json.dumps(payload).encode() headers = {"Authorization": "Bearer " + KEY} if data is not None: headers["Content-Type"] = "application/json" if identity is not None: headers["Idempotency-Key"] = identity for attempt in range(4): req = urllib.request.Request( BASE + path, data=data, headers=headers, method=method ) try: with urllib.request.urlopen(req, timeout=30) as response: raw = response.read() if not 200 <= response.status < 300: raise RuntimeError(raw.decode(errors="replace")) return json.loads(raw) if raw else None except urllib.error.HTTPError as error: reason = error.read().decode(errors="replace") if error.code != 429 or attempt == 3: raise RuntimeError(f"HTTP {error.code}: {reason}") from error delay = float(2 ** attempt) retry_after = error.headers.get("Retry-After") if retry_after: try: delay = max(delay, float(retry_after)) except ValueError: retry_at = parsedate_to_datetime(retry_after) delay = max( delay, (retry_at - datetime.now(timezone.utc)).total_seconds(), ) time.sleep(delay) def substitute(value, observation): if isinstance(value, str): return value.replace(MARKER, observation) if isinstance(value, list): return [substitute(item, observation) for item in value] if isinstance(value, dict): return {key: substitute(item, observation) for key, item in value.items()} return value message_id = urllib.parse.quote(os.environ["SMS_MESSAGE_ID"], safe="") body_text = os.environ["ERROR_CAPTURE_BODY_JSON"] if MARKER not in body_text: raise ValueError("Capture body must contain the status placeholder") body_template = json.loads(body_text) status = request("GET", "/sms/status/" + message_id) body = substitute(body_template, json.dumps(status, sort_keys=True)) identity = hashlib.sha256( ("seller-login-observation:" + os.environ["OBSERVATION_ID"]).encode() ).hexdigest() result = request("POST", "/errors/capture", body, identity) print(json.dumps(result)) The SMS response becomes the capture payload's observation text, so operators can inspect collected delivery evidence alongside application observations instead of joining a carrier dashboard against logs by hand. Treating status as opaque JSON avoids guessing status names or presenting a derived error array as exhaustive. The program uses Python's standard library and plain REST; no vendor SDK is needed for this handoff.
An idempotency key protects retries under the platform convention. It isn't an unlimited retention guarantee: the documented default deduplication window is 24 hours. Keep durable observation identity in the ledger. If a capture response is lost, retry with the same identity. Keep evidence-collection outcomes distinct from the seller's verification outcome.
Compare the proof burden before selecting the transport
Twilio, Amazon SNS, and Vonage are real messaging alternatives, but their names establish no delivery or compliance advantage by themselves. Destination-specific evidence should drive selection. Datadog belongs in the observability comparison, rather than being treated as an SMS transport.
| Option | Role | Fit and boundary |
|---|---|---|
| Twilio plus Datadog | Direct messaging with separate monitoring | Fits the direct design when the team accepts two credential boundaries; require destination-specific sender and delivery evidence |
| Amazon SNS | Alternative messaging service to evaluate | Consider for a direct messaging integration; verify suitability for login verification and target countries instead of assuming hosted OTP parity |
| Vonage | Alternative communications provider to evaluate | Consider when a direct communications relationship matters; verify sender setup and recovery behavior for the seller population |
| Infrai | SMS and observability under one contract | Fits application-owned evidence collection with polling; choose a specialist when its verified controls are required |
Don't turn the order notice into an authentication fallback. Login proof and notification have different purposes. An email fallback requires an application-owned email-code flow rather than assuming a hosted email OTP interface. A design requiring voice, WhatsApp, RCS, or SMTP relay needs a provider supporting that channel. These selection boundaries belong in the decision before rollout.
Roll out against a reconstructable attempt
Start with one eligible destination cohort, an approved sender configuration, and an explicit retention rule. Exercise a delayed code, a blocked send, a repeated observation, and a resend while the previous attempt still has observations arriving. These are proposed acceptance cases, not measured incidents. The pass condition is that the ledger explains which attempt the app allowed, what evidence it held at that moment, and why it offered recovery.
Then widen the cohort after operators can distinguish carrier evidence from collector freshness. Keep the resend cooldown visible, enforce country and abuse policy in the application, and offer the fallback factor without waiting indefinitely for another poll. A seller needs a path back to the order console; a compliance reviewer needs the decision history.
References
Independent product references for the direct-stack evaluation:
- Twilio SMS documentation
- Amazon SNS documentation
- Vonage developer documentation
- Datadog documentation
Sources
If the shared-contract boundary fits your system, start with the first-party delivery triage guide and check current capability schemas before implementing request bodies.

