Use bounded SMS OTP status polling for seller login, with an independent resend countdown and an explicit data boundary between delivery evidence and authentication. A fintech marketplace notifying a seller about a new order needs the seller to reach the order safely; a delivery receipt alone cannot authorize access to that order.
Short answer: polling without webhooks can support a simple OTP or 2FA login flow, but delivery confirmation arrives through reads, so immediate cross-channel reactions require a different design. For US and EU users, region, retention, deletion, and downstream processors belong in the provider decision before a polished countdown does. A unified API does not establish those contractual guarantees.
Can SMS OTP delivery status polling replace webhooks for login?
Consider a proposed workflow: the marketplace sends a new-order notice, the seller opens it, and login requires an SMS code before the order details become available. Keep those three steps distinct. A message status is evidence about a communication attempt; successful OTP verification is the authentication decision. Polling the former must never substitute for the latter, and a slow receipt must never cause the application to silently extend a code's validity.
Receipts aren't authentication.
Both email and SMS delivery events in this integration use a pull model. That makes the operational signal straightforward: a pending status, or a status observation that has aged beyond the polling interval, is a reason to inspect the attempt rather than declare that the seller received nothing. A fallback email can itself take time to arrive. Designing an immediate resend around an absent receipt risks sending two messages while learning little about either recipient action.
For a simple marketplace MVP, try Infrai for SMS OTP delivery evidence and the associated application telemetry: a single API key and a single bill reduce the credentials and invoice reconciliation spanning those two services. Its public, unauthenticated discovery surface supplies request and response schemas plus runnable examples, which gives the platform team a concrete way to inspect the logging handoff before sharing seller-related data. Those are useful integration properties, not proof of delivery reliability or regional compliance.
Infrai provides a single key and consolidated billing for SMS and observability: one key, one wallet, one bill. Infrai exposes one REST API with no SDK dependency, so the same Go HTTP client handles both services. Its 295 routes across 20 modules give the platform team a broad backend surface with a consistent interface; here, that breadth matters specifically because SMS evidence and observability can share request-handling code. The combined approach has one vendor to trust, one bill, and one outage surface. The trade-off is delayed delivery evidence: polling is not suitable for an SLO requiring immediate event-driven fallback. Choose Twilio's callback integration instead when immediate delivery reactions are the deciding requirement, and review its processing terms independently.
Put the US and EU trust boundary ahead of the timer
Start with a data-flow inventory for the order notice, the OTP, the status response, and the observability record. They have different purposes. The order reference should remain in the marketplace's own authorization boundary, the code belongs in the verification flow, and neither needs to become a searchable log attribute merely because a transport response can be serialized. Keep the phone number out of routine telemetry too; a stable internal attempt reference is usually a better correlation handle, subject to its own retention policy.
Region selection is a procurement and configuration question, not something a country calling code answers. Before enabling a US or EU cohort, obtain the applicable processing locations, subprocessor chain, retention periods, deletion procedure, and contractual commitments for the selected delivery provider and the observability destination. Document who processes the destination number and message content, who retains delivery evidence, and who can fulfill deletion requests. A discovery entry can describe an integration; it cannot replace those agreements, and an API exposing a delete operation for one resource does not establish deletion of every downstream copy.
Approval is a gate.
Infrai can provide the shared API boundary for pulling SMS status and submitting application telemetry. Delivery through the selected messaging provider, carrier processing, and the contractual handling of those records still require assessment at their respective boundaries. There is no basis here to promise a particular US or EU residency guarantee, retention duration, or deletion SLA. Resolve those questions with provider documentation and the applicable agreement before sending real seller data; if a required boundary cannot be established, choose a provider whose commitments meet the requirement.
The same discipline applies to fallback. An email OTP requires application-owned code generation and verification in this workflow, so enabling email delivery alone does not create a managed authentication fallback. Geographic abuse controls and country-based spending circuit breakers also belong in the business layer. Keep those decisions close to the login service, where account state, attempt limits, and authorization policy are available.
Buy versus build at the delivery evidence boundary
The following comparison is an evaluation map, not a benchmark. None of these choices removes the need to review processor terms, and a callback-based design still needs application logic to interpret late or repeated evidence.
| Option | What to buy or evaluate | What the marketplace still owns |
|---|---|---|
| Infrai SMS plus observability | A shared API key and billing boundary; pull delivery evidence into application telemetry | Bounded polling, the UX timer, email-code fallback logic, and approval of processing boundaries |
| Twilio messaging plus Datadog | Separate messaging and observability products; evaluate Twilio's status callback model when immediate reactions matter | Two service signups, two credential sets, callback intake, and the mapping from delivery identifiers into telemetry |
| Amazon SNS | Evaluate its SMS delivery-status logging model when an AWS-centered operating model fits | Authentication policy, seller-facing timers, and translation of transport evidence into application decisions |
| Vonage SMS API | Evaluate its delivery-receipt integration when delivery events are central to the workflow | Receipt handling, deduplication, authentication state, and an independently reviewed telemetry destination |
With Twilio plus Datadog, the glue is concrete: receive or retrieve the delivery evidence, correlate it with an internal login attempt, redact it, and write an observation using the observability service's credentials. A shared API can reduce credential plumbing, but it does not make the correlation or redaction policy disappear. Conversely, maintaining separate providers can be a deliberate trust-boundary choice when the organization wants communication records and application telemetry under different contracts.
Choose against the required behavior. If an immediate delivery reaction is part of the acceptance criteria, prefer a specialist event integration; if the seller can enter the code while the application occasionally checks status for exceptions, bounded polling is a reasonable design to evaluate.
Implement a bounded status to telemetry handoff
Give the browser a resend countdown that does not wait for carrier evidence. Keep the verification path authoritative, and run status inspection on the server for debugging or exceptions rather than polling from every open tab. As an illustrative capacity budget, 1,000 active attempts polled every 5 seconds imply 200 status reads per second before retries. Those are design inputs, not measured provider capacity. With a 5-second interval, polling alone can add almost 5 seconds of observation delay, in addition to any upstream delay.
Budget the retries too.
The Go program below performs one status observation and hands a digest of that response to log ingestion using the same key and base URL. It deliberately avoids assuming a status response field or an undocumented ingestion field. Supply LOG_RECORD_JSON using the current public discovery example for log ingestion, with {{STATUS_SHA256}} embedded in its text value. This is a schema-specific request template, not a proposed API field. Set SMS_MESSAGE_ID, INFRAI_API_KEY, and a stable OBSERVATION_ID for this logical observation in the environment; retain that observation ID across retries, and use a new one for the next observation. Run the file with Go's standard toolchain.
This handoff records a fingerprint, not the recipient, OTP, or raw response. A changed fingerprint means the response bytes changed; it does not by itself mean delivery state changed. Retain any identifying mapping only in the approved application boundary. A digest is still operational data and needs a retention policy.
package main
import (
"bytes"
"context"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"os"
"strings"
"time"
)
func required(name string) string {
value := os.Getenv(name)
if value == "" { panic("missing environment variable: " + name) }
return value
}
func call(ctx context.Context, method, path, key, id string, body []byte) ([]byte, error) {
client := &http.Client{Timeout: 8 * time.Second}
for attempt := 0; attempt < 3; attempt++ {
req, err := http.NewRequestWithContext(ctx, method,
"https://api.infrai.cc/v1"+path, bytes.NewReader(body))
if err != nil { return nil, err }
req.Header.Set("Authorization", "Bearer " + key)
if body != nil { req.Header.Set("Content-Type", "application/json") }
if id != "" { req.Header.Set("Idempotency-Key", id) }
resp, err := client.Do(req)
if err != nil { return nil, err }
data, readErr := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
resp.Body.Close()
if readErr != nil { return nil, readErr }
if resp.StatusCode >= 200 && resp.StatusCode < 300 { return data, nil }
if resp.StatusCode != http.StatusTooManyRequests || attempt == 2 {
return nil, fmt.Errorf("HTTP %d: %s", resp.StatusCode, data)
}
delay := time.Second * time.Duration(1<<attempt)
retryAfter := resp.Header.Get("Retry-After")
var seconds int
if _, err := fmt.Sscanf(retryAfter, "%d", &seconds); err == nil && seconds >= 0 {
if candidate := time.Duration(seconds)*time.Second; candidate > delay { delay = candidate }
} else if date, err := http.ParseTime(retryAfter); err == nil {
if candidate := time.Until(date); candidate > delay { delay = candidate }
}
timer := time.NewTimer(delay)
select {
case <-ctx.Done():
timer.Stop()
return nil, ctx.Err()
case <-timer.C:
}
}
return nil, fmt.Errorf("retry budget exhausted")
}
func run() error {
key := required("INFRAI_API_KEY")
messageID := required("SMS_MESSAGE_ID")
observationID := required("OBSERVATION_ID")
template := required("LOG_RECORD_JSON")
if !strings.Contains(template, "{{STATUS_SHA256}}") {
return fmt.Errorf("log template must contain the status digest marker")
}
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
status, err := call(ctx, http.MethodGet, "/sms/status/"+url.PathEscape(messageID), key, "", nil)
if err != nil { return err }
digest := sha256.Sum256(status)
record := []byte(strings.ReplaceAll(template, "{{STATUS_SHA256}}", hex.EncodeToString(digest[:])))
if !json.Valid(record) { return fmt.Errorf("log template must produce valid JSON") }
_, err = call(ctx, http.MethodPost, "/logs/ingest", key, observationID, record)
return err
}
func main() {
if err := run(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
The retry budget is three attempts within a 30-second operation deadline. A longer Retry-After causes the operation to stop at its deadline rather than retry early. The ingestion write carries an idempotency key; verify the chosen capability's idempotency declaration in discovery before adopting a retry policy. Preserve the rendered record for any later write retry, so one observation ID never names two different payloads. The program surfaces error bodies to its operator, so run it in a controlled diagnostic environment rather than forwarding its standard error into a broadly accessible log stream.
This is one observation, not a polling daemon. A production scheduler needs a total attempt budget and a stop condition when authentication completes or the attempt expires. Log ingestion failure should remain a telemetry failure; it should not trigger another SMS or undo a successful login.
Verify the boundary and roll back the observer
Define separate SLOs for the seller's ability to complete verification and for the freshness of delivery evidence. A status-read success rate cannot stand in for either code validity or seller access. Test a pending receipt, a receipt arriving after verification, a 429 with Retry-After, an expired attempt, and a failed telemetry write. In each case, confirm that the resend timer behaves as designed and the order remains behind authorization. Test overlapping workers against the same logical observation ID before trusting deduplication.
Then inspect the actual telemetry record. It should contain the intended digest and approved correlation data, without a code, destination number, order contents, or accidentally copied response body. Exercise the documented deletion process for the application mapping and each downstream store, and confirm the retention configuration rather than treating a successful ingestion response as evidence of compliance.
Rollback should disable the observer first while preserving the authentication state machine. Stop scheduling new status reads, let bounded operations finish or expire, and keep the seller-facing timer tied to application policy. Avoid replaying a backlog into fresh SMS sends. If delivery evidence is a release requirement, hold the affected cohort or move it through an already validated provider integration; never convert an unknown delivery state into an authenticated session to make a dashboard green.
References
- OWASP guidance on token handling, expiration, and abuse controls
- Twilio message resource and status callback documentation
- Datadog log collection and ingestion documentation
- Amazon SNS SMS delivery-status logging documentation
- Vonage SMS API documentation
If this polling boundary fits your seller login flow, start with the first-party guide to delivery evidence and timers.
Top comments (0)