{
  "id": 23909136,
  "title": "Seller Notifications: Email and SMS Timeout Handling With Polling Acceptance Tests",
  "url": "https://urgent.news/2026/12/06/seller-notifications-email-and-sms-timeout-handling-with-polling",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-12-06T21:31:10.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/malachinilsson7591/seller-notifications-email-and-sms-timeout-handling-with-polling-acceptance-tests-58f1"
  },
  "original_language": null,
  "account": "When a marketplace seller waits for an email or SMS notification about a new order event, there is a risk of timeout if the remote system does not respond. The key is to keep track of the order notification record, separate the submission from the delivery, and use a scheduled worker to reconcile known message identifiers. To handle email and SMS notifications after a timeout, the worker should first examine the order and seller information, such as order-1042 and seller-27. If the notification policy calls for both channels, the SMS should be recorded separately from the email to maintain clarity.\n\nThe first design constraint is the submission boundary, where a deadline expiring in the caller does not confirm whether the remote system accepted the request. This uncertainty should be represented explicitly. If a response contains a message identifier, it should be persisted, and a status lookup scheduled. However, if no identifier is available, the worker must have an integration-specific method to find the submission or decide on an explicit resolution. Polling an invented identifier is not a solution and should be avoided.\n\nThe worker should retain evidence, including the order reference, channel, local notification key, remote message identifier, and the last observed status. It is crucial to differentiate between a submission acknowledgement and evidence of delivery, preserving an unknown outcome when the evidence does not support a stronger statement. For SMS, refer to the documentation in References to verify the actual status contract of the integration, as email and SMS adapters may have different contracts.\n\nThe second trap to avoid is automatically sending SMS when an email request times out, which can turn a transport ambiguity into a seller communication policy. The fallback should be an explicit policy with its own record, rather than hiding it inside exception handling. Although this adds some application logic, it helps maintain control over how often to interrupt a seller.\n\nTo build the reconciliation core, create a state transition that can be exercised without credentials or a running scheduler. The caller must persist the remote identifier when it receives one. A record with no identifier enters the review path, as this example does not have a universal lookup-by-order API. All interfaces below are application-owned contracts and not commercial API routes or claims about a provider's response format.\n\nThe minimum useful implementation includes a state transition that can be tested without credentials or a running scheduler. Submission happens outside this function, with the caller persisting the remote identifier when received. The record with no identifier enters the review path, and the adapter must translate documented remote states into outcomes like \"pending,\" \"delivered,\" or \"failed.\" An ambiguous result should be left as \"pending.\"\n\nThe function `reconcile` takes a `Notice`, a `StatusPort`, the current time (`now`), and a `pollDelayMs` as inputs and returns a proposed `Notice` record. If the state is not \"pending,\" it returns the notice as is. If there is no remote identifier or the current time exceeds `stopPollingAt`, it returns the notice with the state set to \"needs-review.\" If a next poll time is set, it checks if the current time has passed that time before proceeding. The function attempts to read the remote identifier and sets the outcome accordingly. If the lookup fails, it sets the outcome to \"pending.\"\n\nThe worker must claim a due record, call the `reconcile` function, and save the result using a lease or version check to prevent overlapping executions from overwriting newer evidence. Remote lookup should have a bounded time, as polling delay does not impose a network deadline. Finally, submission deduplication must be built separately from a stable key for the order, seller, channel, and notification purpose, while remote deduplication after ambiguous submissions must be verified in the chosen sending contract before allowing automatic resubmission. Avoid expanding config files, keeping polling delay and observation deadline as inputs passed by the caller, and ensuring the core remains focused on the unresolved path before adding a scheduler.",
  "summary": "A marketplace seller needs email or SMS notifications about a new order event. After a submission timeout, with no webhook receiver, the useful constraint is evidence: does the worker have a message identifier it can query, or just an unanswered request? TL;DR: Keep an order notification record, separate submission from delivery, and let a scheduled worker reconcile known message identifiers. A…",
  "summary_source": "publisher",
  "key_points": [
    "Seller notifications risk timeout if remote system doesn't respond",
    "Worker examines order and seller info, records SMS separately from email",
    "Reconciliation core tests state transitions without credentials or scheduler"
  ],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "outlets_capped": false,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}