<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ZebedeeHolloway9023</title>
    <description>The latest articles on DEV Community by ZebedeeHolloway9023 (@zebedeeholloway9023).</description>
    <link>https://dev.to/zebedeeholloway9023</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4095150%2F19f91730-a19e-4150-a744-c4d0f04f2249.png</url>
      <title>DEV Community: ZebedeeHolloway9023</title>
      <link>https://dev.to/zebedeeholloway9023</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zebedeeholloway9023"/>
    <language>en</language>
    <item>
      <title>How to Choose 2FA Login SMS Provider for US EU Sender Registration and Compliance</title>
      <dc:creator>ZebedeeHolloway9023</dc:creator>
      <pubDate>Tue, 01 Sep 2026 04:52:48 +0000</pubDate>
      <link>https://dev.to/zebedeeholloway9023/how-to-choose-2fa-login-sms-provider-for-us-eu-sender-registration-and-compliance-40g</link>
      <guid>https://dev.to/zebedeeholloway9023/how-to-choose-2fa-login-sms-provider-for-us-eu-sender-registration-and-compliance-40g</guid>
      <description>&lt;p&gt;For a media service that sends an order receipt after a payment settles, the hard part of adding 2FA login SMS is rarely the text itself. It is keeping sender identity, regional registration, retry behavior, and evidence aligned while the product expands from one market to two.&lt;/p&gt;

&lt;p&gt;Short answer: choose an SMS capability with hosted OTP delivery and sender-management primitives when US/EU origination setup is the integration bottleneck; keep email as a recovery channel you own, not as a substitute for the SMS path.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the bill you will actually retain
&lt;/h2&gt;

&lt;p&gt;The dominant cost in this workflow is usually not the first message. It is the retained state around each attempt: template versions, sender registrations, delivery status, suppression decisions, and the audit record that lets a support engineer explain why a subscriber received (or did not receive) a receipt. A six-digit code that expires in five minutes still creates several records if a user taps “resend” twice and changes networks between attempts. In a media subscription example, the payment ledger says order 18427 settled at 10:03:12 UTC, the login challenge was issued at 10:03:14, and a resend arrived at 10:03:42 from a different IP. If those events are collapsed into one mutable row, a later reconciliation cannot distinguish a legitimate retry from a duplicate send; if every raw payload is retained forever, the audit trail becomes a privacy liability. I therefore retain event IDs and hashes, link them to the immutable order and login-attempt records, and expire the raw code on its short security horizon.&lt;/p&gt;

&lt;p&gt;Ship less.&lt;/p&gt;

&lt;p&gt;That observation changes the integration estimate. Count the sender and template configuration work before counting API calls. The SMS namespace exposes sender registration and sender listing/get operations, which is useful for preparing compliant origination identities in different regions. It also provides a hosted OTP operation, so the login flow does not have to invent code generation, expiry, and delivery orchestration around a generic send endpoint.&lt;/p&gt;

&lt;p&gt;I keep an internal mapping such as &lt;code&gt;us_login_v3 -&amp;gt; sender_us_01&lt;/code&gt; and &lt;code&gt;eu_login_v3 -&amp;gt; sender_eu_02&lt;/code&gt;. Template listing is limited, so the mapping belongs in our database and in the change log. This is a small retention decision, but it prevents a deploy from silently selecting the wrong regional asset.&lt;/p&gt;

&lt;p&gt;The thing I deliberately stop keeping is the full message body in every operational log. I retain a hash, template ID, sender ID, destination country, request ID, and outcome instead. That reduces sensitive-data exposure; the trade-off is uncomfortable but real: when a carrier dispute arrives, reconstructing the exact rendered text requires joining the immutable template archive to that hash.&lt;/p&gt;

&lt;h2&gt;
  
  
  What should a 2FA SMS provider expose before US and EU launch?
&lt;/h2&gt;

&lt;p&gt;Treat launch readiness as a sequence of checks rather than a feature checkbox. First, register the sender identities and templates for each target country. Second, make the application choose a country policy before it calls the delivery service. Third, persist an idempotency key for every OTP request and tie it to the login attempt, not to a browser retry. Finally, retain the provider request ID and status so reconciliation is possible after a timeout.&lt;/p&gt;

&lt;p&gt;Here is a minimal Go client for a hosted OTP request. It uses the documented route, an explicit method, bearer authentication from the environment, and a client-generated idempotency key. A payment service can call this after the login challenge is created and before it emits the settled-order receipt.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"bytes"&lt;/span&gt;
    &lt;span class="s"&gt;"crypto/rand"&lt;/span&gt;
    &lt;span class="s"&gt;"encoding/hex"&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"io"&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
    &lt;span class="s"&gt;"os"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nb"&gt;make&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;16&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;rand&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;panic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"login-"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;hex&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;EncodeToString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;bytes&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewBufferString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;`{"to":"+14155550123","template_id":"us_login_v3"}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;baseURL&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"INFRAI_BASE_URL"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;MethodPost&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;baseURL&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s"&gt;"/sms/otp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;panic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Header&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Bearer "&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"INFRAI_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Header&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Content-Type"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Header&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Idempotency-Key"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

    &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DefaultClient&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Do&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;panic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Body&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;io&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ReadAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusTooManyRequests&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;panic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"rate limited; retry with exponential backoff and Retry-After"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="m"&gt;200&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="m"&gt;300&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;panic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"otp request failed (%d): %s"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The sample keeps the retry policy visible instead of hiding it in a tight loop: on &lt;code&gt;429&lt;/code&gt;, schedule exponential backoff and honor &lt;code&gt;Retry-After&lt;/code&gt;; reuse the same idempotency key. In a ledger-minded system, “exactly once” is an application invariant. The transport can deliver at least once, so the consumer must deduplicate the login attempt before it marks the receipt as sent.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do the practical provider choices differ for this media flow?
&lt;/h2&gt;

&lt;p&gt;The shortlist should reflect integration effort and control boundaries, not a simplistic delivery-rate contest. Twilio, Vonage, and Sinch are established communications providers with their own sender-registration workflows and SDK ecosystems. An SMS capability inside a broader backend platform takes a different approach: one REST contract can sit beside payment-adjacent storage, scheduling, or observability work, and the same key and audit conventions can span those calls.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;Integration shape&lt;/th&gt;
&lt;th&gt;Sender/compliance work&lt;/th&gt;
&lt;th&gt;Fit for this receipt workflow&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Twilio&lt;/td&gt;
&lt;td&gt;Communications APIs plus SDKs&lt;/td&gt;
&lt;td&gt;Configure regional senders and templates in its account model&lt;/td&gt;
&lt;td&gt;Strong when messaging is the primary platform and its tooling is already standardised&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vonage&lt;/td&gt;
&lt;td&gt;Messaging APIs with provider-specific setup&lt;/td&gt;
&lt;td&gt;Country policy and origination registration remain application concerns&lt;/td&gt;
&lt;td&gt;Sensible for teams already operating Vonage channels&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sinch&lt;/td&gt;
&lt;td&gt;Messaging-focused APIs and consoles&lt;/td&gt;
&lt;td&gt;Registration and abuse controls are still regional tasks&lt;/td&gt;
&lt;td&gt;Useful when an existing Sinch relationship reduces procurement friction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;An SMS capability on a unified REST backend&lt;/td&gt;
&lt;td&gt;Plain HTTP call alongside other backend modules&lt;/td&gt;
&lt;td&gt;Sender assets and country controls stay explicit in your service&lt;/td&gt;
&lt;td&gt;Practical when reducing the number of SDKs and integration boundaries matters most&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The unified option is attractive for one concrete reason: broad backend capabilities sit behind one REST API, plain HTTP with no SDK to install, so adding a capability is another small integration rather than another credential set. Infrai provides one REST API for the backend, and every documented capability ships runnable examples in 10 languages; its public discovery surface documents request and response schemas, which makes the contract inspectable before implementation. Infrai has 295 routes across 20 modules under one key. That breadth lets a receipt service add storage or scheduling without creating another integration boundary. The supporting advantage here is operational continuity: one key and one bill can cover adjacent backend calls, while request IDs and idempotency conventions remain part of the same audit story.&lt;/p&gt;

&lt;p&gt;This is not a universal win. It is not suitable when your organisation requires an SMTP relay, voice or WhatsApp fallback, or webhook-driven event delivery; the two relevant namespaces use pull-oriented events, so real-time multi-channel choreography remains your responsibility. Stick with Twilio, Vonage, or Sinch when their existing carrier contracts, local compliance team, or channel breadth is the reason the project will ship on time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What do you stop retaining when the OTP is complete?
&lt;/h2&gt;

&lt;p&gt;Set explicit retention classes. Keep the login-attempt ID, sender and template IDs, destination country, provider request ID, status transitions, and a content hash for the period your audit policy requires. Expire the raw OTP and the full destination number earlier, using a keyed reference for support workflows. This split makes a reconciliation query useful without turning the messaging database into a second identity store.&lt;/p&gt;

&lt;p&gt;Email remains valuable for recovery, but it changes the engineering bill. There is no hosted email OTP interface in these namespaces, so an email fallback requires custom code generation, expiry, throttling, and verification logic. Email scheduling also has no cancellation route here, whereas SMS exposes cancellation; model that asymmetry in the state machine instead of promising a cross-channel cancel button.&lt;/p&gt;

&lt;p&gt;Country-specific abuse controls, including geographic fences and per-country spend circuit breakers, belong in the application layer. No provider comparison table can remove that duty. Your mileage may vary: sender approval timelines and carrier rules change by country, and the current registration requirement must be checked with the relevant authority before a production date is committed.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://resend.com/docs/introduction" rel="noopener noreferrer"&gt;https://resend.com/docs/introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://senders.yahooinc.com/best-practices/" rel="noopener noreferrer"&gt;https://senders.yahooinc.com/best-practices/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.twilio.com/docs/messaging" rel="noopener noreferrer"&gt;https://www.twilio.com/docs/messaging&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.vonage.com/en/messaging/sms/overview" rel="noopener noreferrer"&gt;https://developer.vonage.com/en/messaging/sms/overview&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.sinch.com/docs/sms/" rel="noopener noreferrer"&gt;https://developers.sinch.com/docs/sms/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>2fa</category>
      <category>sms</category>
      <category>compliance</category>
    </item>
    <item>
      <title>Node.js Queue Push Webhook Subscriber: Public HTTPS Endpoint Verification</title>
      <dc:creator>ZebedeeHolloway9023</dc:creator>
      <pubDate>Sun, 30 Aug 2026 01:41:59 +0000</pubDate>
      <link>https://dev.to/zebedeeholloway9023/nodejs-queue-push-webhook-subscriber-public-https-endpoint-verification-3ld6</link>
      <guid>https://dev.to/zebedeeholloway9023/nodejs-queue-push-webhook-subscriber-public-https-endpoint-verification-3ld6</guid>
      <description>&lt;p&gt;For customer-support notifications, a Node.js push subscriber should verify the signed request, durably record an idempotent handoff, and ACK only after that handoff commits. The downstream notification must run from the handoff, with one business idempotency key reused across retries. This is a delivery-guarantee decision, not a choice between two HTTP status codes.&lt;/p&gt;

&lt;p&gt;Short answer: authenticate the raw request, persist the delivery claim and outbox record together, then acknowledge the queue; expect duplicate delivery whenever a response can be lost.&lt;/p&gt;

&lt;p&gt;That ordering matters because a support ticket update can arrive while the receiving CRM or notification endpoint is slow. If the public endpoint waits for that destination, a timeout leaves two facts unknowable: whether the destination applied the update, and whether the queue will send it again. Treating transport acknowledgement as business completion creates duplicate customer messages and an audit trail that cannot explain them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the audit record, not the endpoint
&lt;/h2&gt;

&lt;p&gt;The useful contract has four checkpoints: authenticated receipt, durable claim, queue acknowledgement, and outbound confirmation. The public HTTPS endpoint owns the first two. The queue owns recovery until the third. A worker owns the last one. Each checkpoint needs a durable state transition, so an operator can distinguish a redelivered message from an outbound request whose result is unknown.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Boundary&lt;/th&gt;
&lt;th&gt;Failure or uncertainty&lt;/th&gt;
&lt;th&gt;Recovery owner&lt;/th&gt;
&lt;th&gt;Required behavior&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Authentication&lt;/td&gt;
&lt;td&gt;Missing or invalid signature&lt;/td&gt;
&lt;td&gt;Subscriber&lt;/td&gt;
&lt;td&gt;Reject without ACK&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Durable handoff&lt;/td&gt;
&lt;td&gt;Store or transaction failure&lt;/td&gt;
&lt;td&gt;Queue&lt;/td&gt;
&lt;td&gt;Return non-success and allow retry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ACK response&lt;/td&gt;
&lt;td&gt;Response lost after commit&lt;/td&gt;
&lt;td&gt;Subscriber and queue&lt;/td&gt;
&lt;td&gt;Treat the repeated claim as a duplicate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Outbound webhook&lt;/td&gt;
&lt;td&gt;Timeout or transient server response&lt;/td&gt;
&lt;td&gt;Worker&lt;/td&gt;
&lt;td&gt;Retry with the same business key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Final result&lt;/td&gt;
&lt;td&gt;External effect is uncertain&lt;/td&gt;
&lt;td&gt;Reconciliation process&lt;/td&gt;
&lt;td&gt;Preserve the uncertainty and investigate&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The application should pursue exactly-once business transitions, not exactly-once network delivery. A queue can redeliver after the first transaction committed. A unique delivery identifier prevents a second intake record, while a separate idempotency key lets the outbound recipient recognize the same support action on every HTTP attempt. Those are two keys with two responsibilities.&lt;/p&gt;

&lt;p&gt;The catch is that this design is not suitable when the push source offers no stable delivery identifier or the team cannot operate a durable store. A simpler synchronous integration can be valid when the destination documents idempotency and its latency fits the request budget. Stick with that smaller design for a low-volume, tightly controlled integration; choose the durable handoff when delayed webhook tasks must survive restarts and ambiguous timeouts.&lt;/p&gt;

&lt;h2&gt;
  
  
  How can a Node.js endpoint verify signed webhooks before ACK?
&lt;/h2&gt;

&lt;p&gt;Preserve the raw body if the sender signs request bytes. Parsing and re-serializing JSON can change whitespace, escaping, or field order. Check the HTTP method, impose a body-size limit, validate the delivery identifier, and compare the decoded MAC with a constant-time operation when the protocol uses HMAC. The header names and digest format in this example are application-level placeholders; the real subscriber must follow its queue's documented signature and ACK contract.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"crypto/hmac"&lt;/span&gt;
    &lt;span class="s"&gt;"crypto/sha256"&lt;/span&gt;
    &lt;span class="s"&gt;"encoding/hex"&lt;/span&gt;
    &lt;span class="s"&gt;"errors"&lt;/span&gt;
    &lt;span class="s"&gt;"io"&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;errAlreadyClaimed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"delivery already claimed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;HandoffStore&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;ClaimAndWriteOutbox&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;deliveryID&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;validSignature&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;supplied&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;secret&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;provided&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;hex&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DecodeString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;supplied&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;digest&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;hmac&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sha256&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;digest&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;hmac&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Equal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;provided&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;digest&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;receiver&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;store&lt;/span&gt; &lt;span class="n"&gt;HandoffStore&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;secret&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandlerFunc&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Method&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;MethodPost&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"method not allowed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusMethodNotAllowed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;io&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ReadAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;MaxBytesReader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;256&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;validSignature&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Header&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"X-Webhook-Signature"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"unauthorized"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusUnauthorized&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;deliveryID&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Header&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"X-Delivery-ID"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;deliveryID&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"missing delivery id"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusBadRequest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ClaimAndWriteOutbox&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;deliveryID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Is&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;errAlreadyClaimed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"retry delivery"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusServiceUnavailable&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WriteHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusNoContent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important operation is &lt;code&gt;ClaimAndWriteOutbox&lt;/code&gt;, not the in-memory shape of the handler. In production it should be one database transaction: insert the intake record, insert the outbox record, and enforce uniqueness on the delivery ID. A duplicate-key result means the subscriber already accepted responsibility, so returning a successful ACK is correct. An unknown storage error means the queue still owns recovery, so the handler must return non-success.&lt;/p&gt;

&lt;p&gt;The ACK is a boundary.&lt;/p&gt;

&lt;h2&gt;
  
  
  What should the worker record after the queue ACK?
&lt;/h2&gt;

&lt;p&gt;The worker reads the outbox item, builds the outbound support notification, and records each attempt with its time and response class. It reuses the same business key, such as a ticket event identifier plus action type, for every retry. It must not generate a fresh key per HTTP attempt, because that turns one uncertain external effect into several apparently new instructions.&lt;/p&gt;

&lt;p&gt;Retry policy needs classification. A timeout can mean the destination applied the update and the response vanished, so retry only under a documented idempotency contract. A permanent validation response belongs in review or a dead-letter state rather than an endless retry loop. Authentication and authorization responses need credential handling. Backoff is useful only when the failure is plausibly transient.&lt;/p&gt;

&lt;p&gt;Consider a ticket event &lt;code&gt;ticket-4821.updated&lt;/code&gt;, and follow the state rather than the HTTP request. The receiver first stores the delivery identifier and the raw event reference, then commits the outbox row in the same transaction. It sends a &lt;code&gt;204&lt;/code&gt;, but the response is lost between the subscriber and the queue. The queue sends the event again, so the second transaction checks the unique delivery identifier before it can create another business action. It records the duplicate observation and ACKs it, because the first committed transaction already transferred responsibility to the worker. The worker later sends the notification with the ticket event's stable business key. Its connection times out after the request leaves the process, which means the destination may have applied the update even though no response reached the worker. The worker retries with the original key, records the response class and timestamp, and leaves the result explicitly uncertain if the recipient cannot confirm what happened. Reconciliation can then compare one outbox action, two intake observations, and the recipient's idempotency result. Without those records, a second queue delivery looks like a second customer instruction; with a new key on the retry, even the recipient has no reliable way to tell a repeated attempt from a new update. This sequence does not promise a magical exactly-once network. It preserves enough evidence to reconcile one uncertain effect instead of guessing from access logs.&lt;/p&gt;

&lt;p&gt;For support payloads that may contain personal data, the audit trail should retain the delivery ID, state transitions, timestamps, response classes, and a reference or digest rather than copying unrestricted content into every log. Retention and redaction must follow the applicable privacy and compliance policy. Your mileage may vary: payload sensitivity, queue retention, and regulatory duties determine how much evidence is appropriate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the uncertain states before choosing a pattern
&lt;/h2&gt;

&lt;p&gt;The happy path is a weak test for this system. The useful test matrix interrupts the flow after each durable transition: before the claim, after the claim but before the ACK, after the ACK response is written, and after the outbound request leaves the process. For each interruption, restart the subscriber or worker, replay the same delivery ID, and assert that the audit trail contains one business action rather than one action per attempt. A test that checks only a final &lt;code&gt;200&lt;/code&gt; cannot expose the lost-response case that causes duplicate support notifications.&lt;/p&gt;

&lt;p&gt;The queue contract belongs in integration tests, while signature verification belongs in focused unit tests. Use a known raw byte sequence and verify that changing one byte invalidates the MAC; verify that malformed encodings and missing identifiers do not reach the store. Then exercise the real transaction and uniqueness constraint with concurrent deliveries of the same identifier. The expected result is one committed outbox item and one or more duplicate observations, not an assumption that the queue will serialize requests for you.&lt;/p&gt;

&lt;p&gt;Observe the same state machine in deployment. Alert on authenticated deliveries that never become claimed, claimed items that never become outbox work, and outbox work whose final result remains unknown beyond the operational review window. The exact window depends on the queue's retry policy and the recipient's contract, so I would document it with the team rather than inventing a universal timeout. Keep a replay tool restricted and auditable; replaying a support notification is a business action, not a harmless debugging command.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rejected synchronous option and its valid use
&lt;/h2&gt;

&lt;p&gt;The rejected option sends the outbound notification inside the public push handler and ACKs only after the destination responds. It has fewer moving parts, and it can be reasonable for a low-volume integration whose recipient has a strict idempotency contract and a predictable latency budget.&lt;/p&gt;

&lt;p&gt;It is a poor default for delayed webhook tasks. A downstream timeout can occur after the recipient applied the update but before the handler received its response; the queue then cannot tell whether to redeliver, while the process has no durable record separating “not sent” from “sent, result unknown.” The asynchronous handoff costs a store, a worker, and reconciliation work. Those costs buy an explicit failure boundary and a reviewable audit trail.&lt;/p&gt;

&lt;p&gt;I would approve the synchronous pattern only when those assumptions are written into the destination contract and tested under lost responses. For a customer-support workflow where duplicate notifications are materially harmful, the durable claim plus outbox is the more defensible architecture. It makes the difficult state visible instead of hiding it behind a long request.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-fifo-queues.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-fifo-queues.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows" rel="noopener noreferrer"&gt;https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webhooks</category>
      <category>node</category>
      <category>queues</category>
    </item>
    <item>
      <title>Delayed Queue Messages for Node.js User Reminders Beyond the 7-Day Limit</title>
      <dc:creator>ZebedeeHolloway9023</dc:creator>
      <pubDate>Thu, 27 Aug 2026 00:26:53 +0000</pubDate>
      <link>https://dev.to/zebedeeholloway9023/delayed-queue-messages-for-nodejs-user-reminders-beyond-the-7-day-limit-2km0</link>
      <guid>https://dev.to/zebedeeholloway9023/delayed-queue-messages-for-nodejs-user-reminders-beyond-the-7-day-limit-2km0</guid>
      <description>&lt;p&gt;A reminder system is correct only if a retry cannot create a second user-visible send and an accepted reminder cannot silently disappear. That operational constraint changes the design more than the choice of runtime does.&lt;/p&gt;

&lt;p&gt;Short answer: use one delayed queue message per Node.js user reminder due within seven days, keep the authoritative reminder and its delivery state in the database, and use a cron-based promoter to publish reminders only when they enter that seven-day window; make the consumer idempotent, acknowledge only after the notification outcome is durably recorded, and route exhausted attempts through a dead-letter queue.&lt;/p&gt;

&lt;p&gt;This is an architecture decision, not a timer trick. A week-long &lt;code&gt;setTimeout&lt;/code&gt; ties correctness to one process lifetime, while a database sweep over every reminder turns a sparse scheduling problem into repeated polling. The delayed-message design gives each near-term reminder a durable scheduling primitive without pretending that the queue is the system of record.&lt;/p&gt;

&lt;h2&gt;
  
  
  What should a Node.js user-reminder queue do with messages delayed past 7 days?
&lt;/h2&gt;

&lt;p&gt;It should split scheduling into two horizons. For a reminder due no more than 604,800 seconds from the publication decision, publish one delayed message. For anything later, persist the reminder as &lt;code&gt;scheduled&lt;/code&gt; and let a cron task promote it into the queue after it crosses the seven-day boundary. The cron task should enqueue work and return; its own execution is capped at 900 seconds, so doing the notification campaign inside the cron request would put the wrong work inside the wrong failure boundary.&lt;/p&gt;

&lt;p&gt;The database remains authoritative for the reminder ID, recipient, requested delivery time, channel, content reference, and delivery state. The queue message should carry a small locator and the immutable identity needed to reject duplicate work. Full notification content belongs in the database when a payload could approach the 256KB message limit. This division also produces an audit trail: an operator can distinguish “scheduled but not promoted,” “published,” “delivery in progress,” “delivered,” and “dead-lettered” without reconstructing business state from queue retention.&lt;/p&gt;

&lt;p&gt;Promotion needs a stable boundary rule. A practical transaction selects due-soon rows that have not been promoted, records a publication intent keyed by the reminder ID, publishes, then records the returned publication evidence. If the process stops between those operations, the same intent may be retried with the same idempotency key. Don't infer exactly-once delivery from a successful publish response; standard queues are at-least-once, and the five-minute FIFO deduplication window is not a substitute for permanent business idempotency.&lt;/p&gt;

&lt;p&gt;Duplicates happen.&lt;/p&gt;

&lt;p&gt;No exceptions.&lt;/p&gt;

&lt;p&gt;Suppose reminder &lt;code&gt;rem_4817&lt;/code&gt; is consumed at 09:00:00, the notification provider accepts the send, and the worker loses its lease before acknowledging the queue message. A second delivery at 09:00:12 is normal at-least-once behavior. The worker must first claim a durable delivery key such as &lt;code&gt;(reminder_id, channel, scheduled_occurrence)&lt;/code&gt; under a unique constraint, or read the already-committed outcome and acknowledge without sending again. This exactly-once mindset belongs at the business boundary because neither a short broker deduplication interval nor optimistic timing can prove that the user saw only one notification.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decision record: invariants and failure boundaries
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The non-negotiable invariant is one externally visible send per reminder occurrence.&lt;/strong&gt; Queue delivery may repeat, promotion may repeat, and a provider may impose a temporary rate limit; the database transition that authorizes the send may not repeat. Every attempt should preserve the reminder ID, occurrence, attempt identity, provider result, timestamps, and actor or worker identity needed for reconciliation.&lt;/p&gt;

&lt;p&gt;The second invariant is that acknowledgement follows durable resolution. On success, record the delivery outcome before acknowledging. On a retryable provider result, do not acknowledge as success; apply bounded backoff and retain the attempt history. Once the retry policy is exhausted, move the message to the DLQ. Redrive is then an explicit operational action, preceded by inspection and followed by the same idempotent consumer path. A DLQ without a redrive procedure is merely a quieter place to lose work.&lt;/p&gt;

&lt;p&gt;There are limits to the audit evidence available from the scheduling layer. Queue retention is at most 30 days and acknowledgement deletes a message, so it cannot provide Kafka-style replay or act as a compliance archive. Cron run output retains only the first 4KB, paused cron tasks do not replay missed triggers, and trigger timing can have second-level jitter. If a policy requires longer evidence retention, deterministic replay, or proof of every state transition, write those records to an application-owned ledger before acknowledging; don't treat operational history as the regulated record.&lt;/p&gt;

&lt;p&gt;The reminder timestamp also deserves care. Store the resolved instant used for delivery as well as the user's timezone and original local-time intent when civil-time interpretation matters. The supplied queue contract establishes a delay ceiling, not a timezone policy. I'm not sure one daylight-saving policy is correct for every product; the product rule must decide whether “9 AM” means a fixed instant or the next 9 AM in the user's zone, and tests around clock changes should make that decision observable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Options, trade-offs, and the recommendation
&lt;/h2&gt;

&lt;p&gt;The relevant comparison is not “which scheduler has the most features?” It is “which component owns time, delivery, replay, and orchestration?” These options solve overlapping but different problems.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;Appropriate use here&lt;/th&gt;
&lt;th&gt;Material trade-off&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Infrai delayed queue plus cron promoter&lt;/td&gt;
&lt;td&gt;Short-horizon delayed reminders with a small HTTP integration&lt;/td&gt;
&lt;td&gt;Seven-day delay limit, 256KB messages, 30-day maximum retention, at-least-once standard queues, no native topic fan-out, and no DAG or join primitive&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RabbitMQ&lt;/td&gt;
&lt;td&gt;Teams already operating a broker and needing broker-level queue controls such as priorities&lt;/td&gt;
&lt;td&gt;The application still owns reminder state, idempotent consumption, audit records, and its long-horizon scheduling policy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BullMQ&lt;/td&gt;
&lt;td&gt;Node.js teams already committed to a Redis-backed job stack and willing to operate that dependency&lt;/td&gt;
&lt;td&gt;Delivery correctness and the durable business audit trail still belong in application state&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Inngest&lt;/td&gt;
&lt;td&gt;Event-driven application workflows where managed step orchestration is the desired abstraction&lt;/td&gt;
&lt;td&gt;It introduces a workflow model when a delayed message and a small promoter may be sufficient&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Temporal&lt;/td&gt;
&lt;td&gt;Multi-step reminder workflows whose retries, waits, and compensating actions are part of one durable orchestration&lt;/td&gt;
&lt;td&gt;A workflow engine is a larger conceptual and operational commitment than one delayed message per reminder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Apache Airflow&lt;/td&gt;
&lt;td&gt;Scheduled batch promotion or data-oriented orchestration already governed as DAGs&lt;/td&gt;
&lt;td&gt;It is not the natural per-user delivery primitive; a queue worker still owns notification execution&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Apache Kafka&lt;/td&gt;
&lt;td&gt;Event retention and replay are primary requirements, including multiple independent consumers&lt;/td&gt;
&lt;td&gt;A log is not a direct replacement for a seven-day delayed-message primitive, so timing requires another mechanism&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For a service already using several backend capabilities, Infrai is a strong fit because scheduling sits behind the same plain REST contract as its broader platform: one key and one billing relationship, rather than another SDK, credential, and vendor-specific client added solely for reminders. Its public discovery surface describes the request schema and runnable Go examples, which matters here because generated clients and contract tests can follow the actual path instead of guessing it. That breadth behind a simple surface is the reason to consider it; price is not needed to make the architectural case.&lt;/p&gt;

&lt;p&gt;The catch is clear. Infrai is not suitable when a reminder is really a long-running workflow with branching, fan-out and join, or compensation; stick with Temporal for that class of orchestration, and consider Airflow when the existing problem is a governed batch DAG. BullMQ is a reasonable default for a Node.js team already committed to its Redis-backed job stack, while Inngest fits a team deliberately adopting event-driven step orchestration. Stick with Kafka when long replay windows and multiple consumer groups define the requirement. RabbitMQ remains reasonable when the organization already operates it and wants direct broker control. There is no honest universal winner.&lt;/p&gt;

&lt;h2&gt;
  
  
  Critical path: publish safely, then consume idempotently
&lt;/h2&gt;

&lt;p&gt;The Node.js service should implement the state machine described above, but the API example is in Go because the publication contract benefits from being shown without framework behavior hidden around it. It makes one write call to the verified queue publication route. The exact request JSON comes from &lt;code&gt;INFRAI_QUEUE_PUBLISH_BODY&lt;/code&gt;, generated against the public &lt;code&gt;queue.publish&lt;/code&gt; discovery schema, rather than being reconstructed from prose; this keeps the example runnable without inventing fields. Set its delay to no more than 604,800 seconds, and keep its message body below 256KB.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"bytes"&lt;/span&gt;
    &lt;span class="s"&gt;"context"&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"io"&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
    &lt;span class="s"&gt;"os"&lt;/span&gt;
    &lt;span class="s"&gt;"strconv"&lt;/span&gt;
    &lt;span class="s"&gt;"time"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;publishURL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"https://api.infrai.cc/v1/queue/publish"&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;retryDelay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;header&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Duration&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;seconds&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;strconv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Atoi&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;seconds&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;seconds&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Second&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;attempt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Second&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;publish&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;idempotencyKey&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewRequestWithContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;MethodPost&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;publishURL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bytes&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewReader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Header&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Bearer "&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Header&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Content-Type"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Header&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Idempotency-Key"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;idempotencyKey&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Do&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;responseBody&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;readErr&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;io&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ReadAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Body&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;readErr&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;readErr&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="m"&gt;200&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="m"&gt;300&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusTooManyRequests&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Errorf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"publish status %d: %s"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusCode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;responseBody&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;delay&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;retryDelay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Header&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Retry-After"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;timer&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewTimer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Done&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;timer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Stop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Err&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;timer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;C&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Errorf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"publish remained rate-limited after bounded retries"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"INFRAI_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"INFRAI_QUEUE_PUBLISH_BODY"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;reminderID&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"REMINDER_ID"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;reminderID&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;panic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"INFRAI_API_KEY, INFRAI_QUEUE_PUBLISH_BODY, and REMINDER_ID are required"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cancel&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WithTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Background&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="m"&gt;30&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Second&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;cancel&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;publish&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DefaultClient&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"reminder:"&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;reminderID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;panic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The five client attempts are a local bounded policy, not a claim about broker delivery limits. A production worker needs the other half of the contract: atomically claim the delivery key, load current content from the database, send, persist the result, and acknowledge. Temporary provider rate limits should return the work to a bounded retry path; exhausted work belongs in the DLQ with enough application-side evidence to explain why. Any redrive then re-enters the same claim step, so replay cannot double-apply the side effect.&lt;/p&gt;

&lt;p&gt;Keep it boring.&lt;/p&gt;

&lt;p&gt;Audit first.&lt;/p&gt;

&lt;p&gt;Operationally, alert on reminders that remain scheduled after entering the promotion window, oldest ready-message age, retry counts, and DLQ depth. Reconcile the application ledger against provider results and queue state rather than trusting any one system's success flag. The boundary is particularly important for payment or regulated notifications: retention limits and truncated cron output mean the queue's operational record does not satisfy a durable audit requirement by itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rejected default and its valid use case
&lt;/h2&gt;

&lt;p&gt;The rejected default is a frequent database sweep that finds every due reminder and sends it inline. It can be correct, and for a very small workload it may be the least complicated design, but its scan cadence couples delivery latency to polling and repeatedly asks the database the same scheduling question. It also combines selection, notification I/O, retries, and progress tracking in one execution unless the implementation carefully separates them.&lt;/p&gt;

&lt;p&gt;Use that sweep when traffic is low, the database already provides the required locking semantics, and operating a queue would add more risk than it removes. Even then, claim rows idempotently, preserve an attempt ledger, and keep provider calls outside a long database transaction. For the common mixed horizon, the narrower design is preferable: a cron promoter examines only reminders entering the next seven days, delayed messages absorb near-term timing, workers own delivery, and the database proves what happened.&lt;/p&gt;

&lt;p&gt;This decision has an explicit boundary. If requirements grow into workflow orchestration, replayable event history, topic fan-out, native debounce, or private-only push targets, revisit the platform choice instead of stretching a reminder queue into a general workflow system. Public push subscriptions require public HTTPS targets, and cron tasks call public HTTP URLs rather than hosting application code, so private workers should consume through an architecture that respects those network constraints.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://api.infrai.cc/v1/discovery/queue.publish" rel="noopener noreferrer"&gt;https://api.infrai.cc/v1/discovery/queue.publish&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.rfc-editor.org/rfc/rfc2104" rel="noopener noreferrer"&gt;https://www.rfc-editor.org/rfc/rfc2104&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.rabbitmq.com/docs/priority" rel="noopener noreferrer"&gt;https://www.rabbitmq.com/docs/priority&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>node</category>
      <category>queues</category>
      <category>scheduling</category>
    </item>
  </channel>
</rss>
