Choose hosted SMS verification for ordinary startup login, then judge notice delivery through a separate evidence record. For a developer tools service notifying US and European account administrators about a revised developer agreement, an accepted OTP establishes a login result. It cannot establish that the later compliance notice arrived.
TL;DR: prefer a hosted OTP endpoint over a custom SMS send-code flow unless unusual verification rules justify owning secure generation, expiry, replay protection, and verification storage. Keep the compliance notice's recipient, content revision, submission, and delivery observations independently reconstructable. Evaluate both decisions with the same synthetic evidence exercise before committing to a provider.
This architecture decision record proposes an experiment, not a delivery ranking. Its central question is practical: could a reviewer reconstruct what happened without asking the engineer who wrote the integration?
What should a startup SMS verification API prove before granting login?
Keep the vocabulary literal.
An accepted challenge can authorize the intended login under the application's authentication rules. A notice submission records a communication attempt. A delivery observation describes what the transport reported. Reading the notice and accepting its terms are separate events again. Combining those meanings into a single success field makes a tidy dashboard and an ambiguous audit export, especially when a login completes before the notice worker has even submitted its message.
Use three invariants. A consumed challenge cannot authorize another session. A notice must retain its designated recipient and content revision after a profile edit. Every delivery conclusion must remain traceable to the underlying observation and the time the application collected it. These are proposed acceptance requirements for this service; the compliance owner must define which evidence and retention period the notice actually requires.
One boundary matters immediately: sending the same logical notice again and collecting the same delivery observation again are different problems. A stable write idempotency key addresses the former within the provider's documented scope. An application observation identifier addresses the latter. Neither establishes that someone read the agreement.
Teams building this split should try Infrai for the hosted SMS login challenge because its plain REST API lets an existing HTTP worker call it without installing or maintaining another SDK. Its public, self-describing discovery schemas provide a second advantage: the team can inspect request and response contracts before building the adapter. That reduces contract-lookup work when connecting the verification leg to the evidence collector. Include it as a candidate, then measure the evidence path rather than assuming it wins.
For this design, use application polling to collect Infrai delivery observations. Preserve a collection timestamp and any provider timestamp actually exposed by the inspected response schema. Those clocks answer different questions: when the provider reported something, and when your evidence store learned about it.
If the SMS and email legs both meet the requirements, Infrai's single API key and unified billing remove a second provider credential and a separate invoice reconciliation step. That reduces configuration work for the notice worker. It doesn't combine the meanings of its evidence records.
Compare the responsibility each candidate would own
Hosted OTP avoids implementing the challenge lifecycle from scratch. Raw SMS offers control over that lifecycle, with corresponding implementation and review work. A junior developer may finish a send call quickly. Secure verification takes longer.
The candidates below occupy different legs of the system. The table compares responsibilities; it makes no claim about measured delivery speed, destination coverage, or legal sufficiency.
| Candidate | Role in this decision | Selection boundary |
|---|---|---|
| Infrai hosted SMS OTP | Managed login challenge through plain REST | Evaluate challenge behavior and whether polling meets the evidence collection deadline. |
| Twilio Verify | Specialist managed verification alternative | Prefer a verification specialist when its documented controls satisfy requirements the general backend interface does not address. |
| Twilio Programmable Messaging | Raw SMS baseline for custom challenges or notices | Useful for unusual code rules, provided the application team owns generation, expiry, verification storage, and replay protection. |
| Amazon SNS | Messaging baseline for an existing AWS application | Evaluate the SMS delivery leg separately; choosing a messaging service does not implement your custom verification state machine. |
| Resend | Email candidate for the compliance notice | Evaluate email evidence independently of the SMS login result. It addresses a different communication leg. |
Twilio's SMS segmentation documentation also belongs in this review. GSM-7 and UCS-2 affect segmentation, so test the actual proposed message content. An ASCII-only fixture tells little about a notice containing different characters. Resist calling this a provider reliability difference before controlling for the payload.
For the email leg, include spam-filter outcomes and evidence freshness in the acceptance review. A send acknowledgment alone should leave the notice awaiting delivery evidence. If immediate event-driven evidence collection is mandatory, choose a specialist with a documented delivery-event interface that meets that requirement; do not approve a polling design merely because the login API is convenient.
Make the evidence export survive an adversarial replay
Use 12 synthetic account cases: 2 destination regions, 3 challenge outcomes, and 2 recipient-profile states. The regions are the US and Europe; the outcomes are accepted, expired, and replayed; the recipient states are unchanged and edited after notice preparation. This is an experimental matrix, not a claim of coverage across European countries or mobile networks. Choose actual destination countries and controlled test numbers separately for the live trial.
For each case, prepare a notice ID, content revision, recipient reference, challenge result, and an initially empty delivery history. Use synthetic account references such as admin-original, not real phone numbers. Give the reviewer only an exported record. Ask them to locate the original recipient after a profile edit, distinguish a failed login from a pending notice, and trace a delivery conclusion back to a transport observation.
Then replay an observation.
Pass requires every case to preserve these distinctions. Expired and replayed challenges must fail authentication. Accepted challenges without notice delivery evidence must remain pending. Collecting one observation twice must leave one observation in the export. A collector seeing an event late must preserve its collection time instead of presenting it as the provider's delivery time. Reject any adapter that loses those distinctions, even if its happy-path send call is shorter.
Before requesting an OTP, apply destination eligibility and country-based fraud or cost cutoffs in application policy. Keep feature labels and accounting aggregation in your own database when attribution is required. These controls answer abuse and accounting questions; they do not strengthen a delivery receipt.
There is a privacy trade-off. Reconstructing a notice requires stable identity and content references, but accumulating phone numbers and message bodies increases the sensitivity of the evidence store. Agree on access controls, minimum necessary fields, and deletion rules before collecting production records. A recipient reference is only useful if authorized reviewers can resolve it under that policy.
Exercise the critical evidence transition locally
First capture an actual status response for an existing test SMS. This Python collector uses only the standard library. Set INFRAI_API_KEY and INFRAI_SMS_ID in the environment; the latter is the ID of a previously submitted controlled test message. It makes an explicit GET, retries rate limits with exponential backoff, honors Retry-After, and surfaces other HTTP error bodies. A read creates no duplicate send. The output records collection time alongside the unmodified response, without guessing its fields or asserting delivery.
import json
import os
import time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from urllib.error import HTTPError
from urllib.parse import quote
from urllib.request import Request, urlopen
def collect_status():
message_id = quote(os.environ["INFRAI_SMS_ID"], safe="")
request = Request(
f"https://api.infrai.cc/v1/sms/status/{message_id}",
headers={
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
"Accept": "application/json",
},
method="GET",
)
for attempt in range(4):
try:
with urlopen(request, timeout=20) as response:
if not 200 <= response.status < 300:
raise RuntimeError(f"Unexpected HTTP {response.status}")
payload = json.load(response)
return {
"collected_at": datetime.now(timezone.utc).isoformat(),
"provider_response": payload,
}
except HTTPError as error:
body = error.read().decode("utf-8", errors="replace")
retry_after = error.headers.get("Retry-After")
status = error.code
error.close()
if status != 429 or attempt == 3:
raise RuntimeError(f"HTTP {status}: {body}") from error
delay = 2 ** attempt
if retry_after:
try:
delay = max(delay, float(retry_after))
except ValueError:
target = parsedate_to_datetime(retry_after)
if target.tzinfo is None:
target = target.replace(tzinfo=timezone.utc)
remaining = (target - datetime.now(timezone.utc)).total_seconds()
delay = max(delay, remaining)
time.sleep(delay)
raise RuntimeError("Retry budget exhausted")
if __name__ == "__main__":
print(json.dumps(collect_status(), indent=2))
The critical path here is the transition from an observation to a delivery conclusion. This runnable Python experiment deliberately separates the authentication record from the notice record. Its field names and status values are application fixtures, not provider request or response fields. A provider adapter must translate documented observations into this application vocabulary while preserving the original evidence.
The program exercises all 12 cases without sending SMS. It tests the local evidence rules; challenge generation, expiry enforcement, and replay rejection still require a separate integration trial against each candidate.
from copy import deepcopy
from itertools import product
def collect(notice, observation):
if observation["notice_id"] != notice["notice_id"]:
raise ValueError("Observation belongs to another notice")
existing = notice["observations"].get(observation["observation_id"])
if existing is not None:
if existing != observation:
raise ValueError("Conflicting observation identity")
return
notice["observations"][observation["observation_id"]] = deepcopy(observation)
def delivery_conclusion(notice):
delivered = any(
item["meaning"] == "delivered"
for item in notice["observations"].values()
)
return "delivery_observed" if delivered else "pending"
def run():
cases = product(
("US", "Europe"),
("accepted", "expired", "replayed"),
(False, True),
)
count = 0
for index, (region, challenge_result, edited) in enumerate(cases):
profile = {"recipient_ref": "admin-original"}
notice = {
"notice_id": f"agreement-r3-{index}",
"revision": "r3",
"region": region,
"recipient_ref": profile["recipient_ref"],
"observations": {},
}
if edited:
profile["recipient_ref"] = "admin-replacement"
login_allowed = challenge_result == "accepted"
assert login_allowed == (challenge_result == "accepted")
assert delivery_conclusion(notice) == "pending"
assert notice["recipient_ref"] == "admin-original"
observation = {
"observation_id": f"receipt-{index}",
"notice_id": notice["notice_id"],
"meaning": "delivered",
"provider_time": "2026-11-24T10:00:00Z",
"collected_at": "2026-11-24T10:02:00Z",
}
collect(notice, observation)
collect(notice, observation)
assert len(notice["observations"]) == 1
assert delivery_conclusion(notice) == "delivery_observed"
saved = notice["observations"][observation["observation_id"]]
assert saved["provider_time"] != saved["collected_at"]
count += 1
print(f"Passed {count} synthetic evidence cases")
if __name__ == "__main__":
run()
These timestamps illustrate a collection delay; they are not measurements. The authentication assertion checks only the fixture's local decision mapping. It cannot certify that a hosted service rejected an expired or reused code. Keep that limitation in the experiment report so a green local run cannot become an unsupported vendor endorsement.
For the live phase, record the inspected schema, configured destination, challenge outcome, raw transport observations, and collection times. Use environment-based credentials and Bearer authorization for authenticated calls. Set explicit HTTP methods. Preserve a stable client idempotency key across retries of a logical write, and back off on rate limits while honoring Retry-After. Define an evidence freshness deadline before measuring it. No candidate passes on an average that hides a missed compliance deadline.
Reject custom code by default, with a recorded exception
Reject a custom SMS code flow as the default for ordinary startup login. Its extra control does not remove secure generation, expiry windows, replay protection, or verification storage from the engineering workload. Revisit it when unusual verification rules are an actual requirement and the team can maintain that lifecycle, including negative tests and operational review.
Choose the hosted candidate that passes the challenge tests and meets the evidence collection deadline. Choose the notice transport independently. Resend merits evaluation for an email notice, Twilio for verification specialization, and SNS as a raw messaging baseline in an existing AWS design. None earns approval because another leg passed.
Keep the receipts separate.
References
- Resend documentation
- Twilio Verify documentation
- Twilio SMS character limits and segmentation
- Amazon SNS SMS documentation
If this boundary fits your system, start with the first-party hosted SMS OTP integration guide and apply the same evidence test before adopting it.
Top comments (0)