DEV Community

ApexZ69
ApexZ69

Posted on

SMS Event Notifications Explained (Template Ownership, Failures, and Carrier Filtering)

Template owner Pick this when Operational trade-off
Application team Reset expiry and message wording must ship together. Releases include copy review and localization.
Messaging team Copy needs a separate review and release process. Each send needs a recorded template revision and an explicit expiry contract.

Short answer: SMS event notifications need template revisions and expiry evidence to explain resend failures. Keep token expiry authoritative in the application, record which message revision was sent, and diagnose the failing stage before creating another delivery attempt.

A missing reset message doesn't establish carrier filtering.

Consider an education platform sending a short-lived password-reset message before a learner's class. The same diagnostic discipline applies to telehealth login verification, where a delayed code can leave someone waiting to sign in. This guide uses the education reset flow as its concrete implementation. The decision axis is who can change the template, because a copy change can alter what the recipient believes about expiry without changing the token at all.

OWASP's forgot-password guidance supplies the security boundary: reset tokens should expire, be single use, and be stored securely. It also recommends consistent responses for existing and nonexistent accounts and protection against excessive requests. Those requirements make a resend decision more consequential than a second call to a transport adapter.

How do SMS event notifications distinguish submission failures from carrier filtering?

Diagram in words: reset request → token issuance → template selection → transport submission → delivery evidence → token redemption. Each arrow is a separate observation point. Keep the token itself out of this trail.

Start with the stage that has evidence. If the application never submitted a message, investigate the local queue, rendering result, and selected revision. If submission was accepted but no later event is available, record that uncertainty. If a delivery event reports a rejection, retain its original status and reason in a restricted diagnostic record. Don't silently translate every rejection into “carrier filtering.”

Name the gap.

A useful incident record contains an internal attempt identifier, template revision, channel, destination region, submission time, expiry time, and the transport's message identifier when available. These are proposed fields for this design, not a universal provider schema. The learner-facing response should remain generic; the restricted operational record can explain which stage failed without revealing account existence to the requester.

For US/EU investigations, treat sender registration and signature troubleshooting as separate questions. What sender identity was actually submitted? What evidence establishes its registration state for the destination? Which system produced the signature error: the inbound event receiver, or a message-content review? Obtain the relevant transport documentation and original error evidence before answering. The two public references here do not establish country-specific SMS registration rules, signature formats, or carrier rejection codes. A region label alone cannot fill that gap.

This distinction matters for email fallback too. Yahoo's sender guidance discusses authentication and other email sender requirements. That can inform an email investigation; it cannot prove why an SMS failed. Keep the channels separate in both dashboards and explanations.

Pick application ownership when expiry drives the wording

Application ownership fits a reset flow in which a change to expiry policy should trigger a review of the text. The application can select the message revision alongside the token policy and test them together. The cost is organizational: even a copy correction enters the application's release process.

For an illustrative policy, use a five-minute validity window: 300,000 milliseconds. Five minutes is a design choice here, not an OWASP-mandated duration. If queueing consumes four minutes, a template that promises “valid for five minutes” at send time gives the recipient the wrong expectation. Only 60 seconds remain in that hypothetical example. Prefer wording that points to the reset request's expiry, or calculate the remaining interval from the same authoritative deadline. Localization must preserve that meaning. A review should cover both the copy and the behavior behind it. Check that expiry is enforced during redemption, that a consumed token cannot be reused, and that requesting a reset doesn't change the account before the user completes the required step. OWASP describes these security properties. Keep the fixed deadline in the fixture while changing the simulated queue delay; otherwise a test can accidentally extend the token's lifetime whenever it renders another message.

A correctly rendered message does not enforce expiry.

Pick messaging ownership when copy needs independent review

Messaging ownership fits a team that needs to review wording without waiting for an application release. Require a versioned template contract: the application supplies an expiry, the template accepts that field, and the send record captures the revision that rendered it. Changing ownership should not move the authority to accept an expired token.

The trade-off is coordination. A template editor can change a promise faster than an application team can change the behavior supporting it. Require a preview against a fixed reset fixture before publishing a revision. Include a nearly expired fixture, a missing-field fixture, and each supported locale; reject a template that turns missing expiry data into reassuring but inaccurate copy.

Treat that review as a deployment gate. Preserve the previous revision so copy can be rolled back, and keep token-policy changes under their own review.

Rolling back wording doesn't extend a deadline already issued to a learner.

Make expiry visible at the dispatch boundary

Here is the narrow implementation worth making explicit. It applies to either ownership option: dispatch carries an absolute deadline and a template revision. The TypeScript function below accepts an injected transport and audit sink. It returns a local dispatch decision; it does not generate tokens, verify callbacks, or implement the redemption endpoint.

type ResetJob = {
  attemptId: string;
  templateRevision: string;
  expiresAtMs: number;
};

type DispatchResult =
  | { state: "expired_before_submit" }
  | { state: "submitted"; messageId: string }
  | { state: "submission_unknown" };

type Dependencies = {
  nowMs: () => number;
  submit: (job: ResetJob) => Promise<{ messageId: string }>;
  audit: (event: {
    attemptId: string;
    templateRevision: string;
    state: DispatchResult["state"];
  }) => void;
};

async function dispatchReset(
  job: ResetJob,
  deps: Dependencies,
): Promise<DispatchResult> {
  const finish = (result: DispatchResult): DispatchResult => {
    deps.audit({
      attemptId: job.attemptId,
      templateRevision: job.templateRevision,
      state: result.state,
    });
    return result;
  };

  if (deps.nowMs() >= job.expiresAtMs) {
    return finish({ state: "expired_before_submit" });
  }

  let receipt: { messageId: string };
  try {
    receipt = await deps.submit(job);
  } catch {
    return finish({ state: "submission_unknown" });
  }

  return finish({ state: "submitted", messageId: receipt.messageId });
}
Enter fullscreen mode Exit fullscreen mode

The injected submit function closes over the restricted destination and reset payload. Keep those values out of the audit event.

Validate job fields before this boundary, and make the audit sink non-throwing with its own failure reporting. The snippet assumes that contract.

Notice the unknown state. An exception during submission does not establish whether the remote system accepted the request before the connection ended. Reconcile available submission evidence before retrying, and use documented duplicate-prevention semantics if the chosen transport exposes them. A fresh learner request should pass through the same rate-limiting and token-policy checks as the initial request.

Now test the clock boundary: one millisecond before expiry can reach submit; exactly at expiry cannot. Simulate an ambiguous transport exception and assert that the result remains unknown. Also test the redemption path independently, since a message may expire in transit after this function's initial check. That final expiry check belongs where the token is used.

For observability, count expired-before-submit jobs separately from submissions and unresolved outcomes. Measure queue age and submission latency against remaining token life. Use bounded dimensions such as channel and controlled template revision; keep per-attempt identifiers in restricted logs. Alert on a sustained rise in expired jobs or unresolved submissions against a documented local baseline, then inspect the stage evidence before authorizing retries.

Limits that should stay explicit

This dispatch boundary cannot establish handset receipt, identify a carrier's filtering rule, or validate a sender's registration. Those conclusions need destination-specific documentation and delivery evidence. It also leaves token generation, secure storage, request throttling, callback authentication, and atomic single-use redemption to the surrounding system.

Template ownership earns its place in troubleshooting by making one question answerable: what did this learner's message promise, and which deadline did the application actually enforce? Keep both records available.

A repeated delivery attempt should follow an understood state transition, with copy that still matches the reset policy.

References

Top comments (0)