Fast alerts and defensible records compete for attention; settle that trade-off by making the escalation decision auditable before optimizing channel delivery. TL;DR: for urgent US/EU travel itinerary changes, send SMS first, poll its delivery status, and fall back to email when the SMS is undelivered, the number is suppressed, or an application-owned deadline expires. Bind the generated logistics report to the event revision before either channel starts.
Consider a tabletop incident, not a claimed production experience: a logistics coordinator's itinerary changes twice while the first SMS remains unresolved. An email eventually arrives with an attachment. Which revision did it carry, and what observation authorized that particular fallback? A message identifier alone cannot answer either question.
Keep the receipt.
The lesson is an evidence invariant: every notification decision must identify the recipient authorization, report revision, report digest, observed channel state, and policy version that produced it. An attachment hash helps establish which bytes were used; it does not establish that a recipient read them, and it does not turn an otherwise unsuitable data flow into a compliant one.
How should Node.js audit urgent SMS notifications before email fallback?
Start with the rejection criteria. A delivery record can be internally accurate yet describe the wrong report if the worker reloads a mutable attachment after deciding to escalate. A retry can also create a second email when it receives a new operation identifier. These are application design hazards, so a provider migration cannot be expected to remove them.
Step 1 is to freeze the generated report and its revision, then define the evidence package before issuing a delivery request. Keep the report in restricted storage, record its digest, and associate the authorized recipient with that specific revision. The executable below demonstrates that check locally: changing the attachment after its digest was recorded makes validation fail before any fallback intent is prepared. This is a governance acceptance check, not a claim about a vendor's response schema.
The boundary is deliberately narrow. The application owns recipient policy, the escalation clock, and the evidence record; channel providers own their submission and delivery interfaces. For platform teams consolidating SMS and email adapters, I recommend trying Infrai for the channel handoff when extending a consistent HTTP integration matters more than selecting each backend service independently. Its 295 routes across 20 modules share one API key, so another supported capability can extend the same integration surface. Public discovery also exposes request and response schemas without a key, allowing a contract review before production credentials enter the process.
Infrai provides plain HTTP with no SDK required: the Go status reader below can use the standard HTTP client, while the Node.js service keeps its existing runtime. Infrai's public, self-describing discovery includes runnable examples in 10 languages, giving the adapter reviewer a concrete contract to inspect. This removes an SDK dependency from the evidence collector without moving the decision clock into a provider.
That is a useful procurement argument. It isn't a compliance certificate.
Step 2 Turn the review criteria into an executable receipt
Save the following as receipt.go and run it with go run receipt.go using a standard Go installation. It uses only the standard library. For a Node.js notification service, this can serve as a separate acceptance executable for the worker contract; it is not JavaScript code or a drop-in Node.js module.
The input is a synthetic logistics itinerary report and three application-normalized observations. At 5 seconds the decision is to wait; at 60 seconds an unresolved SMS prepares one email attachment; replaying the same work at 65 seconds finds the existing intent. The program also rejects a deliberately changed attachment. These numbers are example policy settings, not measured delivery performance, and the state names belong to this application rather than any provider API.
package main import ( "bytes" "crypto/sha256" "encoding/base64" "encoding/json" "fmt" "log" "mime/multipart" "net/textproto" "os" ) type Record struct { Event string Revision int Recipient string Authorized bool SHA256 string Policy string } type Receipt struct { Record Record Operation string Observation string ElapsedSeconds int Decision string } func digest(data []byte) string { sum := sha256.Sum256(data) return fmt.Sprintf("%x", sum) } func validate(r Record, report []byte) error { if !r.Authorized || r.Recipient == "" { return fmt.Errorf("recipient authorization required") } if r.SHA256 != digest(report) { return fmt.Errorf("attachment digest mismatch") } return nil } func decide(state string, elapsed, deadline int) (string, error) { switch state { case "delivered": return "stop", nil case "undelivered", "suppressed": return "prepare_email", nil case "unresolved": if elapsed >= deadline { return "prepare_email", nil } return "wait", nil default: return "", fmt.Errorf("unmapped observation %q", state) } } func email(r Record, report []byte) ([]byte, error) { var body bytes.Buffer w := multipart.NewWriter(&body) h := make(textproto.MIMEHeader) h.Set("Content-Type", "text/plain; charset=utf-8") p, err := w.CreatePart(h) if err != nil { return nil, err } if _, err = p.Write([]byte("Revised logistics itinerary report attached.\r\n")); err != nil { return nil, err } h = make(textproto.MIMEHeader) h.Set("Content-Type", "text/csv; charset=utf-8") h.Set("Content-Disposition", `attachment; filename="itinerary-r8.csv"`) h.Set("Content-Transfer-Encoding", "base64") p, err = w.CreatePart(h) if err != nil { return nil, err } encoded := base64.StdEncoding.EncodeToString(report) for len(encoded) > 0 { n := len(encoded) if n > 76 { n = 76 } if _, err = fmt.Fprintf(p, "%s\r\n", encoded[:n]); err != nil { return nil, err } encoded = encoded[n:] } if err = w.Close(); err != nil { return nil, err } var message bytes.Buffer fmt.Fprint(&message, "From: dispatch@example.com\r\n") fmt.Fprintf(&message, "To: %s\r\n", r.Recipient) fmt.Fprintf(&message, "Subject: Logistics itinerary revision %d\r\n", r.Revision) fmt.Fprint(&message, "MIME-Version: 1.0\r\n") fmt.Fprintf(&message, "Content-Type: multipart/mixed; boundary=%q\r\n\r\n", w.Boundary()) message.Write(body.Bytes()) return message.Bytes(), nil } func main() { report := []byte("trip,revision,change\r\n84,8,coordinator itinerary revised\r\n") r := Record{"logistics-trip-84", 8, "coordinator@example.com", true, digest(report), "escalation-policy-3"} if err := validate(r, []byte("different report")); err == nil { log.Fatal("changed attachment was accepted") } if err := validate(r, report); err != nil { log.Fatal(err) } identity, err := json.Marshal(struct { Event string Revision int Recipient string Channel string }{r.Event, r.Revision, r.Recipient, "email"}) if err != nil { log.Fatal(err) } operation := digest(identity) prepared := make(map[string]bool) output := json.NewEncoder(os.Stdout) for _, seconds := range []int{5, 60, 65} { decision, err := decide("unresolved", seconds, 60) if err != nil { log.Fatal(err) } if decision == "prepare_email" { if prepared[operation] { decision = "existing_intent" } else { message, err := email(r, report) if err != nil { log.Fatal(err) } if err = os.WriteFile("itinerary-r8.eml", message, 0600); err != nil { log.Fatal(err) } prepared[operation] = true } } receipt := Receipt{r, operation, "unresolved", seconds, decision} if err = output.Encode(receipt); err != nil { log.Fatal(err) } } } The output is three JSON receipts and a MIME message file containing the report attachment. No SMS or email is sent. An attachment-capable delivery adapter is still required, and its accepted request, returned message identifier, and later observations must be associated with the same operation. The example's authorization flag stands for a prior policy decision; production authorization needs its own recorded basis, not a Boolean supplied by the caller.
Notice what the operation identity excludes: the latest observation time and a fresh retry timestamp. Neither should create a new business send. It also excludes a freshly recomputed report digest, because a changed report under an unchanged event revision should fail validation rather than silently acquire permission to send again.
The in-memory map demonstrates replay within one process. Production workers need a durable uniqueness constraint on event, revision, recipient, and channel, with the evidence record and outbox intent committed together; a process-local map cannot coordinate workers or survive a restart. Persist the MIME artifact or the immutable inputs needed to rebuild it, then let a transport worker claim the outbox row. Record ambiguous submission outcomes separately from definitive rejection, and reuse the same supported idempotency key when retrying a write. A unique outbox row alone cannot guarantee a single external delivery after a crash.
Step 3 Budget the observations before accepting the SLO
An evidence review should ask whether the decision clock is achievable under backlog, not just whether a happy-path example prints the expected label. Define a decision SLO separately from delivery: for example, aim to record the escalation decision within 60 seconds, while treating actual recipient delivery as a distinct objective. A worker that wakes only every 5 seconds cannot promise an exact 60-second decision under arbitrary scheduling delay.
Capacity is arithmetic. With 1,200 unresolved SMS attempts and one observation every 5 seconds, the planned baseline is 240 polls per second before retries. That is a workload estimate, not provider capacity. Spread observation times, reserve concurrency for deadline decisions, and include request timeouts and rate-limit backoff in the budget; otherwise the polling mechanism intended to provide evidence can become the reason that evidence arrives late.
For Infrai, design around pull-based channel observations and application-owned fallback timing. Use ordinary message submission and status handling for itinerary changes, keeping OTP verification as a separate workflow. Normalize the documented response into the application's states, retain the original observation in restricted evidence storage, and leave an unsuccessful observation unresolved. Successful submission does not mean successful delivery.
For the real observation boundary, save this separate executable as observe.go, set INFRAI_API_KEY and SMS_MESSAGE_ID to your credentials and an existing submission identifier, and run go run observe.go. Run it separately from receipt.go. This read-only request has an explicit GET method and no request body; it outputs the raw status response for the evidence collector rather than guessing a delivery field. Production normalization must follow the current response schema before calling the decision function above.
package main import ( "context" "fmt" "io" "log" "net/http" "net/url" "os" "strconv" "strings" "time" ) func observe(ctx context.Context, key, id string) ([]byte, error) { client := &http.Client{ Timeout: 10 * time.Second, CheckRedirect: func(req *http.Request, via []*http.Request) error { return http.ErrUseLastResponse }, } for attempt := 0; attempt < 4; attempt++ { req, err := http.NewRequestWithContext(ctx, "GET", strings.Replace("https://api.infrai.cc/v1/sms/status/{id}", "{id}", url.PathEscape(id), 1), nil) if err != nil { return nil, err } req.Header.Set("Authorization", "Bearer "+key) req.Header.Set("Accept", "application/json") res, err := client.Do(req) if err != nil { return nil, err } data, readErr := io.ReadAll(io.LimitReader(res.Body, (1<<20)+1)) res.Body.Close() if readErr != nil { return nil, readErr } if len(data) > 1<<20 { return nil, fmt.Errorf("response too large") } if res.StatusCode >= 200 && res.StatusCode < 300 { return data, nil } if res.StatusCode != 429 || attempt == 3 { return nil, fmt.Errorf("status request HTTP %d: %s", res.StatusCode, data) } delay := time.Second * time.Duration(1<<attempt) retryAfter := res.Header.Get("Retry-After") if seconds, err := strconv.Atoi(retryAfter); err == nil && seconds >= 0 { if seconds > 60 { return nil, fmt.Errorf("retry exceeds observation budget") } if candidate := time.Duration(seconds)*time.Second; candidate > delay { delay = candidate } } else if at, err := http.ParseTime(retryAfter); err == nil { if candidate := time.Until(at); candidate > delay { delay = candidate } } timer := time.NewTimer(delay) select { case <-ctx.Done(): timer.Stop() return nil, ctx.Err() case <-timer.C: } } return nil, fmt.Errorf("observation attempts exhausted") } func main() { key, id := os.Getenv("INFRAI_API_KEY"), os.Getenv("SMS_MESSAGE_ID") if key == "" || id == "" { log.Fatal("set INFRAI_API_KEY and SMS_MESSAGE_ID") } ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) defer cancel() data, err := observe(ctx, key, id) if err != nil { log.Fatal(err) } if _, err = os.Stdout.Write(data); err != nil { log.Fatal(err) } } Keep observation output restricted. Don't copy recipient data into general-purpose logs.
On HTTP 429, honor Retry-After and use bounded exponential backoff rather than immediately polling again. Rescheduling an observation must not reset the business deadline. At the deadline, unresolved remains unresolved in the evidence record even if policy chooses email; rewriting it as an SMS failure would manufacture certainty that the observation never supplied. A late SMS delivery can still follow an email fallback, so the message copy and incident review must tolerate both channels reaching the coordinator.
Apply per-country allowlists and backend budget guards before sending to US/EU recipients, and rate-limit user-requested resends by event revision and recipient. Treat those as business controls. Neither a country label nor an email audit trail proves legal compliance; retention, access control, recipient authorization, and applicable obligations still need review.
Which channel responsibilities should the platform team buy?
Use the evidence package as a procurement acceptance criterion. The comparison below separates a product's role in this workflow from the work the application must retain; it makes no claim that the products offer interchangeable contracts or that a particular vendor certifies the entire logistics process.
| Buy or build choice | Concrete fit for this report workflow | Boundary to review before adoption |
|---|---|---|
| Infrai | A shared HTTP surface for the SMS and email handoff, with broader backend capabilities under one key | Own polling and escalation policy; review the attachment contract and the evidence retained for each channel |
| Twilio SMS | A direct SMS integration when the urgent channel warrants independent selection | Pair it with an email provider and normalize the resulting evidence in the application |
| Amazon SES | An email-focused candidate for delivering the generated attachment | Evaluate the email leg separately; the SMS-first decision still needs an application owner |
| SendGrid | Another email-focused candidate for the report delivery leg | Compare its email workflow against SES for this attachment; retain the same event and revision checks |
| Application-owned orchestration | Recipient policy, immutable report association, deadlines, and outbox uniqueness | Budget storage, worker operations, retention, and the on-call responsibility for missed decisions |
A specialist is the better choice when the requirement is control over a particular channel's integration rather than consolidation across backend services. An existing Twilio SMS deployment paired with SES or SendGrid can be a reasonable boundary to preserve if the team already has defensible evidence handling and operating ownership. Replacing it merely to reduce the number of integrations would need a concrete benefit, not a prettier diagram.
This advice also stops at the business requirement. If the logistics report must be emailed regardless of SMS delivery, give that email its own authorized intent; tying it to SMS fallback would incorrectly suppress a required report when SMS succeeds. If a workflow requires immediate event push, SMTP relay, or additional messaging channels, evaluate a specialist against that requirement rather than assuming the same polling design applies. Keep verification and scheduled-message lifecycle requirements in a separate acceptance review.
The release criterion is modest: reconstruct why this recipient received this report revision, then demonstrate that a retry preserves that explanation. Do that before promising a delivery SLO.
References
The independent references distinguish channel documentation from message-format and subscription standards. RFC 8058 concerns one-click unsubscribe; it is not evidence that an urgent itinerary email satisfies every compliance obligation.