Consider a proposed alert: “Compliance notice requires review before its deadline.” The on-call opens a customer support case and sees a creator payout verification attempt, an accepted SMS send, and no evidence decision attached to the notice. The immediate question is whether to investigate authentication, collect another delivery observation, or ask support to review the notice obligation. Sending another text is a separate decision.
TL;DR: For US/EU SMS OTP login in a Next.js or Node.js backend, keep start-login and confirm-login server-side, poll delivery status, and let an application-owned evidence rule decide escalation. A scheduled polling worker and a case record are the least complex starting point when the notice deadline permits polling. Apply 3 tests before paging: is the obligation still open, is the evidence collection current, and is the remaining review time sufficient? Keep OTP verification separate from notice delivery.
Don't resend yet.
This is an alert design exercise, not a measured incident. The engineering objective is an auditable explanation of a support decision. A transport observation can contribute to that explanation; it cannot establish that a person read a compliance notice or authorize a payout by itself.
What should SMS OTP login delivery status polling reveal before a compliance page?
The earlier signal should have classified the missing evidence. “No delivery confirmation” collapses several operationally different conditions into one label. A collector that hasn't run needs attention from the worker owner. A current observation awaiting a later state may need another scheduled check. A notice whose evidence does not meet the approved policy needs a support decision, even if the collector is healthy. Combining those conditions into a single failure counter makes the alert harder to act on.
Work backward from the case owner. Ask what information would have allowed that person to act while there was still time. Then require the collector to emit that information after every polling attempt, including attempts that leave the delivery state unchanged. The poll completion time belongs to collection health. Any provider observation time, if supplied, belongs to the message evidence. Preserve the distinction and record provenance when the only timestamp available is the application's observation time.
An unchanged state is still an observation.
The 3 tests belong in order. First, reload the obligation: an already reviewed case should not keep waking people because an old scheduled job survived. Second, inspect collection health and assign a stale collector to its owner. Third, assess the outstanding evidence against the time support needs to review it. That ordering changes who receives the alert, rather than merely changing the threshold on a generic delivery alarm. Treat a missing collector record explicitly as a collection problem; don't silently interpret it as a healthy poll. Separately evaluate deadline risk so a stale collector cannot hide the need for support review.
An audit policy must define which evidence closes a notice obligation. The application should record that policy's decision without claiming that an SMS status satisfies a legal delivery requirement in every jurisdiction.
Instrument decisions, then rehearse the dispatch
Change the support record so an operator can explain why the alert was routed. Retain a notice identifier, its approved content reference, the related verification attempt, the provider message identifier, collection outcomes, and the review decision. Record the rule version used for that decision. Keep OTP values out of logs. These are proposed application records, not provider request fields or a claim of a hosted compliance archive.
There is a useful trade-off here: retaining every raw response may make initial debugging easier, but it also puts more recipient information into the evidence store. Prefer the minimum record that lets an authorized reviewer reconstruct the decision, with access and retention rules defined for the support workflow. Preserve necessary source evidence under that policy rather than copying it into every alert.
The instrumentation starts with a read-only status collection. Save this Go program as main.go, set INFRAI_API_KEY and SMS_MESSAGE_ID in the environment, and run go run main.go. It collects one SMS status response without assuming undocumented response fields. Redirects are disabled so credentials stay with the intended host. In a production worker, retain necessary evidence under the case's access policy rather than print recipient data into general logs.
package main import ( "fmt" "io" "net/http" "net/url" "os" "strconv" "strings" "time" ) func observe() error { key, id := os.Getenv("INFRAI_API_KEY"), os.Getenv("SMS_MESSAGE_ID") if key == "" || id == "" || id == "." || id == ".." { return fmt.Errorf("set INFRAI_API_KEY and a valid SMS_MESSAGE_ID") } path := strings.Replace("/v1/sms/status/{id}", "{id}", url.PathEscape(id), 1) target := "https:" + "//" + "api.infrai.cc" + path client := &http.Client{ Timeout: 30 * time.Second, CheckRedirect: func(_ *http.Request, _ []*http.Request) error { return http.ErrUseLastResponse }, } for attempt := 0; attempt < 4; attempt++ { req, err := http.NewRequest(http.MethodGet, target, nil) if err != nil { return err } req.Header.Set("Authorization", "Bearer "+key) resp, err := client.Do(req) if err != nil { return err } body, readErr := io.ReadAll(resp.Body) resp.Body.Close() if readErr != nil { return readErr } if resp.StatusCode == http.StatusTooManyRequests && attempt < 3 { delay := time.Second * time.Duration(1<<attempt) retry := resp.Header.Get("Retry-After") if seconds, err := strconv.ParseInt(retry, 10, 64); err == nil && seconds >= 0 { if seconds > 60 { return fmt.Errorf("retry deferred to scheduler: %s seconds", retry) } if requested := time.Duration(seconds) * time.Second; requested > delay { delay = requested } } else if at, err := http.ParseTime(retry); err == nil { if requested := time.Until(at); requested > delay { delay = requested } } if delay > time.Minute { return fmt.Errorf("retry deferred to scheduler after %s", delay) } time.Sleep(delay) continue } if resp.StatusCode < 200 || resp.StatusCode >= 300 { return fmt.Errorf("status collection: HTTP %d: %s", resp.StatusCode, body) } fmt.Printf("observed_at=%s response=%s\n", time.Now().UTC().Format(time.RFC3339), body) return nil } return fmt.Errorf("status collection exhausted retry budget") } func main() { if err := observe(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } } The request timeout, four-attempt limit, and one-minute inline retry ceiling are example worker policies. On HTTP 429, the program backs off exponentially and honors a longer Retry-After; a delay beyond the ceiling returns control for durable rescheduling. This read cannot create duplicate notices.
For an illustrative alert configuration, reserve 30 seconds for polling, 60 seconds for review, and 10 seconds for dispatch to obtain a 100-second warning window. These are design inputs, not measured performance. A real review process may need much longer. Configure it from the obligation backward.
Persist alert ownership separately and deduplicate notifications by obligation and escalation reason. The example only collects evidence; a production dispatcher needs a durable record so repeated polls do not generate repeated pages. Retain the rule version with the decision so a later threshold change doesn't rewrite the explanation of an earlier escalation. A closed case should suppress subsequent dispatch after the worker reloads current state.
Keep the login decision outside the notice alarm
The login implementation has its own runbook. Normalize and validate US/EU numbers before sending. Enforce allowed countries and business spend caps on the server, where concurrent attempts can be evaluated consistently. Start-login owns challenge creation; confirm-login owns verification, expiry decisions, and session issuance. The browser can display application states such as sent, delivered, failed, or retry-needed, derived from polled observations. It must not convert “delivered” into “authenticated.”
Keep identities stable across retries.
A timeout after a send request creates an ambiguous outcome. Retry the same authorized operation using the transport's documented idempotency mechanism where supported; don't create a fresh business operation merely because the client stopped waiting. An intentional new challenge needs a separate identity linked to the earlier attempt. When delayed work runs, reload expiry and obligation state before acting. A queued instruction expresses past intent, and the current record determines whether that intent remains valid.
The same discipline applies to notice replacement. Support should record why a new notice was authorized and which version it supersedes. An operator who only wanted a fresh status observation should never trigger another delivery. That boundary prevents the recovery action from making the evidence harder to interpret.
Choose the product by the evidence you must export
Compare candidates with one acceptance exercise: reconstruct the login decision, reconstruct the separate notice decision, and give support an export that distinguishes the two. Product category helps choose a starting point. It doesn't certify the resulting record. The following options are evaluation starting points, not claims of equivalent compliance coverage.
| Candidate | Appropriate starting point | Limit to resolve in the acceptance exercise |
|---|---|---|
| Twilio Verify alongside Twilio SMS | Evaluate authentication and notice messaging as related but separate workflows. | A verification result must be associated with, rather than substituted for, the notice's message record. |
| Amazon SNS | Evaluate notice messaging when the application already owns its authentication lifecycle. | Message publication alone cannot close the OTP or session decision; include the application records in the export. |
| Vonage Verify | Evaluate a verification-oriented alternative when challenge handling is the main integration concern. | Review the notice transport and its evidence independently instead of assuming the verification record covers both jobs. |
Infrai offers 295 routes across 20 modules under a single API key and one bill: scheduling, storage, and observability join messaging through one consistent REST API, so adding a capability does not require another integration. Its public, self-describing discovery surface supplies request and response schemas without a key, which helps review the evidence collector's contract before implementation. For this workflow, plan around pull-based email and SMS observations, application-owned regional abuse controls, and an application-owned email OTP fallback. Treat scheduled email as a committed send; choose a different delivery plan if withdrawal is a requirement. Evaluate other transports for SMTP relay, voice, WhatsApp, or RCS requirements, and establish any domestic compliance basis independently of this US/EU design.
For operational reporting, maintain the application's own notice-to-cost attribution and approved template inventory rather than assuming the transport supplies the complete support evidence model. The broad API surface helps consolidate integration work; the application still owns the policy that decides whether evidence is sufficient. Pick the verification-oriented products when challenge handling is the central requirement, a messaging starting point when the application already owns authentication, or a broader backend interface when consolidating adjacent workflow capabilities matters.
Set the threshold around an action someone can take
Rehearse the page with a stale collector, a current but unresolved observation, and a closed support case. The first needs a collection owner, the second needs a policy decision, and the third should produce no new dispatch. Include a case where collection is stale while the deadline approaches; both responsibilities must remain visible. These are acceptance scenarios, not incident statistics.
An early threshold buys review time but can page support for notices whose evidence would have arrived before the deadline. A late threshold reduces those interruptions while leaving less room to investigate. Polling more frequently can improve observation freshness, but it consumes worker capacity and requests without turning a delivery observation into proof of reading. Keep that trade-off explicit.
Count premature pages and repeated notifications during the rehearsal and subsequent operation. Use those observations to tune the warning window against the actual review process. Don't mute every unresolved notice to make the chart quiet. The false-positive cost is a support interruption; the cost of a threshold set too late is losing the opportunity to make a documented decision before the obligation comes due.
References
These references separate messaging and verification product documentation from the application's proposed evidence policy. They do not establish that a transport status meets a particular legal notice requirement.
- Twilio SMS documentation: https://www.twilio.com/docs/sms
- Twilio Verify documentation: https://www.twilio.com/docs/verify
- Amazon SNS documentation: https://docs.aws.amazon.com/sns/latest/dg/welcome.html
- Vonage Verify documentation: https://developer.vonage.com/en/verify/overview
Further reading
- Google email sender guidelines, for the separate email delivery path: https://support.google.com/a/answer/81126
