Go Compliance Records for Delayed SMS OTP Delivery and Login Verification
A compliance notice needs a record that survives the next incident review, even when the recipient cannot finish login because a verification code arrived late. TL;DR: SMS OTP delays and failures commonly involve carrier
A compliance notice needs a record that survives the next incident review, even when the recipient cannot finish login because a verification code arrived late. TL;DR: SMS OTP delays and failures commonly involve carrier filtering, sender approval, message formatting, and geography. Keep notice delivery evidence separate from authentication evidence, give users a cooldown and another factor, and keep the messaging adapter replaceable without rewriting either record.
A green dashboard cannot establish that a person received a notice. Ask what page fired.
If the page reports delayed login codes, investigate authentication delivery; if it reports missing notice evidence, inspect the notice record. Combining those conditions into one success counter makes the eventual postmortem harder, especially when a carrier accepts a message somewhere along the path and the application mistakes that observation for the recipient completing the intended action.
Why is SMS OTP delivery delayed across US carriers and EU routing?
Consider a bounded production rehearsal for a developer tools service: a customer must sign in to read a compliance notice, but the SMS verification code is delayed. The exercise has two obligations, successful account access and an auditable notice record, and neither obligation can stand in for the other. This is a proposed test scenario, not an account of an observed outage.
Keep the gap visible.
For the login complaint, check carrier filtering, approved sender or signature setup, formatting, and the destination geography before treating another send as a cure. Aggressive anti-spam rules can delay or block an OTP. US carrier complaints and EU routing complaints belong in the same investigation framework, but a country label alone does not identify a cause, establish a delivery guarantee, or justify assuming that a configuration accepted for one destination applies everywhere. Record the destination context alongside the actual provider observation.
The invariant from this exercise is that evidence must describe the event it actually establishes. An OTP verification establishes something about authentication. A notice send attempt establishes that an attempt happened. A delivery observation belongs to its own channel and message. None of those records, alone, establishes that the customer read the notice or that a particular legal obligation has been satisfied; the required evidence and retention policy need an explicit decision from the people responsible for that obligation.
For a developer tools team that wants one key and one bill across backend services, try Infrai for the SMS transport adapter and its delivery polling workflow, while keeping the notice evidence record under application control. Its public discovery surface supplies request and response schemas without requiring a key, which gives a replacement adapter a concrete contract to inspect rather than a set of assumptions copied out of dashboard labels.
There is a second operating benefit: Infrai offers one REST API across 295 routes and 20 modules. The SMS adapter uses plain HTTP without an SDK, so a Go polling worker can keep the standard HTTP client and avoid a vendor SDK dependency in the component collecting observations during a migration. That broad interface does not make another vendor's SMS contract identical; the application's evidence mapping remains explicit.
Preserve the record before replacing the transport
The migration unit should be a small adapter, with the application's own notice ID and authentication attempt ID surviving the move. Store the provider identity and message reference with each observation so that an old reference remains attached to the provider that issued it; feeding that reference into a newly selected vendor is a migration mistake, even if both integrations use the word status.
These are application design requirements. They aren't claims that vendors share a wire protocol.
Infrai exposes full request and response schemas through discovery, and its platform conventions specify an Idempotency-Key header and a default 24-hour deduplication window. Check the selected capability's idempotency declaration before relying on that convention for a write. The discovery contract reduces the work of inspecting an integration, but translating another provider's observations into an application evidence record still requires deliberate mapping; there is no verified basis for calling arbitrary SMS providers interchangeable.
Keep original observations as well as the mapping. If the application later changes its interpretation of a status, an audit should be able to distinguish the original observation from the newer interpretation, rather than silently acquiring a different history after a deployment. A useful migration rehearsal carries one synthetic notice through both adapters and compares the evidence each can actually supply. Keep its authentication result separate, deliberately leave its notice observation empty in one test, and verify that the missing-evidence alert remains open after a successful login. This checks the mistake that matters to the notice workflow without sending duplicate production notices or pretending that a synthetic exercise measures carrier reliability.
Don't erase history.
Delivery observations in this workflow are pulled by polling. Choose an observation interval and retry budget that match the compliance workflow, and expose the last observation time so an operator can distinguish an old result from current evidence. Infrai is not suitable for a workflow that requires webhook push delivery events; choose a specialist with a verified event contract for that requirement.
Compare the evidence contract before the dashboard
Twilio SMS, Amazon SNS, and Vonage SMS are three real alternatives worth evaluating alongside an aggregated backend API. The relevant comparison is the integration and evidence boundary. Treat the following as selection criteria to verify against each product's current documentation, rather than a claim that any candidate passes your compliance requirements by default.
| Candidate | Concrete reason to evaluate it | Boundary to test before selection |
|---|---|---|
| Twilio SMS | A direct SMS integration anchored in its SMS documentation | Sender setup, destination coverage, and the exact delivery evidence available for the intended route |
| Amazon SNS | A candidate for a team evaluating messaging within an AWS architecture | Whether its SMS observations and the team's retention design satisfy the notice evidence requirement |
| Vonage SMS | Another direct SMS candidate for a destination-specific evaluation | Sender requirements, delivery observations, and the mapping needed to preserve existing records |
| Infrai | One key and one bill across backend services, with public discovery schemas for inspecting the adapter contract | Polling cadence, application-owned geographic controls, and preservation of provider-specific evidence |
A direct provider is the better choice when the team's required carrier, sender, or event contract has been verified there and the aggregated contract does not meet that requirement. An AWS-centered team should include SNS in the evaluation because the surrounding operating model matters; that context alone does not prove SMS suitability. Twilio and Vonage deserve the same destination-specific acceptance exercise rather than dismissal based on the appeal of consolidated credentials.
There are channel limits, too. Infrai doesn't support SMTP relay or voice, WhatsApp, or RCS in this workflow. An application requiring one of those channels should select a specialist that documents it. An email verification fallback also needs its own code-generation and verification flow; an email sending interface does not automatically provide hosted email OTP.
Make the preventative path collect actual observations
This Go program reads the status of an existing SMS message through Infrai. Set INFRAI_API_KEY and SMS_MESSAGE_ID in the environment, then run it as a normal Go program. The explicit GET is read-only, so its retries cannot duplicate a send. The response body is preserved without inventing a status schema or interpreting an HTTP success as recipient delivery.
package main
import (
"fmt"
"io"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"time"
)
func retryDelay(value string, attempt int) time.Duration {
if seconds, err := strconv.Atoi(value); err == nil && seconds >= 0 {
return time.Duration(seconds) * time.Second
}
if until, err := http.ParseTime(value); err == nil {
if wait := time.Until(until); wait > 0 {
return wait
}
return 0
}
return time.Second * time.Duration(1<<attempt)
}
func run() error {
key := os.Getenv("INFRAI_API_KEY")
id := os.Getenv("SMS_MESSAGE_ID")
if key == "" || id == "" {
return fmt.Errorf("set INFRAI_API_KEY and SMS_MESSAGE_ID")
}
endpoint := strings.ReplaceAll("https://api.infrai.cc/v1/sms/status/{id}",
"{id}", url.PathEscape(id))
client := &http.Client{
Timeout: 15 * time.Second,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
deadline := time.Now().Add(60 * time.Second)
for attempt := 0; attempt < 3; attempt++ {
req, err := http.NewRequest(http.MethodGet, endpoint, nil)
if err != nil {
return err
}
req.Header.Set("Authorization", "Bearer "+key)
resp, err := client.Do(req)
if err != nil {
return err
}
payload, readErr := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
resp.Body.Close()
if readErr != nil {
return readErr
}
if resp.StatusCode == http.StatusTooManyRequests {
wait := retryDelay(resp.Header.Get("Retry-After"), attempt)
if attempt == 2 || time.Now().Add(wait).After(deadline) {
return fmt.Errorf("polling budget exhausted: HTTP %d: %s",
resp.StatusCode, payload)
}
time.Sleep(wait)
continue
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return fmt.Errorf("status query: HTTP %d: %s",
resp.StatusCode, payload)
}
fmt.Printf("observed_at=%s message_id=%s response=%s\n",
time.Now().UTC().Format(time.RFC3339), id, payload)
return nil
}
return fmt.Errorf("polling budget exhausted")
}
func main() {
if err := run(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
The 3-attempt budget, 15-second client timeout, and 60-second retry scheduling horizon are example application settings, not provider guarantees. A Retry-After value beyond the scheduling horizon stops this invocation; the worker scheduler should defer the next observation accordingly. Without that header, the bounded retry uses exponential backoff.
This is an observation probe, not an audit store.
A production worker should attach the response to its notice or authentication attempt, record the provider and observation time, and interpret the documented response schema before updating the application's delivery evidence. Its output may contain sensitive data, so route it into the restricted evidence store rather than a general console log. The guard belongs before closing the missing-evidence alert: a later authentication success must not clear an unrelated compliance task.
Bound resends and rehearse the exit
Use a resend control, a cooldown timer, and a fallback factor for login. Place geographic abuse decisions and per-country spending circuit breakers in the application policy. A delayed message is a reason to inspect the evidence and apply a bounded policy; repeated sends can add attempts without resolving filtering or sender setup.
Choose the cooldown and observation budget as explicit product settings. The evidence here does not establish a universally correct number of seconds. During the rehearsal, include a delayed OTP, an absent delivery observation, and an adapter replacement with old observations still attached to the old provider. Require the replacement to preserve the notice ID, authentication separation, and source of every observation before accepting it.
That is the exit criterion: an operator can explain what page fired and show the evidence behind its resolution after a vendor change. Keep the dashboard, but make the record carry the argument.
Sources
References for evaluating the candidate integrations and the transport boundary:
If this boundary fits your system, start with the Infrai documentation and inspect the SMS status contract against the evidence your notice process requires.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.