| Template owner | Pick this when | Operational obligation |
|---|---|---|
| Application repository | Login wording and invalid-recipient suppression must ship together | Review copy, policy, and telemetry in the same release |
| Hosted editor | Copy editors need an independent publishing workflow | Bind each send to an approved template revision and policy decision |
Get the gaming account's phone-verification flow under one release boundary first. Short answer: choose application-owned templates when the team maintaining the SMS OTP backend also owns bounce handling and suppression. A hosted editor earns its extra coordination when independent copy publishing is a real requirement. In either design, the backend must decide whether another send is allowed; the resend button's countdown only presents that decision.
For a Next.js phone verification login screen, the interesting comparison is who can change the message after the resend policy has been reviewed. Picture a player changing a phone number before receiving a purchase alert. The OTP verifies the proposed destination. The transaction alert is a separate message purpose. Neither a new template nor a browser refresh should silently clear an invalid-recipient decision.
This field guide uses template-change observability as its angle: make the relationship between wording, send eligibility, and delivery feedback inspectable. The three checks below are a proposed application contract, with illustrative timings and identifiers. They are not transport guarantees.
When should the application own verification templates?
Pick repository-owned templates when a developer already reviews changes to authentication messages. Keep a template revision alongside its purpose and policy tests. Then a copy change that introduces a login code into a purchase-alert template can fail review before either message is sent. That's useful friction.
For this gaming example, define two purposes: login_otp and purchase_alert. Assign them separate template revisions. A failed verification destination should be visible to the suppression policy for later sends to that same destination, while the reasons for sending and the permissions to send remain separate. Verifying a number should not be treated as blanket permission for every future message. This is a design boundary to establish explicitly, including the rules that apply to the intended US and EU audiences.
The trade-off is editorial speed. Every wording adjustment now follows the application's release process, so a copy team with frequent independent releases may find this arrangement cumbersome. In return, a reviewer can inspect the message and the code path that makes it eligible in one place.
Keep that boundary small.
When does a hosted editor justify the coordination?
Pick hosted templates when non-developers genuinely need to publish copy independently. Require a stable revision reference in the application's send record. If the publishing system cannot supply one, define a snapshot or content digest contract before relying on it for investigations. These are selection criteria; they do not assume a particular service implements them.
The application still owns the eligibility decision. The editor owns approved wording. A publication should not modify the suppression store, restart an OTP lifetime, or move a resend deadline. That division gives editors useful autonomy, but it also creates a deployment problem: an application release and a copy release may arrive in either order. Test both orders with the same expected message purpose and revision rules.
Copy changes count.
What should a phone login backend check before repeating an SMS OTP?
Three checks make the comparison concrete: destination eligibility, the server's resend deadline, and the approved template revision. A disabled button cannot enforce any of them. Have the backend return a deadline, and let the client render the remaining countdown from it. Recheck on every resend request.
Diagram in words: player clicks resend → backend loads the current destination and challenge → policy checks suppression, deadline, and template revision → an allowed send is reserved → the worker checks current suppression before dispatch → delivery feedback updates the destination record. Logs follow the same identifiers through that path.
Here is a pure TypeScript policy function. It makes no network calls and sends no messages. The example uses an interval of 30 seconds and a challenge lifetime of 300 seconds as illustrative test inputs. Production values require a separate policy decision.
The server supplies nowMs; never take it from the browser.
type Purpose = "login_otp" | "purchase_alert";
type Template = {
purpose: Purpose;
revision: string;
};
type Challenge = {
recipientRef: string;
templateRevision: string;
resendAtMs: number;
expiresAtMs: number;
};
type Decision =
| { allowed: true; templateRevision: string }
| {
allowed: false;
reason: "suppressed" | "expired" | "wait" | "template_mismatch";
};
function checkResend(
challenge: Challenge,
template: Template,
suppressed: boolean,
nowMs: number,
): Decision {
if (suppressed) return { allowed: false, reason: "suppressed" };
if (nowMs >= challenge.expiresAtMs) {
return { allowed: false, reason: "expired" };
}
if (nowMs < challenge.resendAtMs) {
return { allowed: false, reason: "wait" };
}
if (
template.purpose !== "login_otp" ||
template.revision !== challenge.templateRevision
) {
return { allowed: false, reason: "template_mismatch" };
}
return { allowed: true, templateRevision: template.revision };
}
const startedAtMs = 1_000_000;
const challenge: Challenge = {
recipientRef: "player-42-phone-v2",
templateRevision: "login-copy-r3",
resendAtMs: startedAtMs + 30_000,
expiresAtMs: startedAtMs + 300_000,
};
const template: Template = {
purpose: "login_otp",
revision: "login-copy-r3",
};
const decision = checkResend(
challenge, template, false, startedAtMs + 30_000,
);
// decision.allowed is true at the resend boundary.
The easy trap is treating this function as the whole backend. It isn't. Two requests can both observe an eligible challenge. In the implementation around this function, make the eligibility read and send reservation one atomic operation, or use an equivalent concurrency control strategy. Bind repeated requests to the same reservation identity. Specify how a worker recovers after interruption so that a retry cannot casually create a second send.
Test concurrent clicks.
Delivery feedback deserves its own adapter. Define how authenticated incoming events map into your internal destination states, and distinguish temporary delivery trouble from a destination classified as invalid. Preserve the evidence for that classification. Do not convert every unsuccessful attempt into permanent suppression. Also bind feedback to the destination version: a late event for player-42-phone-v1 must not overwrite the state of player-42-phone-v2.
Make a copy release observable before shipping it
A useful before-and-after is a change in the investigation record. Before: a send record says only that dispatch was attempted. After: it identifies the message purpose, template revision, challenge reference, destination version, eligibility result, and reservation. This is a proposed logging contract, not a report of measured results. Keep raw phone numbers and OTP values out of these diagnostic events; use access-controlled references that can be resolved when necessary.
Start a release test with the example challenge. Just before its 30-second boundary, expect wait; at the boundary, expect eligibility if the other checks pass. At five minutes, expect expired. Then test suppression arriving between reservation and worker execution, two simultaneous resend requests, repeated feedback, and a destination replacement followed by late feedback. Those cases test state transitions rather than a screenshot of a countdown. Include an unapproved template revision too. It should produce a visible policy decision, not an unexplained missing message.
For dashboards, count decisions by reason and message purpose. Keep recipient references out of metric labels; retain them in controlled diagnostic records instead. Alert on an unexpected rise in template mismatches after a copy release, and choose thresholds from the application's observed traffic. Without a baseline, a precise percentage would be invented confidence.
A hosted publishing workflow needs the same checks during rollback. Decide what happens to active challenges pinned to an older revision before changing that revision's availability. Repository ownership makes that coordination easier to review together, but it still needs a deployment plan. Either approach also needs bounds on resend attempts and monitoring of dispatch volume. The concern is abuse and operational load, not a promise about message prices.
Limits: verification is only one boundary
This example does not implement OTP generation, secure storage, attempt limits, webhook authentication, or a complete queue worker. It also does not establish US or EU legal compliance. Treat those as separate requirements to resolve before production, with the message purpose and destination lifecycle documented.
Email feedback has different evidence boundaries from SMS feedback. RFC 6376 specifies DKIM signatures for email; a valid signature should not be used as proof that a recipient address exists. Apple's Mail Privacy Protection guide describes protections that prevent senders from learning mail activity such as whether a message was opened. An open signal therefore should not be your criterion for lifting invalid-recipient suppression. Neither source defines an SMS retry interval.
Keep the final review concrete: can a copy release change who gets contacted, can late feedback suppress a replacement destination, and can two clicks reserve two sends? Resolve those questions before polishing the countdown.
Further reading
References:
- RFC 6376, DomainKeys Identified Mail (DKIM): https://datatracker.ietf.org/doc/html/rfc6376
- Apple, Use Mail Privacy Protection: https://support.apple.com/guide/iphone/use-mail-privacy-protection-iphf084865c7/ios
Top comments (0)