An auditable marketplace compliance notice needs a reproducible template and a record of delivery observations. The least complex starting point is an application-owned template repository, a durable dispatch record, and one worker that sends SMS first and evaluates email fallback. Its bill has several components: message segments, email attempts, polling requests, retained evidence, and the engineering work required to reconcile them. Start by counting those units.

TL;DR: Keep template versions and delivery evidence under application control; use a stable business identifier to prevent duplicate notice intents, and treat delivery events as observations rather than proof that a recipient read or accepted a notice. For OTP / 2FA login, keep challenge verification separate from this notice workflow. An SMS receipt cannot authorize a session.

Consider a deliberately hypothetical workload: 10,000 notices, one SMS attempt per notice, no retries, and a template that occupies two segments instead of one. That is 20,000 SMS segments rather than 10,000. Under a model where each segment has the same positive charge and all other terms stay fixed, segmentation doubles the SMS component. It does not necessarily double the total bill. Without traffic, retention requirements, and contract terms, no honest analysis can identify the dominant monetary term.

Count the segments.

The design question is therefore which template changes reduce repeated transmission work while preserving the exact notice that must be communicated, and which evidence can expire without making later reconciliation impossible. This puts template custody ahead of provider selection.

Who owns the template when its wording changes?

An application-owned template means a reviewed version of the text, its rendering rules, and its channel variants travel through the deployment process together. This is a proposed design boundary: legal or compliance reviewers approve the meaning, while the backend records which approved version produced each dispatch. Giving an external editor control of wording can shorten an editorial workflow, but it creates an additional version boundary that the audit record must capture. A mutable template identifier alone is insufficient to reconstruct an earlier message. SMS length makes this boundary economically significant. The SMS segmentation reference describes GSM-7 and UCS-2 encoding and distinguishes single-message capacity from concatenated-message capacity: the familiar GSM-7 limits are 160 characters for one segment and 153 per segment for concatenated messages; the corresponding UCS-2 limits are 70 and 67. Some characters require special treatment, so visible character count alone is an unsafe estimator. These figures are encoding rules, not a universal promise about every route or message feature. Consider a proposed marketplace template revision that changes punctuation and adds a personalized seller name: the review must evaluate the resulting encoding and rendered length together, because approving the visible wording without checking its transmission units leaves the dispatch budget detached from the artifact that actually ships. Keeping that check beside the template makes the decision reviewable before a worker sends any notices.

For the hypothetical workload, the change worth testing is a shorter, approved SMS variant that fits one segment while the email variant carries the approved longer explanation. That changes the modeled transmission count from 20,000 to 10,000 segments. The trade-off is substantive: shortening text is acceptable only if the applicable notice requirements permit that channel-specific wording. A link to a longer document must not silently substitute for text that the notice itself must contain.

Keep the meaning intact.

A template review should therefore examine both the rendered content and its encoding classification, including interpolated marketplace names, recipient names, and punctuation. A brief template can expand after substitution. The proposed deployment gate should reject unapproved versions and flag a segment-count change for review; neither a code reviewer nor a delivery integration can independently determine whether the resulting notice satisfies a legal obligation.

How should OTP login architecture separate SMS and email fallback from notice evidence?

For a beginner system with SMS as the primary OTP channel and email as fallback, the most useful simplification is to separate three decisions: whether a challenge is valid, whether another delivery attempt is permitted, and whether a compliance notice has sufficient evidence under the organization's policy. They may share transport adapters. They should not share an authorization state machine.

In this design, a challenge has its own expiration, attempt budget, and consumption state. SMS and email delivery attempts refer to that challenge without copying its secret into an audit trail. Successfully consuming the challenge is an application decision; accepting a message for transport is a different observation. Email fallback also requires an explicit account-security policy, because changing the channel changes the recovery path. Merely receiving a delivery failure does not establish that the email recipient is authorized to recover an account.

The marketplace notice needs a different identifier, such as a proposed notice intent combining a recipient reference, a business event, and an approved template version. Persist that intent before dispatch and enforce uniqueness at the storage boundary. This is the exactly-once mindset applied to business intent: a retry should discover the existing notice rather than manufacture another obligation. Idempotency belongs at that boundary.

External transmission remains a separate uncertainty. If a worker sends a message and loses the response, retrying can duplicate the transmission unless the transport offers a documented deduplication mechanism with suitable scope and duration. Record the attempt before making the call, preserve an uncertain outcome, and reconcile it before deciding whether another attempt is allowed. An application uniqueness constraint cannot make a remote side effect transactional.

Polling should buy reconciliation, not accumulate snapshots

For a proposed minimal implementation, one worker can reconcile pending attempts through bounded polling, while an event receiver, if available, reduces how long the application waits for new observations. Both paths should write through the same observation handler. Keep the provider's event identifier when available, the attempt reference, the observation time, the receipt time, and the reported status; define a deduplication rule for the particular source rather than assuming every source supplies the same identifier.

The concrete pitfall is overwriting a later observation with an older one that arrived late. Another is converting a poll timeout into a terminal delivery failure, then launching email fallback while the original SMS remains unresolved. Preserve the uncertainty and use a documented fallback rule. For a notice, that rule might permit a second channel after a specified policy interval; for an OTP, it must also respect the challenge's validity and account-security rules. These are proposed policies to approve, not transport guarantees.

Polling has a measurable operation count even without quoting a price. In an illustrative schedule, 1,000 pending attempts polled six times each generate 6,000 status requests. A bounded schedule makes that work explicit. Persist meaningful observations and reconciliation decisions rather than every identical response body; the trade-off is less raw material for investigating a provider-specific response anomaly.

An audit projection can be deliberately narrow. This Go example illustrates the fields to retain after parsing and validating an observation; it is a data model, not a complete receiver or a claim about any transport API.

package evidence import "time" type Observation struct { NoticeID string AttemptID string TemplateVersion string Channel string SourceEventID string ReportedStatus string ObservedAt time.Time ReceivedAt time.Time } 

The missing payload is intentional. Store an approved template artifact separately, and decide which rendering inputs are necessary to reproduce a particular notice.

A template version without its inputs cannot reproduce personalized text.

Retaining every input indefinitely creates a different problem. Restricted evidence storage, explicit access controls, and a documented deletion schedule are design requirements to resolve before deployment.

Test the evidence boundary before expanding the channel mix

Use synthetic notices to test a duplicate business event, a repeated observation, out-of-order statuses, an ambiguous send result, and an approved template whose substituted text crosses a segment boundary. A deployment should preserve access to earlier approved template versions and allow queued work to finish against its recorded version. Otherwise, a rollout can change the wording of an already authorized dispatch.

Email fallback has its own delivery prerequisites. The email sender guidelines discuss authentication, DNS, message formatting, and additional requirements for bulk senders. Apply the requirements relevant to the sending pattern; moving traffic from SMS to email does not remove sender responsibilities. Neither those guidelines nor an SMS delivery record establishes legal service of a marketplace notice.

Observe unresolved attempts, repeated dispatch intents, fallback decisions, segment estimates, and evidence writes that fail. These measurements answer different operational questions.

A failed evidence write is especially consequential: the system may have communicated successfully while lacking the record needed to explain what happened. Make that condition visible and reconcile it.

For US and EU recipients, require a reviewed policy covering the applicable notice requirements, channel permissions, retention, and access to recipient data. Geography alone cannot supply those answers, and the transport references below do not establish a legal retention period. Avoid embedding a universal number of days in a shared worker merely because it simplifies configuration.

Decide which evidence can expire

The useful retention distinction is between the authoritative notice record and temporary transport diagnostics. In the proposed design, retain the approved template artifact, the necessary rendering evidence, dispatch intent, attempt references, and material delivery observations for the period established by the applicable policy. Give raw callback bodies, repetitive poll snapshots, and debugging traces their own shorter schedules when that policy permits. Keep OTP secrets out of both categories.

This changes the retained-data term directly: removing repeated snapshots reduces stored objects without requiring fewer business notices. It also narrows what an investigator can recover. A normalized status record may explain when the application made a fallback decision while no longer preserving an unexpected field that would explain a transport discrepancy. Document that loss before deleting the raw material.

Begin with template custody and a small, durable record of intent and observations, then expand only where an evidence requirement justifies the operational burden. Deliberately stop keeping duplicate polling snapshots and expired diagnostic payloads under the approved schedule. When something goes wrong later, that choice costs the ability to replay the exact raw transport exchange; the retained template and decision trail must still support the narrower claim of what was authorized, attempted, and observed.

References

The SMS reference supports the encoding and segmentation discussion. The email sender guidelines support the email delivery prerequisites. The workload calculations are explicitly hypothetical; the architecture and retention boundaries are proposed engineering choices. Neither source supplies a compliance determination or proves that a notice was read.

Further reading