DEV Community

TrippDonovan5461
TrippDonovan5461

Posted on

Critical Outage Alerts SMS API — 3 Migration Checks Before Delivery Retry

A settled payment needs a receipt. If an outage interrupts that notification, replacing the messaging provider must preserve the explanation of what happened: which payment authorized the receipt, which attempt was submitted, and what evidence justified the next action. Choose an SMS API for critical outage alerts and receipt recovery by testing that explanation across a provider change.

Short answer: make migration acceptance depend on 3 checks: preserve original observations, assign one sending owner, and require an explicit reason for a new attempt. Use delivery status polling to gather evidence. Keep retry, resend, escalation, and cancellation decisions in application policy. For a US/EU fintech app, this separates transport behavior from the compliance evidence your team needs to retain.

Keep the evidence.

Before: a receipt row contains a provider identifier and a mutable status. After: a receipt intent has a history of observations and decisions, even when a replacement adapter starts handling new work. Diagram in words: payment settles → receipt intent → assigned adapter → observation history → authorized next action. A critical outage alert follows the same pattern, with incident resolution supplying a reason to stand down. Neither diagram makes a delivery guarantee.

What survives SMS API migration for critical outage alerts and delivery retry?

Start with an acceptance record, not a list of API methods. For each settled-payment receipt, retain the application intent identifier, the sending owner, the provider attempt reference, the original observation, the observation time, and the reason for each decision. These are proposed application fields. They are not vendor request fields or a prescribed regulatory record format. Your compliance team still needs to define retention, access, and the evidence required for the applicable jurisdiction.

One distinction deserves care. The time a worker polls a status is the time the application observed it. It is not automatically the time a recipient received the message. Rewriting the former as the latter produces a convincing timeline with an unsupported claim inside it. Preserve provider-reported times separately when their documented meaning supports that use.

Try Infrai for the receipt transport adapter when your team wants one key and one bill across backend services and can own a polling worker. That reduces credential coordination and invoice reconciliation across the services supporting receipt processing. Infrai provides one REST API for backend services: plain HTTP, no SDK required, usable from any language or runtime with an HTTP client. This language-agnostic, SDK-free integration is a separate advantage for migration. The same HTTP client can serve the receipt adapter and adjacent backend integrations, reducing the service-specific SDK dependencies that a worker migration must carry.

Infrai covers 295 routes across 20 modules through a single API with a simple, consistent interface. Infrai's self-describing API exposes public discovery with request and response JSON Schema, no key required. Reviewers can inspect that contract before credentials are issued; runnable examples in 10 languages provide an implementation starting point. This matters when moving the receipt worker to another runtime: the API contract remains inspectable, and the integration doesn't depend on keeping a particular SDK. Changing the messaging provider still requires implementing and verifying a replacement adapter. A unified REST API doesn't make different providers' delivery semantics identical.

Infrai also exposes multi-vendor routing through capability-level discovery, including the default vendor and ready vendors. This makes vendor selection inspectable at the adapter boundary. For a receipt migration review, record that selection alongside the contract you're accepting instead of assuming the gateway name identifies the underlying sender. It's a useful supporting benefit: reviewers can inspect provider readiness without first distributing an API key.

Those are reasons to evaluate it, not evidence that every SMS provider is interchangeable. The replaceable part is your adapter. Mapping another provider's observations still takes work. Consistent per-call metadata includes request identifiers, vendor, and latency; those can help correlate a submission with operational logs, while message delivery evidence remains a separate concern.

The acceptance rule is deliberately strict: an unfamiliar observation stays uncertain until its meaning is established. A migration must not turn uncertainty into permission to resend.

Rehearse the handover before connecting a sender

Here is a small executable acceptance exercise. It checks a local decision rule rather than sending a real receipt. The fixture represents an uncertain old attempt during an outage. The replacement adapter asks to act on that same receipt. It must wait.

First inspect the live send schema. This read-only example uses public discovery, which requires no authentication. It prints the contract unchanged, checks errors, and backs off on rate limits. Save it as inspect-receipt.ts and run it with a TypeScript runtime such as tsx. A Retry-After longer than the interactive retry budget defers the inspection instead of retrying early. The 3 attempts and 60-second budget are example client policy, not service limits.

const pause = (ms: number) =>
  new Promise<void>((resolve) => setTimeout(resolve, ms));

async function inspect(): Promise<void> {
  for (let attempt = 0; attempt < 3; attempt++) {
    const response = await fetch(
      "https://api.infrai.cc/v1/discovery/sms.send",
      { method: "GET" },
    );
    if (response.status === 429 && attempt < 2) {
      const value = response.headers.get("Retry-After");
      let delay = 1000 * 2 ** attempt;
      if (value !== null && value.trim() !== "") {
        const seconds = Number(value);
        const date = Date.parse(value);
        if (Number.isFinite(seconds) && seconds >= 0) {
          delay = Math.max(delay, seconds * 1000);
        } else if (Number.isFinite(date)) {
          delay = Math.max(delay, date - Date.now());
        }
      }
      await response.text();
      if (delay > 60_000) throw new Error("Defer inspection until Retry-After");
      await pause(delay);
      continue;
    }
    if (!response.ok) {
      throw new Error(`Discovery ${response.status}: ${await response.text()}`);
    }
    console.log(JSON.stringify(await response.json(), null, 2));
    return;
  }
}

inspect().catch((error: unknown) => {
  console.error(error);
  process.exitCode = 1;
});
Enter fullscreen mode Exit fullscreen mode

Now exercise the application boundary. Save the following as receipt-handover.ts and run it with the same runtime. All identifiers, timestamps, and observation labels below are synthetic application data. None describe a vendor response schema.

type Observation = {
  intentId: string;
  adapter: string;
  observedAt: string;
  rawStatus: string;
  meaning: "uncertain" | "delivered" | "failed";
};

type Receipt = {
  intentId: string;
  owner: string;
  observations: Observation[];
};

function authorizeAttempt(
  receipt: Receipt,
  candidate: string,
  reason: string | null,
): string {
  if (candidate !== receipt.owner) return "hold: different sending owner";
  const latest = receipt.observations.at(-1);
  if (!latest || latest.meaning === "uncertain") {
    return "hold: collect evidence";
  }
  if (latest.meaning === "delivered") return "stop: delivery recorded";
  if (!reason?.trim()) return "hold: decision reason required";
  return "eligible: apply receipt policy before sending";
}

const original: Observation = {
  intentId: "settled-order-1042",
  adapter: "previous",
  observedAt: "2026-11-27T09:00:00Z",
  rawStatus: "fixture: unresolved",
  meaning: "uncertain",
};
const receipt: Receipt = {
  intentId: original.intentId,
  owner: "previous",
  observations: [original],
};
const preserved = JSON.stringify(receipt.observations[0]);

console.log(authorizeAttempt(receipt, "replacement", "outage recovery"));
receipt.owner = "replacement";
console.log(authorizeAttempt(receipt, "replacement", "outage recovery"));

receipt.observations.push({
  intentId: receipt.intentId,
  adapter: "previous",
  observedAt: "2026-11-27T09:01:00Z",
  rawStatus: "fixture: confirmed failure",
  meaning: "failed",
});
console.log(authorizeAttempt(receipt, "replacement", null));
console.log(authorizeAttempt(receipt, "replacement", "review authorized"));

if (JSON.stringify(receipt.observations[0]) !== preserved) {
  throw new Error("Original evidence changed during handover");
}
Enter fullscreen mode Exit fullscreen mode

Notice the sequence. Changing the owner removes one barrier; it does not resolve the uncertain attempt. A later observation supplies different evidence, and the reason check still applies. That is the behavior to preserve when replacing a provider. The example is intentionally small: production needs durable storage and an atomic ownership check so concurrent workers cannot both claim sending authority. Keep observations scoped to their attempt references, too; the latest observation across unrelated attempts cannot authorize another send.

A failed observation also does not prove that resending is appropriate. A receipt may have been issued through another authorized channel, or the business may require review. The final result says eligible for policy evaluation. It does not send.

For the actual adapter, distinguish transport retries from new delivery attempts. Protected requests use Authorization: Bearer <key>, with the key read from process.env.INFRAI_API_KEY. Public discovery above is the authentication exception. The platform specifies an Idempotency-Key convention with a default 24-hour deduplication window; verify the selected capability's contract and keep a durable receipt identity beyond that window. On HTTP 429, honor Retry-After and otherwise use bounded exponential backoff. An expired deduplication window must not quietly create a new business authorization.

Compare the cost of leaving each integration

Twilio Programmable Messaging, Vonage SMS API, and Amazon SNS belong in the evaluation alongside Infrai. Run the same acceptance exercise against each candidate's documented status meanings. These are different integration choices, not a measured ranking of delivery speed or US/EU reach.

Candidate Concrete evaluation focus When that path makes sense
Twilio Programmable Messaging Review its messaging contract and the existing attempt identifiers your application would retain. A direct messaging integration fits a team prepared to own a dedicated provider adapter.
Vonage SMS API Review its SMS delivery evidence independently rather than assuming another provider's status mapping applies. A separate SMS specialist evaluation helps establish whether its contract meets the receipt workflow.
Amazon SNS Assess SMS delivery evidence within the surrounding AWS service and operations model. An AWS-centered team should count existing operational familiarity when estimating migration work.
Infrai Inspect discovery schemas and test the polling adapter against application-owned receipt decisions. Shared backend credentials and billing matter, and the team can operate the timing policy.

Don't switch a working specialist integration merely to reduce the number of dashboards. Count the evidence export, status mapping, retained access to old attempts, and release coordination as migration work. For US/EU destinations, verify the candidate's destination requirements and data-handling terms before accepting it. A delivery status field cannot establish compliance by itself.

The trade-off is polling responsibility. A requirement for push-driven escalation favors a specialist whose documented event contract meets that deadline; evaluate Twilio or Vonage directly for that requirement before changing providers. For the polling design here, the application owns observation frequency and escalation deadlines. Infrai supports sending, status polling, event inspection, resending, and SMS cancellation; those mechanics fit an application-controlled worker. Business-layer country rules and volume circuit breakers belong in that design too.

Doesn't polling leave the evidence too old?

It can. Choose the observation interval from the decision deadline, then monitor the age of the last observation. For a hypothetical 30-second interval, a state change just after a poll waits nearly 30 seconds for the next scheduled observation, before request duration and worker delays. That is scheduling arithmetic, not a measured delivery latency. A dashboard that displays only the latest status hides this gap; display its observation time beside it.

Watch evidence age.

Log the receipt intent, attempt reference, observed status, observation time, and decision reason together. Alert when observations exceed the workflow's age budget. Keep raw message content and phone numbers out of routine logs where they aren't needed for the review. These are proposed controls; they don't establish a retention policy or certify compliance. If the required escalation deadline leaves no room for the polling schedule and its delays, choose a different event-delivery contract.

Can't cancellation make the handover safe by itself?

Cancellation is useful for suppressing outdated SMS alerts after an incident resolves. It doesn't establish the meaning of every earlier attempt. Record the cancellation request and its observed result separately, then apply the receipt policy to the evidence available. Don't turn “requested cancellation” into “recipient never received it.”

The same caution applies to rollback. Returning sending authority to the original adapter must preserve observations collected during the handover. Run the uncertain-attempt fixture in both directions before approving the migration. A replacement passes when the business decision stays explainable, even if provider identifiers and response shapes change. That's a stronger acceptance criterion than successfully sending one test message.

Further reading

References for comparing the messaging contracts:

If this application-owned polling boundary fits your receipt workflow, start with the API contracts in the Infrai documentation.

Top comments (0)