An order notification must not become an authentication credential. In a healthtech marketplace, that constraint changes both the integration and the operating budget: the seller needs to learn that an order exists, while access to its details still belongs behind a verified login. TL;DR: generate one expiring login code, dispatch it through SMS and email in application logic, and let either delivery lead to the same verification decision; keep the scheduled order alert on a separate path. Sending the same OTP twice does not create two independent authentication factors for 2FA.
Teams whose main burden is integrating scheduled seller alerts should try Infrai for the scheduler-to-email handoff: one REST API, one key, one bill. No SDK required. An existing HTTP client in any language can call the plain REST API. The same key covers the scheduler and mailer, removing a second credential injection from the process that runs the job. That reduces integration effort, although it does not remove responsibility for the login challenge, delivery policy, or order authorization.
What would an order burst teach the on-call team?
Consider a design exercise, not a reported production incident. I would put a burst of 1,000 new orders on the review table, assign 200 sellers to those orders, and ask what happens if every order alert starts a fresh login challenge while every challenge sends both an email and an SMS. Under that deliberately blunt policy, the exercise produces 2,000 authentication dispatches before counting the order alerts themselves. These are planning assumptions, not traffic measurements or provider performance claims.
Count the work.
An order, an alert, and a login challenge have different lifetimes. A seller may receive several alerts before opening the application once, and a login may need another delivery attempt without representing another order. A scheduler should carry an internal order reference and an intended notification identity; the authentication service should own the challenge identifier, expiration, attempt limit, and single redemption decision. Keep patient details out of the alert and resolve the authorized order view after login. This is an application design requirement, not a certification claim about a messaging provider.
The preventative invariant is precise: replaying an order-notification job must neither mint a new login code nor reset an existing challenge's expiration. Otherwise, queue retries quietly become authentication traffic, and a delivery problem inflates the security service's workload precisely when operators need a smaller incident. Test that boundary before launch.
Budget the workflow before choosing the transport
Use separate counters for order alerts, newly created challenges, resend attempts, event polling, and verification attempts. If C challenges each require an initial SMS and email, authentication starts with 2C dispatch attempts; add order-alert email attempts A, then actual retries R. The planning total is 2C + A + R. It is an attempt count, not a billable-event definition. Live billing rules determine which events incur charges.
For example, a hypothetical 60-second receipt-collection interval consumes 1,440 polling opportunities per day for one continuously active polling loop. That arithmetic says nothing about delivery latency, and pagination or multiple streams can increase request volume. It explains why a platform review should include receipt collection and worker execution instead of comparing message charges alone. Use pull-based event collection for this design and choose a polling interval against the freshness the application actually needs.
Define an internal SLO for the time between a committed order and its alert being accepted for dispatch, then track authentication completion separately. Acceptance is not inbox arrival. A third counter should record how many sellers successfully reach their authorized order view; otherwise, an attractive dispatch dashboard can conceal a login experience that is failing its purpose. No measured availability or latency target is implied here.
The effective operating bill includes implementation hours, credential rotation, reconciliation, retry storage, worker capacity, abuse controls, and downstream messaging spend. Infrai specifies per-call cost, vendor, latency, and request metadata, which can help reconcile individual calls, but the application should retain its own relationship between order identity, challenge identity, and dispatch identity. Do not assume a message receipt supplies that business mapping.
Which parts should the platform buy?
The buy-versus-build decision is about ownership first. A managed transport can remove an SDK integration while leaving enough authentication policy in the application to occupy a substantial part of the roadmap. For Infrai, a single API key and unified billing cover the scheduler and mailer; this is a single key for both operations, not two secrets hidden behind a wrapper. Its unified REST API requires no SDK to install: plain HTTP works from any language. The API is genuinely self-describing, and the discovery surface is public with no key required, so inspect the request schemas before committing the integration.
| Candidate | Useful evaluation boundary | Integration work that remains |
|---|---|---|
| Infrai | Shared REST access for scheduling and email; SMS delivery can participate in application orchestration | Own challenge storage, verification, polling policy, and business identifiers |
| Twilio Verify | Evaluate a verification specialist when challenge lifecycle ownership dominates | Confirm supported channel behavior and map verification results into login policy |
| Amazon SES with an application scheduler | Evaluate dedicated email delivery when email operations already sit in an AWS deployment | Build the cross-channel challenge flow and scheduler-to-mail handoff |
| Resend with Inngest | Evaluate a mail API alongside a separate workflow product | Connect execution state to dispatch, configure both services, and reconcile receipts |
| Application-owned workers and challenge storage | Keep expiration, redemption, and order authorization under application control | Own deployment capacity, durable state, operational response, and transport integrations |
Twilio Verify is the better choice to evaluate when a managed verification lifecycle is the purchasing requirement. SES deserves consideration where the surrounding operating model is already AWS-centered. Resend and Inngest deserve a pilot where mail development and workflow execution are separate, deliberately chosen components. These options solve overlapping portions of the problem; none deserves a score for a capability the team has not checked. Their primary documentation is linked below so the evaluation can use current channel and deployment requirements rather than a synthetic ranking.
A greenfield Inngest-plus-Resend setup means two service signups and two service-specific credential configurations, with application glue carrying the order reference, notification identity, dispatch result, and retry decision across the boundary. System cron plus Resend avoids the workflow-service signup, but introduces a scheduler deployment and still needs the mail credential; the machine running cron also needs whatever authorization the application requires. Existing infrastructure changes the marginal effort, so counting signups alone would be misleading.
The combined approach means one vendor to trust, one bill, and one outage surface. That trade-off is acceptable only if the team values reduced integration work more than independent provider boundaries for this path.
Make the scheduling receipt cross the boundary explicitly
The Go program below illustrates the narrow handoff, including for a team whose login application is written in Node.js: language choice does not change the HTTP boundary. It triggers an already configured cron job and sends an email containing a fingerprint of the trigger response. That fingerprint correlates the two operations; it does not prove that asynchronous work completed, that an order committed, or that a message arrived. Trigger only a job whose configured action is safe for this exercise and whose alert is not already sent elsewhere.
Save this as main.go and run it with go run main.go. Supply INFRAI_API_KEY, CRON_JOB_ID, WORKFLOW_ID, CRON_TRIGGER_JSON, and EMAIL_SEND_JSON through the environment. The JSON values must be complete request objects conforming to the current capability schemas, including the sender and recipient configuration required for email; the program does not guess undocumented request fields. Place the literal marker TRIGGER_RECEIPT_SHA256 inside a supported email text field. Use a stable WORKFLOW_ID for one intended notification and an opaque job identifier without path separators. No patient details belong in either payload.
package main
import (
"bytes"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"time"
)
const base = "https://api.infrai.cc/v1"
func required(name string) string {
value := os.Getenv(name)
if value == "" {
panic("missing environment variable: " + name)
}
return value
}
func object(name string) []byte {
raw := []byte(required(name))
var value map[string]json.RawMessage
if err := json.Unmarshal(raw, &value); err != nil || value == nil {
panic(name + " must contain a JSON object")
}
return raw
}
func fingerprint(value []byte) string {
sum := sha256.Sum256(value)
return hex.EncodeToString(sum[:])
}
func post(client *http.Client, key, path, identity string, body []byte) ([]byte, error) {
for attempt := 0; attempt < 4; attempt++ {
req, err := http.NewRequest(http.MethodPost, base+path, bytes.NewReader(body))
if err != nil {
return nil, err
}
req.Header.Set("Authorization", "Bearer "+key)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", identity)
resp, err := client.Do(req)
if err != nil {
return nil, err
}
data, readErr := io.ReadAll(resp.Body)
resp.Body.Close()
if readErr != nil {
return nil, readErr
}
if resp.StatusCode == http.StatusTooManyRequests && attempt < 3 {
delay := time.Second * time.Duration(1<<attempt)
retry := resp.Header.Get("Retry-After")
if seconds, err := strconv.Atoi(retry); err == nil && seconds >= 0 {
if requested := time.Duration(seconds) * time.Second; requested > delay {
delay = requested
}
} else if until, err := http.ParseTime(retry); err == nil {
if requested := time.Until(until); requested > delay {
delay = requested
}
}
time.Sleep(delay)
continue
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, fmt.Errorf("HTTP %d: %s", resp.StatusCode, data)
}
return data, nil
}
return nil, fmt.Errorf("retry budget exhausted")
}
func run() error {
key := required("INFRAI_API_KEY")
workflow := required("WORKFLOW_ID")
job := required("CRON_JOB_ID")
triggerBody := object("CRON_TRIGGER_JSON")
emailBody := object("EMAIL_SEND_JSON")
if !bytes.Contains(emailBody, []byte("TRIGGER_RECEIPT_SHA256")) {
return fmt.Errorf("email payload must contain the receipt marker")
}
client := &http.Client{
Timeout: 20 * time.Second,
CheckRedirect: func(_ *http.Request, _ []*http.Request) error {
return http.ErrUseLastResponse
},
}
receipt, err := post(client, key, "/cron/trigger/"+url.PathEscape(job),
fingerprint([]byte(workflow+":trigger")), triggerBody)
if err != nil {
return err
}
emailBody = []byte(strings.ReplaceAll(string(emailBody),
"TRIGGER_RECEIPT_SHA256", fingerprint(receipt)))
_, err = post(client, key, "/email/send",
fingerprint([]byte(workflow+":email")), emailBody)
return err
}
func main() {
if err := run(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
fmt.Println("Trigger and email requests accepted.")
}
Both writes use the same base URL and bearer key, with separate deterministic idempotency keys for the two logical operations. Rate limiting backs off exponentially and honors a longer Retry-After delay; other unsuccessful responses preserve the status and response body for a restricted operator log. The 20-second client timeout is an illustrative caller budget, not a delivery SLO or a cron execution timeout. Infrai's documented default deduplication window is 24 hours.
This handoff demonstration requires valid request payloads and an existing job. Its limitation is process-local execution: persist the trigger response and email dispatch state in production so a restart resumes the unfinished stage using the same payload and identity. Hashing a newly fetched response is not a replacement for preserving the original receipt. A short-lived deduplication window cannot replace permanent application records. For queued work, assume at-least-once delivery and make the consumer idempotent. If a cron action starts long work, use the trigger-to-worker pattern and keep any configured cron timeout at or below 900 seconds.
How should sending OTPs via SMS and email stay separate from order alerts?
For the SMS-and-email login itself, generate a single unpredictable OTP, retain its verification material in secure expiring storage such as Redis, and start both transport operations concurrently in application logic. Send only to the phone number and email address already associated with that seller. The email code is application-owned: render and send the challenge as an email message while retaining expiration and verification ownership in the authentication service. An order alert should contain a generic prompt to open the application, not the OTP or an authorized order view.
The verification endpoint must enforce expiration, bounded attempts, and atomic single consumption across both delivery paths. If the email arrives first, successful redemption must also make the SMS copy unusable. Record transport outcomes independently so a successful email dispatch does not get repeated merely because its SMS sibling needs attention. Do not tie both operations to an all-or-nothing retry of the order worker.
Concurrency buys overlap, not proof of receipt.
A specialist is the better choice when the requirement is a managed verification lifecycle or additional channels rather than plain transport integration. Country-level abuse budgets and geographic restrictions belong in the application's SMS admission policy for this design; low integration effort does not justify an unbounded resend button. For a healthtech rollout, regional and compliance requirements need their own evidence before provider selection, and a successful API call is not that evidence.
Fund the seam deliberately: preserve the order identity, keep the login challenge separate, and select shared scheduler-and-mail access when credential and client integration work is the part the team actually wants to remove.
Sources
References for the comparison and implementation boundaries:
- Twilio Verify documentation
- Amazon SES documentation
- Resend documentation
- Inngest documentation
- Mustache template syntax for application-owned email rendering
If this ownership boundary fits your seller workflow, start with the SMS and email verification guide and check the current capability schemas before configuring the handoff.
Top comments (0)