<?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: Sanjay DI Solutions</title>
    <description>The latest articles on DEV Community by Sanjay DI Solutions (@sanjay_lagariya_66d756afc).</description>
    <link>https://dev.to/sanjay_lagariya_66d756afc</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%2F3756086%2Fdc5b0fc5-a230-4126-b9f0-0c008a62b5ea.jpg</url>
      <title>DEV Community: Sanjay DI Solutions</title>
      <link>https://dev.to/sanjay_lagariya_66d756afc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sanjay_lagariya_66d756afc"/>
    <language>en</language>
    <item>
      <title>WhatsApp Business App vs WhatsApp Business Platform: Which One Does Your Business Need?</title>
      <dc:creator>Sanjay DI Solutions</dc:creator>
      <pubDate>Thu, 03 Dec 2026 06:10:22 +0000</pubDate>
      <link>https://dev.to/sanjay_lagariya_66d756afc/whatsapp-business-app-vs-whatsapp-business-platform-which-one-does-your-business-need-mpd</link>
      <guid>https://dev.to/sanjay_lagariya_66d756afc/whatsapp-business-app-vs-whatsapp-business-platform-which-one-does-your-business-need-mpd</guid>
      <description>&lt;p&gt;The choice in &lt;strong&gt;WhatsApp Business App vs WhatsApp Business Platform&lt;/strong&gt; is not simply free versus paid. The two products are designed for different ways of running customer conversations.&lt;/p&gt;

&lt;p&gt;The WhatsApp Business app is a practical starting point when an owner or a small team can manage conversations directly from a phone and its supported linked devices. The WhatsApp Business Platform is an API-based foundation for businesses that need to connect WhatsApp to software, automate workflows, and manage conversations through a provider or their own integration.&lt;/p&gt;

&lt;p&gt;Neither is automatically better. The right option depends on how many people handle conversations, how much automation you need, and whether WhatsApp is becoming part of your core sales or support operation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The two products solve different business problems
&lt;/h2&gt;

&lt;p&gt;The WhatsApp Business app is an application that a business uses directly. It includes business-oriented tools such as a profile, product catalog, quick replies, labels and messaging features. It is intended to help businesses communicate without building an integration.&lt;/p&gt;

&lt;p&gt;The WhatsApp Business Platform is different: it provides APIs and related infrastructure that software can use to send and receive WhatsApp messages. Businesses typically access it directly through an integration or through a Business Solution Provider (BSP) platform. The Platform is not another standalone app with the same interface as the Business app.&lt;/p&gt;

&lt;p&gt;That distinction matters. A team inbox, CRM connection or automated workflow you see in a provider's dashboard is usually software built on top of the Platform, not a feature that appears automatically just because a business has API access.&lt;/p&gt;

&lt;p&gt;For Meta's product overview, start with &lt;a href="https://whatsappbusiness.com/resources/resource-library/whatsapp-vs-whatsapp-business/" rel="noopener noreferrer"&gt;WhatsApp's business product resources&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the WhatsApp Business app is good at
&lt;/h2&gt;

&lt;p&gt;For a small business, the app can cover a surprising amount of day-to-day work.&lt;/p&gt;

&lt;p&gt;It can be a sensible choice when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One person, or a small number of people using supported linked devices, handles most conversations.&lt;/li&gt;
&lt;li&gt;Customers mainly start conversations themselves.&lt;/li&gt;
&lt;li&gt;The business can respond manually without a complex routing process.&lt;/li&gt;
&lt;li&gt;Basic business information, quick replies, labels and catalog features are enough.&lt;/li&gt;
&lt;li&gt;There is no immediate need to connect messages to an order system, CRM or custom application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Consider a local repair shop. Customers ask for opening hours, share a photo of a product, request a quote and arrange a visit. If one person can handle those conversations comfortably, adopting an API platform may add cost and operational work without solving a real problem.&lt;/p&gt;

&lt;p&gt;The app's simplicity is an advantage. There is less integration work, and staff can start using it without designing a larger messaging system.&lt;/p&gt;

&lt;p&gt;But simplicity has limits. As volume and team size grow, manually coordinating ownership, follow-ups and customer context becomes harder. A business may find itself copying information between WhatsApp, spreadsheets and other tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the WhatsApp Business Platform adds
&lt;/h2&gt;

&lt;p&gt;The Platform gives businesses an API for connecting WhatsApp messaging to applications and operational workflows.&lt;/p&gt;

&lt;p&gt;Depending on the integration or provider, that can enable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Shared team inboxes:&lt;/strong&gt; Multiple agents work from a common view of conversations, with assignment and visibility into who is handling a chat.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CRM and commerce integrations:&lt;/strong&gt; Customer messages can be connected to lead, order or customer records.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automated workflows:&lt;/strong&gt; A business can acknowledge enquiries, collect information, qualify leads or route conversations based on rules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chatbots and human handoff:&lt;/strong&gt; Automated flows can handle predictable questions and pass more complex conversations to a person.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Programmatic messaging:&lt;/strong&gt; Systems can send relevant notifications and approved templates for use cases such as order updates or appointment reminders.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Operational reporting:&lt;/strong&gt; Teams can build workflows around assignment, response handling and conversation outcomes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These capabilities depend on the software connected to the API. API access alone does not guarantee a polished inbox, chatbot builder, analytics dashboard or integration with a particular CRM. Check what the provider actually includes.&lt;/p&gt;

&lt;p&gt;For example, an online store might connect order events to WhatsApp notifications, let customers ask questions about an order, and route unresolved questions to a support agent. That is a workflow built around the Platform and the store's systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  WhatsApp Business App vs WhatsApp Business Platform: a side-by-side comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Area&lt;/th&gt;
&lt;th&gt;Business app&lt;/th&gt;
&lt;th&gt;Business Platform&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;How you use it&lt;/td&gt;
&lt;td&gt;A WhatsApp application for the business&lt;/td&gt;
&lt;td&gt;APIs connected through software or a provider&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best starting point&lt;/td&gt;
&lt;td&gt;Owner-led and smaller operations&lt;/td&gt;
&lt;td&gt;Businesses with integration or automation needs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Team access&lt;/td&gt;
&lt;td&gt;App and supported linked-device capabilities&lt;/td&gt;
&lt;td&gt;Can support multi-agent workflows through an inbox provider or custom software&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Automation&lt;/td&gt;
&lt;td&gt;Built-in app tools and limited workflows&lt;/td&gt;
&lt;td&gt;API-driven automation, depending on the integration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CRM or order-system integration&lt;/td&gt;
&lt;td&gt;Usually more manual or dependent on separate tools&lt;/td&gt;
&lt;td&gt;Can be integrated through APIs and provider features&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Chatbots&lt;/td&gt;
&lt;td&gt;Not a full API-based chatbot environment&lt;/td&gt;
&lt;td&gt;Supports automated conversational experiences built by a provider or developer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Business-initiated messages&lt;/td&gt;
&lt;td&gt;App-specific broadcast and messaging features&lt;/td&gt;
&lt;td&gt;Approved templates and Platform messaging rules apply&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Setup&lt;/td&gt;
&lt;td&gt;Usually simpler&lt;/td&gt;
&lt;td&gt;Requires API onboarding and a provider or technical integration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Costs&lt;/td&gt;
&lt;td&gt;App use may be free, while some optional features or services can have charges&lt;/td&gt;
&lt;td&gt;Meta messaging charges and possible provider/software fees&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A few details deserve attention.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Multi-device access is not the same as a shared team inbox.&lt;/strong&gt; The Business app supports linked devices, and available capabilities can change. But a business that needs agent assignment, ownership, internal notes, routing and a consistent history across a support team should evaluate a purpose-built inbox rather than assume linked devices provide those controls.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Automation depends on the product layer.&lt;/strong&gt; A provider may offer a visual chatbot builder, but that is a provider feature built around the Platform. Ask to see the actual workflow builder and handoff process before buying.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Templates have rules.&lt;/strong&gt; Platform messages initiated by a business outside the customer service window generally require an approved message template. Template categories, eligibility and pricing rules can change, so verify current requirements in Meta's documentation and your WhatsApp Manager account.&lt;/p&gt;

&lt;h2&gt;
  
  
  Costs and setup considerations
&lt;/h2&gt;

&lt;p&gt;The Business app is often the lower-friction option because there may be no API provider subscription or integration project to start with. That does not mean every business feature is necessarily free in every market; check the current terms and availability for your region.&lt;/p&gt;

&lt;p&gt;With the Business Platform, separate the cost into two parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Meta messaging charges:&lt;/strong&gt; Charges determined by Meta's current pricing rules and the type and destination of the message.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Provider or software charges:&lt;/strong&gt; A BSP or platform may charge for its inbox, automation builder, integrations, support or subscription plan.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ask providers to show these amounts separately. Also ask whether they pass Meta charges through, add a markup, charge per user, or impose usage limits. Pricing models differ, and a headline monthly subscription rarely tells the full story.&lt;/p&gt;

&lt;p&gt;There can also be setup work: verifying the business, configuring the WhatsApp Business Account, connecting a number, creating templates, integrating systems and training agents. If you are migrating an existing number, ask how number eligibility, history, coexistence and downtime are handled for your specific account. Do not assume every migration path has identical requirements.&lt;/p&gt;

&lt;p&gt;Meta periodically changes product capabilities and commercial terms. Use the current &lt;a href="https://whatsappbusiness.com/" rel="noopener noreferrer"&gt;WhatsApp Business resources&lt;/a&gt; and your provider's written pricing schedule rather than relying on an old comparison article.&lt;/p&gt;

&lt;h2&gt;
  
  
  When should you stay on the app?
&lt;/h2&gt;

&lt;p&gt;Stay with the Business app if it is meeting the business's actual needs.&lt;/p&gt;

&lt;p&gt;It is likely enough when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Conversation volume is manageable.&lt;/li&gt;
&lt;li&gt;A single owner or a small team can respond consistently.&lt;/li&gt;
&lt;li&gt;You do not need automated routing or deep system integrations.&lt;/li&gt;
&lt;li&gt;Manual follow-ups are not causing missed leads or support issues.&lt;/li&gt;
&lt;li&gt;You want to keep operations simple while validating demand.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do not move to the Platform just because the business is growing in general. Move when you can identify a messaging problem that the API and connected software will solve.&lt;/p&gt;

&lt;h2&gt;
  
  
  When is it time to move to the Platform?
&lt;/h2&gt;

&lt;p&gt;Consider the Business Platform when one or more of these problems become persistent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Several agents need to handle conversations without replying over one another.&lt;/li&gt;
&lt;li&gt;Leads are being missed because nobody owns the next follow-up.&lt;/li&gt;
&lt;li&gt;Support agents repeatedly ask customers for information already stored in another system.&lt;/li&gt;
&lt;li&gt;You need order updates, appointment reminders or other event-triggered messages.&lt;/li&gt;
&lt;li&gt;A chatbot should answer routine questions and hand off exceptions to a person.&lt;/li&gt;
&lt;li&gt;You need reporting or operational controls beyond what the app provides.&lt;/li&gt;
&lt;li&gt;WhatsApp is an important channel across marketing, sales and support, and manual processes are becoming unreliable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A useful test: write down the last ten conversations that were delayed, duplicated or lost. If most problems come from coordination or missing integrations, an API-based workflow may be justified. If the problems are simply that the team needs better response habits, a more complex platform may not fix them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Questions to ask before choosing a provider
&lt;/h2&gt;

&lt;p&gt;If you decide the Platform is appropriate, compare providers on the work your team needs to do—not just the number of features on a pricing page.&lt;/p&gt;

&lt;p&gt;Ask:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Can multiple agents use one inbox with clear assignment and conversation ownership?&lt;/li&gt;
&lt;li&gt;Can supervisors see the conversation history and reassign work?&lt;/li&gt;
&lt;li&gt;How does the system prevent duplicate replies when two agents open the same chat?&lt;/li&gt;
&lt;li&gt;Can a bot hand a conversation to a human without losing context?&lt;/li&gt;
&lt;li&gt;Which CRM, commerce and help-desk integrations are included, and which require custom work?&lt;/li&gt;
&lt;li&gt;How are templates created, reviewed and managed?&lt;/li&gt;
&lt;li&gt;Can you export your data and leave the provider without losing control of your business account?&lt;/li&gt;
&lt;li&gt;What exactly will Meta charge, what will the provider charge, and are there per-agent or usage fees?&lt;/li&gt;
&lt;li&gt;What happens to your existing number during migration, and what support is available if something goes wrong?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Get answers in writing. A demo should show the real workflow, not just a slide listing integrations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using the Platform with WAPGROWAI
&lt;/h2&gt;

&lt;p&gt;For businesses that have outgrown a single-app workflow, WAPGROWAI brings WhatsApp marketing, sales, support, chatbots and team inbox workflows together in one platform. Its visual no-code flow builder is designed to help teams create automated conversations, while the shared inbox helps agents manage customer interactions.&lt;/p&gt;

&lt;p&gt;The right setup still depends on your use case: a business that only needs occasional manual replies may not need a full automation platform. If you do need campaigns, automated flows and coordinated team conversations, review the &lt;a href="https://www.wpautoai.com/solutions/developers" rel="noopener noreferrer"&gt;WAPGROWAI platform overview&lt;/a&gt; and compare its features with your requirements.&lt;/p&gt;

&lt;h2&gt;
  
  
  The decision in one sentence
&lt;/h2&gt;

&lt;p&gt;Choose the WhatsApp Business app when direct, mostly manual conversations are enough; choose the WhatsApp Business Platform when your business needs API integrations, structured team workflows or automation that the app alone cannot provide.&lt;/p&gt;

&lt;p&gt;Start with the problem you need to solve. The best choice is the simplest setup that lets your team respond reliably today without creating unnecessary complexity.&lt;/p&gt;

</description>
      <category>whatsapp</category>
      <category>business</category>
      <category>automation</category>
      <category>beginners</category>
    </item>
    <item>
      <title>WhatsApp Marketing Campaigns: How to Protect Your Number and Keep Customers Engaged</title>
      <dc:creator>Sanjay DI Solutions</dc:creator>
      <pubDate>Thu, 03 Dec 2026 04:54:02 +0000</pubDate>
      <link>https://dev.to/sanjay_lagariya_66d756afc/whatsapp-marketing-campaigns-how-to-protect-your-number-and-keep-customers-engaged-40n6</link>
      <guid>https://dev.to/sanjay_lagariya_66d756afc/whatsapp-marketing-campaigns-how-to-protect-your-number-and-keep-customers-engaged-40n6</guid>
      <description>&lt;h1&gt;
  
  
  WhatsApp Marketing Campaigns: How to Protect Your Number and Keep Customers Engaged
&lt;/h1&gt;

&lt;p&gt;WhatsApp marketing campaigns can be useful because they reach customers in a conversation space they already use. But a message that feels helpful to a business can feel like spam to the person receiving it.&lt;/p&gt;

&lt;p&gt;That gap is where campaign performance and account quality start to suffer. Sending more messages is not the same as creating more demand. Unwanted promotions, unclear consent, irrelevant offers and excessive frequency can lead people to block or report a business. Repeated policy violations can also result in messaging restrictions.&lt;/p&gt;

&lt;p&gt;The goal is not to find a trick that guarantees your number will never be restricted. No checklist can promise that. The goal is to build campaigns customers expect, find useful and can easily stop receiving.&lt;/p&gt;

&lt;p&gt;This guide focuses on practical WhatsApp broadcast best practices for businesses using the WhatsApp Business Platform, while explaining where the WhatsApp Business app is different.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why WhatsApp marketing campaigns run into trouble
&lt;/h2&gt;

&lt;p&gt;Most campaign problems start before the message is sent.&lt;/p&gt;

&lt;p&gt;Common causes include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unclear permission:&lt;/strong&gt; A person shared a phone number for an order, but was never told they would receive promotions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Irrelevant messages:&lt;/strong&gt; Every contact receives the same offer, regardless of what they bought or asked about.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Too many messages:&lt;/strong&gt; Several teams or tools contact the same person without coordinating frequency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Misleading content:&lt;/strong&gt; The message promises something the landing page, offer or business cannot deliver.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No simple opt-out:&lt;/strong&gt; People have to explain themselves or contact support to stop promotional messages.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Meta's guidance emphasizes expected, relevant messaging, clear opt-in experiences, honoring opt-outs and monitoring negative feedback. It also identifies unsolicited broadcasts, low-quality messages and attempts to avoid limits by using multiple numbers as common problems. Read the &lt;a href="https://whatsappbusiness.com/policy/" rel="noopener noreferrer"&gt;WhatsApp Business Messaging Policy&lt;/a&gt; and Meta's &lt;a href="https://business.facebook.com/business/learn/lessons/whatsapp-business-policy-compliance" rel="noopener noreferrer"&gt;business messaging best practices&lt;/a&gt; before designing a campaign.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Build a clear opt-in before adding contacts
&lt;/h2&gt;

&lt;p&gt;A phone number in your customer database is not automatically permission to send every kind of WhatsApp message.&lt;/p&gt;

&lt;p&gt;Explain what someone is signing up for, identify your business and set expectations about the type and frequency of messages. For example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Get occasional product updates and special offers from Example Store on WhatsApp. We usually send up to four messages per month. Reply STOP at any time to stop promotional messages.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The wording should match what you actually plan to send. If someone agrees to receive delivery updates, do not silently treat that as consent to receive weekly discounts.&lt;/p&gt;

&lt;p&gt;Useful places to collect preferences include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A checkout checkbox with clear, optional promotional wording.&lt;/li&gt;
&lt;li&gt;A website form that explains the messages and expected frequency.&lt;/li&gt;
&lt;li&gt;An in-store QR code that opens a WhatsApp opt-in flow.&lt;/li&gt;
&lt;li&gt;A customer preference page where people can choose updates, offers or product announcements.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep a record of when and where the person subscribed, what they agreed to receive, and any later changes. Follow applicable privacy and marketing laws in the countries where you operate; WhatsApp policy compliance does not replace legal compliance.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Segment your audience instead of sending everything to everyone
&lt;/h2&gt;

&lt;p&gt;A single large contact list is easy to broadcast to, but it is rarely the best audience for every campaign.&lt;/p&gt;

&lt;p&gt;Start with a few useful segments:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Segment&lt;/th&gt;
&lt;th&gt;Relevant message&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Recent buyers&lt;/td&gt;
&lt;td&gt;Product care, setup help or complementary products&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Interested shoppers&lt;/td&gt;
&lt;td&gt;A product update related to what they viewed or asked about&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Repeat customers&lt;/td&gt;
&lt;td&gt;Loyalty benefits or relevant new arrivals&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lapsed customers&lt;/td&gt;
&lt;td&gt;A thoughtful return offer, if they still want promotions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;High-intent enquiries&lt;/td&gt;
&lt;td&gt;A useful answer or follow-up related to their request&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Use data you have a legitimate reason to use, and avoid making sensitive or intrusive assumptions about customers.&lt;/p&gt;

&lt;p&gt;Segmentation is not just about personalization tokens such as a first name. It is about whether the message is appropriate for that person's relationship with your business.&lt;/p&gt;

&lt;p&gt;For example, a customer who bought running shoes may appreciate an update about new running accessories. Sending that person an unrelated kitchen-appliance promotion simply because they are on the list adds little value.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Make each campaign useful and easy to understand
&lt;/h2&gt;

&lt;p&gt;A good marketing message answers three questions quickly:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Why am I receiving this?&lt;/li&gt;
&lt;li&gt;What is useful or relevant here?&lt;/li&gt;
&lt;li&gt;What can I do next?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A practical structure is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Context:&lt;/strong&gt; Remind the customer why the message is relevant.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Value:&lt;/strong&gt; Explain the offer, update or benefit in plain language.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Action:&lt;/strong&gt; Give one clear next step.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Choice:&lt;/strong&gt; Make it easy to manage or stop promotional messages.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You asked us about lightweight running shoes last week. Our new collection is now available in your size range. View the collection: [link]. Reply STOP if you no longer want product offers on WhatsApp.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Avoid fake urgency, vague claims, excessive capitalization and repeated follow-ups. Make sure the landing page matches the message and that the offer's conditions are clear.&lt;/p&gt;

&lt;p&gt;On the WhatsApp Business Platform, businesses generally initiate conversations using approved message templates. Templates must be used for their approved purpose and comply with current policy. A template approval is not a guarantee that customers will find the message relevant or that a campaign will perform well.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Choose a frequency customers can live with
&lt;/h2&gt;

&lt;p&gt;There is no universal number of WhatsApp marketing messages that is right for every business. The appropriate cadence depends on what people agreed to receive, the usefulness of the content, the customer's recent interactions and the limits or controls applied by WhatsApp.&lt;/p&gt;

&lt;p&gt;A sensible starting approach:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set a frequency expectation during opt-in.&lt;/li&gt;
&lt;li&gt;Start conservatively rather than sending several promotions immediately.&lt;/li&gt;
&lt;li&gt;Coordinate campaigns across marketing, sales and support teams.&lt;/li&gt;
&lt;li&gt;Avoid sending the same promotion through multiple numbers.&lt;/li&gt;
&lt;li&gt;Give inactive recipients a break instead of repeatedly trying to get their attention.&lt;/li&gt;
&lt;li&gt;Review opt-outs, blocks, reports and engagement after each campaign.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Meta also applies controls intended to limit the number of marketing messages people receive. Businesses should design around customer expectations and the platform's current rules, not try to work around those controls.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Monitor quality signals, not just delivery
&lt;/h2&gt;

&lt;p&gt;A campaign dashboard that only shows how many messages were sent is incomplete.&lt;/p&gt;

&lt;p&gt;Track a combination of delivery, engagement and negative feedback:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;What to learn&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Sent and delivered&lt;/td&gt;
&lt;td&gt;Are messages reaching recipients?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Read rate&lt;/td&gt;
&lt;td&gt;Are people opening the messages?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Click-through rate&lt;/td&gt;
&lt;td&gt;Is the content motivating the intended action?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Replies and conversions&lt;/td&gt;
&lt;td&gt;Are people responding or completing the goal?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Opt-outs&lt;/td&gt;
&lt;td&gt;Is the audience asking for fewer messages?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Blocks or reports&lt;/td&gt;
&lt;td&gt;Are people finding the messages unwanted?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Template and phone-number quality&lt;/td&gt;
&lt;td&gt;Are there warnings or quality changes that need attention?&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Look at trends by campaign and audience segment. A falling read rate alone does not prove a policy issue, but a sudden rise in opt-outs or negative feedback is a reason to pause and investigate.&lt;/p&gt;

&lt;p&gt;WhatsApp's marketing guidance recommends reviewing quality history, investigating changes in sending volume and template usage, and testing new use cases gradually. See the official &lt;a href="https://whatsappbusiness.com/wp-content/uploads/2026/04/Best-Practices-for-Marketing-Messages-on-WhatsApp-.pdf" rel="noopener noreferrer"&gt;Best Practices for Marketing Messages on WhatsApp&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. What to do when delivery or quality drops
&lt;/h2&gt;

&lt;p&gt;Do not respond to a warning by immediately moving the same campaign to another number. Meta specifically identifies using multiple numbers to avoid message limits as a problematic practice.&lt;/p&gt;

&lt;p&gt;Instead:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pause or reduce the campaign that may be causing the issue.&lt;/li&gt;
&lt;li&gt;Review the audience source and confirm that recipients expected that category of message.&lt;/li&gt;
&lt;li&gt;Check whether opt-outs are being processed promptly across every sending workflow.&lt;/li&gt;
&lt;li&gt;Review the message, offer, landing page and template purpose for misleading or irrelevant content.&lt;/li&gt;
&lt;li&gt;Compare recent volume and engagement with the period before the quality change.&lt;/li&gt;
&lt;li&gt;Make one controlled change, then monitor the result before scaling again.&lt;/li&gt;
&lt;li&gt;Follow the account or template guidance shown in WhatsApp Manager and contact your Business Solution Provider when you need help interpreting an issue.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Do not purchase contact lists, rotate numbers to continue unwanted outreach or keep resending messages that recipients are ignoring. Those tactics do not fix the underlying customer-experience problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. WhatsApp Business app broadcasts vs the Business Platform
&lt;/h2&gt;

&lt;p&gt;The WhatsApp Business app and WhatsApp Business Platform are different products, so their broadcast workflows and controls should not be treated as interchangeable.&lt;/p&gt;

&lt;p&gt;The Business app is designed for businesses managing conversations directly in the app. Meta has introduced paid business broadcast capabilities for the app in some markets.&lt;/p&gt;

&lt;p&gt;The Business Platform is API-based and is designed to connect messaging to business systems, workflows and team operations. It uses approved templates for business-initiated messages outside the customer service window, and supports integrations and automation through the API.&lt;/p&gt;

&lt;p&gt;If you are evaluating a platform, check how it handles contact permissions, template management, segmentation, opt-outs, message analytics, team access and handoff to human agents. Also understand the difference between Meta's messaging charges and any software or provider fees.&lt;/p&gt;

&lt;h2&gt;
  
  
  A pre-send checklist for marketing teams
&lt;/h2&gt;

&lt;p&gt;Before launching a WhatsApp marketing campaign, confirm:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Recipients have agreed to receive this type of message.&lt;/li&gt;
&lt;li&gt;[ ] The business name and purpose of the subscription are clear.&lt;/li&gt;
&lt;li&gt;[ ] The audience segment is relevant to the campaign.&lt;/li&gt;
&lt;li&gt;[ ] The message is accurate and the landing page matches the offer.&lt;/li&gt;
&lt;li&gt;[ ] The template is approved and used for its intended purpose, where required.&lt;/li&gt;
&lt;li&gt;[ ] Frequency is consistent with what customers were told and current platform controls.&lt;/li&gt;
&lt;li&gt;[ ] Opt-outs are easy and are applied across connected systems.&lt;/li&gt;
&lt;li&gt;[ ] Someone is monitoring delivery, engagement and quality feedback.&lt;/li&gt;
&lt;li&gt;[ ] The team knows when to pause a campaign and investigate.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Running campaigns with WAPGROWAI
&lt;/h2&gt;

&lt;p&gt;WAPGROWAI brings WhatsApp campaigns together with automation and team inbox workflows. That can help a business coordinate campaign activity with customer conversations instead of treating broadcasts as an isolated sending task.&lt;/p&gt;

&lt;p&gt;A useful setup should make it easier to organize audiences, manage campaign workflows, connect replies to the right team and keep customer conversations visible. The business still needs to collect appropriate permissions, follow Meta's policies and monitor the experience recipients receive.&lt;/p&gt;

&lt;p&gt;Explore &lt;a href="https://www.wpautoai.com/solutions/developers" rel="noopener noreferrer"&gt;WAPGROWAI's WhatsApp automation platform&lt;/a&gt; to see how campaigns, automation and customer conversations can fit into one workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;Healthy WhatsApp marketing is built on relevance and trust, not on sending the largest possible number of messages.&lt;/p&gt;

&lt;p&gt;Start with clear expectations, send to the right audience, keep the content useful, respect opt-outs and monitor feedback. If quality drops, investigate the campaign and its audience rather than trying to bypass platform controls.&lt;/p&gt;

&lt;p&gt;The best campaign is not the one that reaches every contact. It is the one that gives the right customers a good reason to hear from your business.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;WAPGROWAI is built by &lt;a href="https://disolutions.net" rel="noopener noreferrer"&gt;DI Solutions&lt;/a&gt;, a custom software and AI development company.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>whatsapp</category>
      <category>marketing</category>
      <category>business</category>
      <category>automation</category>
    </item>
    <item>
      <title>COD Order Verification on WhatsApp: Prevent Fake Orders Before They Ship</title>
      <dc:creator>Sanjay DI Solutions</dc:creator>
      <pubDate>Wed, 02 Dec 2026 10:24:44 +0000</pubDate>
      <link>https://dev.to/sanjay_lagariya_66d756afc/cod-order-verification-on-whatsapp-prevent-fake-orders-before-they-ship-5pk</link>
      <guid>https://dev.to/sanjay_lagariya_66d756afc/cod-order-verification-on-whatsapp-prevent-fake-orders-before-they-ship-5pk</guid>
      <description>&lt;h1&gt;
  
  
  COD Order Verification on WhatsApp: Prevent Fake Orders Before They Ship
&lt;/h1&gt;

&lt;p&gt;Cash on delivery (COD) removes one barrier to buying online: customers can place an order without paying upfront. But it creates a different problem for the store.&lt;/p&gt;

&lt;p&gt;A customer places an order, the merchant packs it, the courier attempts delivery, and the customer refuses to accept it. Sometimes the phone number is wrong. Sometimes the customer forgot placing the order. Sometimes it was an accidental or intentionally fake order.&lt;/p&gt;

&lt;p&gt;The parcel returns to the seller, but the shipping and handling costs do not simply disappear.&lt;/p&gt;

&lt;p&gt;For stores with a high volume of COD orders, manually calling every customer is difficult to scale. WhatsApp can help verify intent before fulfillment—but only if the workflow is designed carefully.&lt;/p&gt;

&lt;p&gt;This guide walks through a practical COD verification system using Shopify webhooks, WhatsApp messages, and an order-processing workflow.&lt;/p&gt;

&lt;p&gt;The goal is not to eliminate every return-to-origin (RTO) shipment. No confirmation flow can guarantee that. The goal is to identify avoidable problems earlier, give genuine customers a simple way to confirm, and make uncertain orders visible to the team.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why COD orders become expensive
&lt;/h2&gt;

&lt;p&gt;A COD order is not necessarily a confirmed purchase in the same way as a prepaid order. The customer has expressed buying intent, but payment and acceptance happen later.&lt;/p&gt;

&lt;p&gt;That creates several failure points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Incorrect contact details:&lt;/strong&gt; The delivery team cannot reach the customer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accidental orders:&lt;/strong&gt; A customer submits checkout more than once or selects COD unintentionally.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Changed purchase intent:&lt;/strong&gt; The customer no longer wants the product by the time it arrives.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unclear delivery expectations:&lt;/strong&gt; The customer is unavailable or does not recognize the package.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fraudulent or low-intent orders:&lt;/strong&gt; Someone submits an order without a genuine intention to receive it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The cost is bigger than the returned parcel. Teams spend time packing, dispatching, tracking, contacting customers, handling returns, and putting inventory back into stock.&lt;/p&gt;

&lt;p&gt;The exact cost varies by product, courier, geography, and store policy. Measure it using your own order and logistics data rather than relying on a generic RTO percentage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why calling every customer does not scale
&lt;/h2&gt;

&lt;p&gt;A manual confirmation process can work when a store receives a small number of orders. As volume grows, it becomes an operational queue:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;An order arrives.&lt;/li&gt;
&lt;li&gt;Someone checks whether it is COD.&lt;/li&gt;
&lt;li&gt;An agent calls the customer.&lt;/li&gt;
&lt;li&gt;The agent records the response.&lt;/li&gt;
&lt;li&gt;The order is updated in the store.&lt;/li&gt;
&lt;li&gt;The fulfillment team checks the updated status.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Every handoff creates room for delay or mistakes. A customer may confirm on the phone, but the order can still be marked unverified if the agent forgets to update the system.&lt;/p&gt;

&lt;p&gt;WhatsApp automation can make the first confirmation step faster and more consistent. It should not remove the option for a person to review an unusual order.&lt;/p&gt;

&lt;h2&gt;
  
  
  The workflow: verify before fulfillment
&lt;/h2&gt;

&lt;p&gt;A practical flow has six stages.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Detect a new COD order
&lt;/h3&gt;

&lt;p&gt;When Shopify creates an order, your integration receives an order webhook. The application checks the payment method and determines whether the order needs verification.&lt;/p&gt;

&lt;p&gt;Do not trigger the flow for every order. Prepaid orders, test orders, cancelled orders, and orders that have already entered fulfillment may need different handling.&lt;/p&gt;

&lt;p&gt;A simplified order check might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;Order&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;financial_status&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;gateway&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&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;span class="n"&gt;fulfillment_status&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&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;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;needsCodVerification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;isCashOnDelivery&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gateway&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;gateway&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
      &lt;span class="n"&gt;gateway&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&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;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"cash on delivery"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;isUnpaid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;financial_status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"pending"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;isNotFulfilled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fulfillment_status&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;isCashOnDelivery&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;isUnpaid&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;isNotFulfilled&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;This is illustrative logic, not a universal Shopify COD detector. Payment gateway names and order fields depend on the store's configuration and the API version. Inspect real webhook payloads from your store and map its COD method explicitly.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Validate and store the webhook event
&lt;/h3&gt;

&lt;p&gt;Webhook delivery is not a one-time guarantee. Providers can retry events, and your endpoint can receive the same event more than once.&lt;/p&gt;

&lt;p&gt;Before sending a customer a message:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify the webhook signature using the unmodified request body.&lt;/li&gt;
&lt;li&gt;Store the provider's event ID or another stable event identifier.&lt;/li&gt;
&lt;li&gt;Enforce a unique constraint so the same event is not processed twice.&lt;/li&gt;
&lt;li&gt;Return a successful response promptly, then process the event asynchronously.&lt;/li&gt;
&lt;li&gt;Fetch the latest order state before making a fulfillment decision.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A minimal event table could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;processed_webhooks&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;provider_event_id&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;order_id&lt;/span&gt;          &lt;span class="kt"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;received_at&lt;/span&gt;       &lt;span class="kt"&gt;TIMESTAMP&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="kc"&gt;CURRENT_TIMESTAMP&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 unique key protects against duplicate event processing. It does not, by itself, protect against two different events attempting to start the same verification flow. Keep a separate verification record with a unique key for the order and workflow version.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Send a clear WhatsApp confirmation
&lt;/h3&gt;

&lt;p&gt;Once the order qualifies, send a concise message with the important details:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hi {{customer_name}}, thanks for your order!&lt;/p&gt;

&lt;p&gt;Order: #{{order_number}}&lt;br&gt;&lt;br&gt;
Total: {{order_total}}&lt;br&gt;&lt;br&gt;
Payment: Cash on Delivery&lt;/p&gt;

&lt;p&gt;Would you like us to process this order?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Offer clear actions such as &lt;strong&gt;Confirm order&lt;/strong&gt; and &lt;strong&gt;Cancel order&lt;/strong&gt; using a supported WhatsApp interactive message or approved template with quick-reply buttons.&lt;/p&gt;

&lt;p&gt;If the business is initiating the conversation outside the 24-hour customer service window, it generally needs an approved message template. A new order does not automatically remove that requirement. Use the appropriate approved template and follow WhatsApp's current messaging policies.&lt;/p&gt;

&lt;p&gt;Keep the message transactional. Do not turn an order confirmation into an unsolicited promotional campaign.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Handle the customer's response
&lt;/h3&gt;

&lt;p&gt;The buttons are only useful if the response changes the order workflow reliably.&lt;/p&gt;

&lt;p&gt;A simple state model is:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;State&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;th&gt;Next action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;pending_verification&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Message not yet confirmed&lt;/td&gt;
&lt;td&gt;Wait or retry according to policy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;confirmed&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Customer confirmed&lt;/td&gt;
&lt;td&gt;Recheck order, then allow fulfillment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cancel_requested&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Customer requested cancellation&lt;/td&gt;
&lt;td&gt;Apply store cancellation policy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;no_response&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;No answer before the deadline&lt;/td&gt;
&lt;td&gt;Keep out of automatic fulfillment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;needs_review&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Response or order is ambiguous&lt;/td&gt;
&lt;td&gt;Send to a person&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Treat a button response as an input, not as permission to blindly change every order field.&lt;/p&gt;

&lt;p&gt;For example, if a customer confirms after an agent has already cancelled the order, the system should not silently reopen it. Fetch the current order state and apply an explicit transition rule.&lt;/p&gt;

&lt;p&gt;A response handler can be kept simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;VerificationReply&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"confirm"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"cancel"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;VerificationState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"pending_verification"&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"confirmed"&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"cancel_requested"&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"no_response"&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"needs_review"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;nextState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;current&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;VerificationState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;reply&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;VerificationReply&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;VerificationState&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;current&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s2"&gt;"pending_verification"&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="s2"&gt;"needs_review"&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;reply&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"confirm"&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"confirmed"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"cancel_requested"&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;In production, persist transitions transactionally and record the inbound WhatsApp message ID. That prevents duplicate webhook deliveries from applying the same action more than once.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Update Shopify and notify fulfillment
&lt;/h3&gt;

&lt;p&gt;After a valid confirmation:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fetch the latest Shopify order.&lt;/li&gt;
&lt;li&gt;Check that it is still eligible for fulfillment.&lt;/li&gt;
&lt;li&gt;Record the confirmation time and message reference in your application.&lt;/li&gt;
&lt;li&gt;Update the appropriate order metadata or tags.&lt;/li&gt;
&lt;li&gt;Make the order available to the fulfillment process.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For example, a store might use tags such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;COD-Confirmed&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;COD-Cancel-Requested&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;COD-Needs-Review&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Choose one source of truth for verification status. If the application database stores the workflow state and Shopify stores a searchable tag, make sure updates are synchronized and failures can be retried safely.&lt;/p&gt;

&lt;p&gt;A confirmation should not automatically mark an order as paid, fulfilled, or shipped. The customer has confirmed their intent to receive the order; they have not paid for it yet.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Decide what to do when the customer does not respond
&lt;/h3&gt;

&lt;p&gt;No response is not the same as a cancellation.&lt;/p&gt;

&lt;p&gt;A sensible policy could be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Send the initial confirmation message.&lt;/li&gt;
&lt;li&gt;Wait for a defined period based on the store's dispatch schedule.&lt;/li&gt;
&lt;li&gt;Send one permitted reminder if appropriate.&lt;/li&gt;
&lt;li&gt;Move the order to a review queue if there is still no response.&lt;/li&gt;
&lt;li&gt;Release or cancel it only under a clearly communicated store policy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Avoid sending repeated reminders. They can annoy customers and undermine the purpose of verification.&lt;/p&gt;

&lt;p&gt;Also consider the time between confirmation and dispatch. If an order is confirmed on Monday but not shipped until Friday, the original confirmation may no longer reflect the customer's intent. High-value or delayed orders may need a second check.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make verification smarter without making it unfair
&lt;/h2&gt;

&lt;p&gt;A confirmation button is a useful first filter, but it is not a fraud-detection system. A person can confirm an order and still refuse delivery later.&lt;/p&gt;

&lt;p&gt;You can improve the workflow with additional signals:&lt;/p&gt;

&lt;h3&gt;
  
  
  Detect duplicate orders
&lt;/h3&gt;

&lt;p&gt;Look for multiple recent orders with the same phone number, similar products, and matching delivery details. Do not automatically label every repeat order as fraudulent—families and legitimate repeat customers may share details.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use order history carefully
&lt;/h3&gt;

&lt;p&gt;A store may consider previous successful deliveries, cancellations, and refused shipments when deciding which orders need manual review.&lt;/p&gt;

&lt;p&gt;Keep the rules transparent to staff. Avoid using one failed delivery as a permanent reason to block a customer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prioritize higher-risk orders for review
&lt;/h3&gt;

&lt;p&gt;A review score can combine signals such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Missing or invalid contact information.&lt;/li&gt;
&lt;li&gt;Several orders placed within a short period.&lt;/li&gt;
&lt;li&gt;Conflicting delivery details.&lt;/li&gt;
&lt;li&gt;A history of refused COD deliveries.&lt;/li&gt;
&lt;li&gt;An unusually high order value for the store.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Start with explainable rules. Do not let an opaque score automatically cancel orders without a review and appeal path.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keep inventory consistent
&lt;/h3&gt;

&lt;p&gt;Do not reserve stock indefinitely while waiting for a response. Define when inventory is reserved, released, or returned to available stock. Make those operations idempotent so duplicate events do not reserve or release the same stock twice.&lt;/p&gt;

&lt;h2&gt;
  
  
  What should you measure?
&lt;/h2&gt;

&lt;p&gt;Measure the workflow before deciding whether it is working. A useful dashboard includes:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;What it tells you&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Verification delivery rate&lt;/td&gt;
&lt;td&gt;Whether confirmation messages are reaching customers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Response rate&lt;/td&gt;
&lt;td&gt;How many customers respond&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Confirmation rate&lt;/td&gt;
&lt;td&gt;How many eligible orders are confirmed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cancellation rate&lt;/td&gt;
&lt;td&gt;How many customers cancel before dispatch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No-response rate&lt;/td&gt;
&lt;td&gt;How many orders remain unconfirmed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RTO rate&lt;/td&gt;
&lt;td&gt;How many dispatched orders return to origin&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost per delivered COD order&lt;/td&gt;
&lt;td&gt;Whether the process improves unit economics&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Compare similar periods and order segments. For example, compare COD orders with the verification workflow against a suitable historical baseline, while accounting for changes in products, courier partners, geography, and seasonality.&lt;/p&gt;

&lt;p&gt;A higher confirmation rate is not automatically proof of lower RTO. The metric that matters commercially is whether the process improves successful deliveries and reduces avoidable fulfillment costs without creating unnecessary cancellations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Automating the workflow with WAPGROWAI
&lt;/h2&gt;

&lt;p&gt;WAPGROWAI brings WhatsApp automation, chatbot workflows, team inbox functionality, and e-commerce tools together. For a Shopify store, a COD verification workflow can connect order events to WhatsApp conversations and route uncertain cases to a human team.&lt;/p&gt;

&lt;p&gt;A practical setup should let the business:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Trigger a workflow when an eligible COD order is created.&lt;/li&gt;
&lt;li&gt;Send a transactional confirmation message.&lt;/li&gt;
&lt;li&gt;Process customer replies and update the verification state.&lt;/li&gt;
&lt;li&gt;Keep unanswered or ambiguous orders visible to the team.&lt;/li&gt;
&lt;li&gt;Connect the conversation to the relevant customer and order.&lt;/li&gt;
&lt;li&gt;Track outcomes so the merchant can evaluate the workflow.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The important part is not simply sending a WhatsApp message. It is connecting the customer's response to the order lifecycle, while preserving a safe manual review path.&lt;/p&gt;

&lt;p&gt;You can explore &lt;a href="https://www.wpautoai.com/solutions/developers" rel="noopener noreferrer"&gt;WAPGROWAI&lt;/a&gt; to see how WhatsApp automation can fit into business workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;COD verification is not about forcing every customer to respond before they can buy. It is about giving customers a convenient way to confirm their intent and giving merchants better information before they spend money on fulfillment.&lt;/p&gt;

&lt;p&gt;Start with a small workflow: detect eligible COD orders, send one clear confirmation message, record the response, and keep uncertain orders out of automatic fulfillment. Add duplicate detection, risk signals, and analytics only after the basic process is reliable.&lt;/p&gt;

&lt;p&gt;The best system is not the one that cancels the most orders. It is the one that helps genuine orders reach customers while reducing avoidable shipping and operational costs.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;WAPGROWAI is built by &lt;a href="https://disolutions.net" rel="noopener noreferrer"&gt;DI Solutions&lt;/a&gt;, a custom software and AI development company. This article is part of a practical series on building useful WhatsApp business workflows.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>whatsapp</category>
      <category>shopify</category>
      <category>ecommerce</category>
      <category>automation</category>
    </item>
    <item>
      <title>AI Can Write the Code. Developers Still Own the Consequences.</title>
      <dc:creator>Sanjay DI Solutions</dc:creator>
      <pubDate>Tue, 01 Dec 2026 10:22:49 +0000</pubDate>
      <link>https://dev.to/sanjay_lagariya_66d756afc/ai-can-write-the-code-developers-still-own-the-consequences-4m93</link>
      <guid>https://dev.to/sanjay_lagariya_66d756afc/ai-can-write-the-code-developers-still-own-the-consequences-4m93</guid>
      <description>&lt;h1&gt;
  
  
  AI Can Write the Code. Developers Still Own the Consequences.
&lt;/h1&gt;

&lt;p&gt;AI coding tools have changed how quickly software can be built. A feature that used to take hours of repetitive implementation can now be scaffolded, wired up, and revised in a fraction of the time.&lt;/p&gt;

&lt;p&gt;That speed is useful—but it creates a new responsibility.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting code written is no longer the hardest part
&lt;/h2&gt;

&lt;p&gt;With a capable coding assistant, it's easy to generate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API routes and CRUD operations&lt;/li&gt;
&lt;li&gt;Forms, validation schemas, and UI components&lt;/li&gt;
&lt;li&gt;Database queries and migrations&lt;/li&gt;
&lt;li&gt;Tests and boilerplate&lt;/li&gt;
&lt;li&gt;Refactors across multiple files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The output can look convincing before you've fully understood what changed. That's where the risk starts.&lt;/p&gt;

&lt;p&gt;A feature may work in the happy path but have problems with authorization, race conditions, error handling, data integrity, or an edge case that wasn't included in the prompt.&lt;/p&gt;

&lt;h2&gt;
  
  
  The dangerous workflow: prompt, accept, move on
&lt;/h2&gt;

&lt;p&gt;A tempting workflow is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Ask AI to implement a feature.&lt;/li&gt;
&lt;li&gt;See that it runs.&lt;/li&gt;
&lt;li&gt;Skim the files.&lt;/li&gt;
&lt;li&gt;Move on to the next task.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This optimizes for visible progress. But it doesn't necessarily build your understanding of the codebase.&lt;/p&gt;

&lt;p&gt;When something breaks later, you may be responsible for debugging a system whose decisions you never really reviewed.&lt;/p&gt;

&lt;h2&gt;
  
  
  A better workflow: delegate implementation, keep ownership
&lt;/h2&gt;

&lt;p&gt;I think a healthier AI-assisted workflow looks like this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Define the outcome yourself.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Understand the feature, its constraints, and how you'll know it's correct before asking AI to implement it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Let AI handle the repetitive work.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Scaffolding, familiar patterns, boilerplate, and first drafts are good candidates for delegation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Review the important decisions.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Focus on data flow, authorization, database changes, API contracts, failure paths, and unfamiliar code—not just formatting or file structure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Verify it independently.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Run tests, inspect behavior, check edge cases, and make sure the implementation actually satisfies the requirement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Be able to explain what you ship.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You don't need to memorize every line. You should be able to explain how the feature works, where its important decisions live, and what could fail.&lt;/p&gt;

&lt;h2&gt;
  
  
  The skill is shifting, not disappearing
&lt;/h2&gt;

&lt;p&gt;AI makes implementation faster, but it doesn't remove the need to understand software.&lt;/p&gt;

&lt;p&gt;In fact, when more code can be produced with less effort, the ability to evaluate that code becomes even more valuable. Knowing what to ask is helpful. Knowing when the answer is wrong is essential.&lt;/p&gt;

&lt;p&gt;I'm trying to treat AI as an implementation partner rather than a replacement for my own engineering judgment.&lt;/p&gt;

&lt;p&gt;The goal isn't to write every line manually. The goal is to ship software I can trust—and maintain after the AI conversation is over.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This is a practical perspective on AI-assisted development, not a claim that every workflow needs to be slower or more manual. Use AI to increase leverage, but keep ownership of the code.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>softwaredevelopment</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Night Bot, Day Team: WhatsApp Handoffs That Survive the 24-Hour Window</title>
      <dc:creator>Sanjay DI Solutions</dc:creator>
      <pubDate>Tue, 01 Dec 2026 10:00:48 +0000</pubDate>
      <link>https://dev.to/sanjay_lagariya_66d756afc/night-bot-day-team-whatsapp-handoffs-that-survive-the-24-hour-window-nge</link>
      <guid>https://dev.to/sanjay_lagariya_66d756afc/night-bot-day-team-whatsapp-handoffs-that-survive-the-24-hour-window-nge</guid>
      <description>&lt;p&gt;A small support team sets up the obvious arrangement: a bot answers WhatsApp questions at night, and anything it can't handle waits for a person in the morning. It works all week. Then on Monday someone opens a chat from Saturday evening, a customer asking about a refund, and finds they can't send a normal reply. The 24-hour window closed on Sunday evening.&lt;/p&gt;

&lt;p&gt;The bot did its job. The handoff didn't. "A person replies tomorrow" is only true if tomorrow is still inside WhatsApp's customer service window, and over a weekend or a holiday it often isn't. This post builds the parts that make a night-to-day handoff dependable, in TypeScript with no dependencies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;opening hours in the team's own time zone&lt;/li&gt;
&lt;li&gt;a handoff planner that knows when the window closes&lt;/li&gt;
&lt;li&gt;a holding message that tells the customer what happens next&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The code runs with &lt;code&gt;node --experimental-strip-types&lt;/code&gt; and has 8 tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  When the bot should hand off
&lt;/h2&gt;

&lt;p&gt;Keep the rules simple and visible to the team. Hand off when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the customer asks for a person&lt;/li&gt;
&lt;li&gt;the topic is one a bot shouldn't settle: refunds, complaints, payment problems, anything legal&lt;/li&gt;
&lt;li&gt;the bot has fallen back to "I didn't understand" twice in a row&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keyword and working-hours rules are covered in &lt;a href="https://dev.to/wapgrowai_org/building-a-rules-engine-for-whatsapp-automation-keywords-working-hours-priorities-and-loops-5871"&gt;Building a Rules Engine for WhatsApp Automation&lt;/a&gt;. This post is about what happens &lt;em&gt;after&lt;/em&gt; the bot decides a person is needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Opening hours, in the team's time zone
&lt;/h2&gt;

&lt;p&gt;Your server runs in UTC, but your team keeps local hours. Store the hours with an IANA time zone and let &lt;code&gt;Intl&lt;/code&gt; do the conversion. That way daylight saving time is handled for you:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/** Opening hours in the team's own time zone. Days: 0 = Sunday ... 6 = Saturday. Times: minutes after midnight. */&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;BusinessHours&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;timeZone&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;open&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Partial&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;MINUTE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;60_000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;WINDOW_MS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="no"&gt;MINUTE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;STEP_MS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="no"&gt;MINUTE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="cm"&gt;/** Weekday and minute of the day for an instant, in the team's time zone (DST included). */&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;localTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeZone&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="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;parts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Intl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DateTimeFormat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"en-US"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;timeZone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;weekday&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"short"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;hour&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2-digit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;minute&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2-digit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;hourCycle&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"h23"&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;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;formatToParts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;part&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;type&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Sun"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Mon"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Tue"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Wed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Thu"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Fri"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Sat"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;part&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"weekday"&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;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;minute&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;part&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"hour"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;part&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"minute"&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;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;isOpen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;BusinessHours&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;minute&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;localTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;timeZone&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;today&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;open&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;day&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;today&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;minute&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;today&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;minute&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;today&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/** The next moment the team is open, searched in 15-minute steps for up to 8 days. */&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;nextOpening&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;BusinessHours&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;after&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ceil&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;after&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="no"&gt;STEP_MS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="no"&gt;STEP_MS&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;after&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="no"&gt;MINUTE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="no"&gt;STEP_MS&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="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;isOpen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&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;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&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;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&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;Stepping in 15-minute increments is deliberately simple. It can't miss an opening because of a DST jump, and checking 8 days of steps is fast enough to run on every handoff.&lt;/p&gt;

&lt;h2&gt;
  
  
  The window decides what "tomorrow" means
&lt;/h2&gt;

&lt;p&gt;On WhatsApp you can send a free-form reply for 24 hours after the customer's latest message. After that, only an approved template can reach them. Each new message from the customer restarts the 24 hours.&lt;/p&gt;

&lt;p&gt;So the planner has to compare two times: when the team next opens, and when the window closes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;HandoffPlan&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"agent_now"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"queue"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;opensAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;windowClosesAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"queue_needs_template"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;opensAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;windowClosesAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * What to do when the bot decides a human is needed. The customer service window is 24 hours from
 * the customer's latest message; after it closes, only an approved template can reach them.
 */&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;planHandoff&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;BusinessHours&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lastCustomerMessageAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;HandoffPlan&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;windowClosesAt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lastCustomerMessageAt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;WINDOW_MS&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="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;isOpen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;now&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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"agent_now"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;opensAt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;nextOpening&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// Give the agent at least 30 minutes of open window to read the chat and reply.&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;opensAt&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;opensAt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="no"&gt;MINUTE&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;windowClosesAt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getTime&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;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;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"queue"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;opensAt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;windowClosesAt&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;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"queue_needs_template"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;opensAt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;windowClosesAt&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;For a team open Monday–Friday 09:00–18:00 and Saturday 10:00–14:00 (Indian Standard Time), the three cases look like this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Customer's last message&lt;/th&gt;
&lt;th&gt;Team next opens&lt;/th&gt;
&lt;th&gt;Window closes&lt;/th&gt;
&lt;th&gt;Plan&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Wednesday 22:00&lt;/td&gt;
&lt;td&gt;Thursday 09:00&lt;/td&gt;
&lt;td&gt;Thursday 22:00&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;queue&lt;/code&gt;, answer normally in the morning&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Saturday 19:00&lt;/td&gt;
&lt;td&gt;Monday 09:00&lt;/td&gt;
&lt;td&gt;Sunday 19:00&lt;/td&gt;
&lt;td&gt;&lt;code&gt;queue_needs_template&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sunday 12:00 (they wrote again)&lt;/td&gt;
&lt;td&gt;Monday 09:00&lt;/td&gt;
&lt;td&gt;Monday 12:00&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;queue&lt;/code&gt;, as long as someone picks it up early&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The 30-minute margin in &lt;code&gt;planHandoff&lt;/code&gt; matters in practice. A chat that is technically answerable at 09:00 but closes at 09:10 will be missed by whoever starts with their email.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tell the customer what happens next
&lt;/h2&gt;

&lt;p&gt;The holding message goes out &lt;strong&gt;straight away&lt;/strong&gt;, while the window is still open. A customer who knows a person will reply on Monday is far less likely to write "hello??" three times or to leave.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/** The message the bot sends while the window is still open, so the customer knows what happens next. */&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;holdingMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;BusinessHours&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;plan&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;HandoffPlan&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;locale&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"en-IN"&lt;/span&gt;&lt;span class="p"&gt;)&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="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;plan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"agent_now"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Connecting you with someone from the team now."&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;plan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;opensAt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Thanks, someone from the team will get back to you."&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;when&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Intl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DateTimeFormat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;locale&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;timeZone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;timeZone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;weekday&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"long"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;hour&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"numeric"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;minute&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2-digit"&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;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;plan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;opensAt&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="sb"&gt;`Thanks. Someone from the team will pick this up after ${when}. Reply here any time to add details.`&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;For the two plans above, it produces:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thanks. Someone from the team will pick this up after Thursday, 9:00 am. Reply here any time to add details.&lt;/p&gt;

&lt;p&gt;Thanks. Someone from the team will pick this up after Monday, 9:00 am. Reply here any time to add details.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The last sentence isn't a trick. Inviting details is useful, and if the customer does reply, the window restarts from that message. Send the holding message once per handoff, though. Repeating it is how a helpful bot becomes spam.&lt;/p&gt;

&lt;h2&gt;
  
  
  When the window will have closed
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;queue_needs_template&lt;/code&gt; means a person will not be able to send a free-form reply when they start work. Decide in advance which of these you'll do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Someone checks flagged chats over the weekend.&lt;/strong&gt; It can be one person for 15 minutes on Sunday, looking only at chats marked &lt;code&gt;queue_needs_template&lt;/code&gt;, sorted by &lt;code&gt;windowClosesAt&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reply with an approved template.&lt;/strong&gt; Keep a short follow-up template ready, for example "We've looked into your question. Reply to this message and we'll continue here". Once the customer replies, the window reopens and the agent can answer normally. A follow-up on a request the customer made is usually a utility template, but Meta decides the category when you submit it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Put those chats first.&lt;/strong&gt; Sort Monday's queue by when each window closes, not by when the chat arrived. The chat that is about to become unanswerable goes to the top.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whatever you choose, store the plan with the handoff. "Needs a template" should be visible in the inbox before the agent opens the chat, not discovered when the send fails. &lt;a href="https://dev.to/wapgrowai_org/modelling-whatsapps-24-hour-window-correctly-its-harder-than-a-timer-3gho"&gt;Modelling WhatsApp's 24-Hour Window Correctly&lt;/a&gt; covers tracking the window itself in more depth.&lt;/p&gt;

&lt;h2&gt;
  
  
  Putting it into the handoff
&lt;/h2&gt;

&lt;p&gt;When the bot decides a person is needed, the whole handoff is four steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;planHandoff(hours, lastCustomerMessageAt, now)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Send &lt;code&gt;holdingMessage(hours, plan)&lt;/code&gt; now, while the window is open.&lt;/li&gt;
&lt;li&gt;Release the chat from the bot into the human queue, with &lt;code&gt;windowClosesAt&lt;/code&gt; as its sort key and a flag for &lt;code&gt;queue_needs_template&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Agents claim chats from that queue. Claiming and duplicate replies are covered in &lt;a href="https://dev.to/sanjay_lagariya_66d756afc/two-agents-one-whatsapp-chat-preventing-duplicate-replies-in-a-shared-inbox-5cp0"&gt;Two Agents, One WhatsApp Chat&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What the tests pin down
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Opening hours follow the team's time zone, including closing time and the closed day.&lt;/li&gt;
&lt;li&gt;The next opening skips the night and the closed Sunday.&lt;/li&gt;
&lt;li&gt;A weeknight question waits for the morning and stays inside the window.&lt;/li&gt;
&lt;li&gt;A Saturday-evening question is flagged as needing a template on Monday, with the window closing Sunday 19:00.&lt;/li&gt;
&lt;li&gt;A new customer message on Sunday keeps the chat answerable on Monday.&lt;/li&gt;
&lt;li&gt;During opening hours the chat goes straight to a person.&lt;/li&gt;
&lt;li&gt;A New York team keeps the right hours across the March DST change.&lt;/li&gt;
&lt;li&gt;The holding message names the day and time a person will reply.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  If you'd rather not build it
&lt;/h2&gt;

&lt;p&gt;WAPGROWAI's no-code chatbot builder answers FAQs, qualifies leads and routes chats, and hands off to human agents in the shared team inbox. If you are building your own, the planner above is the part most teams only add after the first angry Monday.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Store opening hours with an &lt;strong&gt;IANA time zone&lt;/strong&gt;, and convert with &lt;code&gt;Intl&lt;/code&gt;, not your server's clock.&lt;/li&gt;
&lt;li&gt;Hand off on clear rules: an explicit request for a person, sensitive topics, repeated fallbacks.&lt;/li&gt;
&lt;li&gt;At handoff, compare &lt;strong&gt;the next opening&lt;/strong&gt; with &lt;strong&gt;when the window closes&lt;/strong&gt;, and keep a margin.&lt;/li&gt;
&lt;li&gt;Send &lt;strong&gt;one&lt;/strong&gt; holding message right away that says when a person will reply.&lt;/li&gt;
&lt;li&gt;Flag chats that will need a &lt;strong&gt;template&lt;/strong&gt;, and decide in advance who handles them.&lt;/li&gt;
&lt;li&gt;Sort the morning queue by &lt;strong&gt;window closing time&lt;/strong&gt;, not arrival time.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;WAPGROWAI is built by &lt;a href="https://disolutions.net" rel="noopener noreferrer"&gt;DI Solutions&lt;/a&gt;, a custom software and AI development company. This series covers what we've learned building &lt;a href="https://www.wpautoai.com/solutions/developers" rel="noopener noreferrer"&gt;WAPGROWAI&lt;/a&gt; on the WhatsApp Cloud API.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Drafted with AI assistance.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>whatsapp</category>
      <category>typescript</category>
      <category>chatbot</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Two Agents, One WhatsApp Chat: Preventing Duplicate Replies in a Shared Inbox</title>
      <dc:creator>Sanjay DI Solutions</dc:creator>
      <pubDate>Tue, 01 Dec 2026 09:53:56 +0000</pubDate>
      <link>https://dev.to/sanjay_lagariya_66d756afc/two-agents-one-whatsapp-chat-preventing-duplicate-replies-in-a-shared-inbox-5cp0</link>
      <guid>https://dev.to/sanjay_lagariya_66d756afc/two-agents-one-whatsapp-chat-preventing-duplicate-replies-in-a-shared-inbox-5cp0</guid>
      <description>&lt;p&gt;Two people on your support team see the same WhatsApp message: "Is my order shipping today?" Both start typing. Twenty seconds later the customer has two answers, and if you're unlucky they disagree: one says yes, the other says tomorrow.&lt;/p&gt;

&lt;p&gt;It happens on a shared phone running the WhatsApp Business app, and it happens just as easily in a custom inbox built on the Cloud API. WhatsApp doesn't decide who answers a chat, so your inbox has to. This post builds the guards that stop duplicate replies, in TypeScript with plain SQL:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a claim before anyone types&lt;/li&gt;
&lt;li&gt;a reply check that only lets an agent answer what they actually saw&lt;/li&gt;
&lt;li&gt;a send that can't go out twice&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The code runs on Node's built-in SQLite (&lt;code&gt;node --experimental-strip-types&lt;/code&gt; with &lt;code&gt;node:sqlite&lt;/code&gt;) and has 8 tests. The SQL is an ordinary conditional &lt;code&gt;UPDATE&lt;/code&gt; and an &lt;code&gt;INSERT&lt;/code&gt; with a unique key, so it carries over to Postgres or MySQL.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where duplicate replies come from
&lt;/h2&gt;

&lt;p&gt;There are four different races, and each needs its own fix:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Race&lt;/th&gt;
&lt;th&gt;What happens&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Two agents, one new chat&lt;/td&gt;
&lt;td&gt;Both open an unassigned conversation and start typing&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Claim&lt;/strong&gt; the chat before the reply box unlocks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A stale view&lt;/td&gt;
&lt;td&gt;The customer wrote again, or a colleague or the bot answered, while the agent was typing&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Reserve the reply&lt;/strong&gt; against the version the agent saw&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Two tabs or a double click&lt;/td&gt;
&lt;td&gt;The same reply is submitted twice&lt;/td&gt;
&lt;td&gt;The same reserve step&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A retried request&lt;/td&gt;
&lt;td&gt;A network blip makes your backend call the Cloud API again&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Insert before sending&lt;/strong&gt;, keyed by a client message id&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Locking alone doesn't cover the last three, and idempotency alone doesn't cover the first two. You need all of them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The data you need
&lt;/h2&gt;

&lt;p&gt;Two tables are enough. The columns doing the work are &lt;code&gt;owner&lt;/code&gt;, &lt;code&gt;lease_until&lt;/code&gt; and &lt;code&gt;version&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;schema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`
CREATE TABLE conversations (
  id          TEXT PRIMARY KEY,
  owner       TEXT,                       -- an agent id, 'bot', or NULL (waiting in the queue)
  lease_until INTEGER NOT NULL DEFAULT 0, -- epoch ms; an idle claim runs out
  version     INTEGER NOT NULL DEFAULT 0  -- +1 on every inbound or outbound message
);
CREATE TABLE outbound_messages (
  conversation_id   TEXT NOT NULL,
  client_message_id TEXT NOT NULL,        -- generated by the composer, once per message
  body              TEXT NOT NULL,
  status            TEXT NOT NULL,        -- 'sending' | 'sent' | 'failed' | 'unknown'
  wamid             TEXT,
  PRIMARY KEY (conversation_id, client_message_id)
);`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;version&lt;/code&gt; goes up by one for every inbound or outbound message. It's how the server knows an agent's screen is out of date. Bump it in the same transaction that stores the message. Your webhook handler should already be dropping Meta's repeat deliveries by message id, as covered in &lt;a href="https://dev.to/wapgrowai_org/handling-whatsapp-cloud-api-webhooks-in-nodejs-signatures-retries-and-duplicate-events-4dci"&gt;Handling WhatsApp Cloud API Webhooks in Node.js&lt;/a&gt;, so a repeated delivery doesn't bump it twice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Claim before anyone types
&lt;/h2&gt;

&lt;p&gt;The reply box stays locked until the agent owns the conversation. Claiming is a single conditional &lt;code&gt;UPDATE&lt;/code&gt;. It succeeds only if one of these is true:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;nobody holds the chat&lt;/li&gt;
&lt;li&gt;the agent already does&lt;/li&gt;
&lt;li&gt;the bot does&lt;/li&gt;
&lt;li&gt;the previous claim has run out
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;LEASE_MS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="cm"&gt;/** Claim before typing. Wins only if nobody holds the chat, you do, the bot does, or the lease ran out. */&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;claim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;DatabaseSync&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;conversationId&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;agentId&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;now&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&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;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;prepare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="sb"&gt;`UPDATE conversations
          SET owner = ?, lease_until = ?
        WHERE id = ?
          AND (owner IS NULL OR owner = ? OR owner = 'bot' OR lease_until &amp;lt; ?)`&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;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;agentId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;LEASE_MS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;conversationId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;agentId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;now&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;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;changes&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;1&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;&lt;code&gt;changes === 1&lt;/code&gt; is the whole lock. Two agents can click at the same moment: the database applies the updates one after the other, and the second one matches no row.&lt;/p&gt;

&lt;p&gt;Three details matter in practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Claims are leases, not forever.&lt;/strong&gt; An agent who claims a chat and then goes to lunch shouldn't block it. Every claim and every reply renews a 10-minute lease. After that, anyone can pick the chat up.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;People win over the bot.&lt;/strong&gt; If a bot is handling a chat, say answering FAQs at night, an agent claiming it takes over. The bot must check that it still owns the chat (&lt;code&gt;owner = 'bot'&lt;/code&gt;) before each reply. That is the whole handoff: the bot stops because it no longer owns the chat, not because a timer fired.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Taking a chat from a colleague is a separate action.&lt;/strong&gt; Show "Asha is handling this" with a &lt;em&gt;Take over&lt;/em&gt; button that leaves an audit entry. Don't make it the default path.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Answer what you saw, not what's there now
&lt;/h2&gt;

&lt;p&gt;A claim stops two agents typing into the same chat. It doesn't stop one agent from replying to a conversation that moved on while they typed. Maybe the customer added "actually, cancel it", or the order bot already sent the tracking link.&lt;/p&gt;

&lt;p&gt;The composer remembers the conversation's &lt;code&gt;version&lt;/code&gt; from when the agent loaded it. Sending first &lt;em&gt;reserves&lt;/em&gt; the reply with another conditional update. That update checks the owner, the lease and the version together, and bumps the version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;ReplyCheck&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ok"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"not_owner"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"conversation_changed"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * Reserve the right to reply to exactly what the agent saw. One conditional UPDATE checks the
 * owner, the lease and the version, and bumps the version, so a second reply built on the same
 * view (another tab, a double click, a colleague) can't also pass.
 */&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;reserveReply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;DatabaseSync&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;conversationId&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;agentId&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;seenVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&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;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ReplyCheck&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;prepare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="sb"&gt;`UPDATE conversations
          SET version = version + 1, lease_until = ?
        WHERE id = ? AND owner = ? AND lease_until &amp;gt;= ? AND version = ?`&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;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;LEASE_MS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;conversationId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;agentId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;seenVersion&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="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;changes&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"ok"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;prepare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"SELECT owner, lease_until FROM conversations WHERE id = ?"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;conversationId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;owner&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;lease_until&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&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;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;owner&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;agentId&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lease_until&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"conversation_changed"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"not_owner"&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;Because the reserve step itself bumps &lt;code&gt;version&lt;/code&gt;, a second reply built on the same view fails too. That covers the double click and the second browser tab without extra code.&lt;/p&gt;

&lt;p&gt;When the result is &lt;code&gt;conversation_changed&lt;/code&gt;, don't drop the message silently. Show the agent what changed ("New message from the customer", or "Rahul replied 20 seconds ago") and keep their draft in the box. They read it, and if their answer still makes sense, they send it against the new version. When the result is &lt;code&gt;not_owner&lt;/code&gt;, tell them who has the chat now.&lt;/p&gt;

&lt;p&gt;One WhatsApp-specific case belongs here too. If the draft sat long enough for the 24-hour customer service window to close, a free-form reply can't be sent; only an approved template can. Check the window before sending, not after. &lt;a href="https://dev.to/wapgrowai_org/modelling-whatsapps-24-hour-window-correctly-its-harder-than-a-timer-3gho"&gt;Modelling WhatsApp's 24-Hour Window Correctly&lt;/a&gt; explains why that is harder than a timer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Send once, even when the request is retried
&lt;/h2&gt;

&lt;p&gt;The last race happens below the UI. The agent's request reaches your server twice, or your server retries a Cloud API call after a timeout. The fix:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Give every composed message an id on the client: a UUID created when the agent starts writing it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write the row before calling Meta.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/** Thrown when Meta answered with an error: the message was not sent. */&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CloudApiError&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&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="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;status&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;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;CloudApi&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;sendText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;to&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;body&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="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;wamid&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="o"&gt;&amp;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;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;SendResult&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"sent"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;wamid&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="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"duplicate"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;wamid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"failed"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"unknown"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="cm"&gt;/** Insert first, send second: a retried request finds the row and never calls the API twice. */&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;sendOnce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;DatabaseSync&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;CloudApi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;conversationId&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;clientMessageId&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;to&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;body&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="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;SendResult&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;conversationId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;clientMessageId&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;prepare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="sb"&gt;`INSERT INTO outbound_messages (conversation_id, client_message_id, body, status)
       VALUES (?, ?, ?, 'sending')`&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;span class="nf"&gt;run&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;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;message&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="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;error&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="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"UNIQUE"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;prepare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s2"&gt;"SELECT wamid FROM outbound_messages WHERE conversation_id = ? AND client_message_id = ?"&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;span class="nf"&gt;get&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;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="k"&gt;as&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;wamid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"duplicate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;wamid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;wamid&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;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;setStatus&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;status&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;wamid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="n"&gt;db&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;prepare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sb"&gt;`UPDATE outbound_messages SET status = ?, wamid = ?
          WHERE conversation_id = ? AND client_message_id = ?`&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;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;wamid&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;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="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;wamid&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&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="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;setStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"sent"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;wamid&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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"sent"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;wamid&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;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Meta answered with an error: nothing was sent, so it is safe to fix and resend.&lt;/span&gt;
    &lt;span class="c1"&gt;// A timeout or dropped connection: it may have been sent. Don't retry blindly; show a person.&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nc"&gt;CloudApiError&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"failed"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"unknown"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;setStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;status&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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;status&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;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The unique key on &lt;code&gt;(conversation_id, client_message_id)&lt;/code&gt; turns a retry into a lookup. The second request finds the row and returns the first result instead of sending again.&lt;/p&gt;

&lt;p&gt;The error handling is deliberate. If Meta answers with an error response, the message wasn't accepted, so it's safe to fix it and resend. If the request times out or the connection drops, you don't know: Meta may have accepted the message. Retrying automatically is exactly how customers get the same message twice. Mark it &lt;code&gt;unknown&lt;/code&gt; and let a person decide.&lt;/p&gt;

&lt;p&gt;To settle those cases automatically, put your client message id in the send request's &lt;code&gt;biz_opaque_callback_data&lt;/code&gt; field. Meta includes that value in the status webhooks for the message, so a &lt;code&gt;sent&lt;/code&gt; or &lt;code&gt;delivered&lt;/code&gt; status can turn an &lt;code&gt;unknown&lt;/code&gt; row into &lt;code&gt;sent&lt;/code&gt;, even though you never saw the response with the &lt;code&gt;wamid&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the tests pin down
&lt;/h2&gt;

&lt;p&gt;The code above is tested against these 8 cases:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Two agents claim the same chat at the same moment, and exactly one wins.&lt;/li&gt;
&lt;li&gt;The owner can renew their claim, and an idle claim runs out after 10 minutes.&lt;/li&gt;
&lt;li&gt;A person takes a chat over from the bot.&lt;/li&gt;
&lt;li&gt;A reply written before the customer's newest message is stopped. It goes through once the agent has seen that message.&lt;/li&gt;
&lt;li&gt;With two tabs or a double click, only one reply passes.&lt;/li&gt;
&lt;li&gt;Someone who doesn't own the chat, or whose lease ran out, can't reply.&lt;/li&gt;
&lt;li&gt;The same client message id is sent once, however often the request is retried.&lt;/li&gt;
&lt;li&gt;A timeout is recorded as &lt;code&gt;unknown&lt;/code&gt; and isn't retried. An API error is recorded as &lt;code&gt;failed&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you build an inbox, write these tests first. They are the difference between "we use locks" and "customers never get two answers".&lt;/p&gt;

&lt;h2&gt;
  
  
  If you'd rather not build it
&lt;/h2&gt;

&lt;p&gt;This is a lot of plumbing for something customers only notice when it fails. WAPGROWAI's team inbox is a shared inbox where teams assign, tag, resolve and route WhatsApp conversations, and work together without losing context. If you are building your own, the guards above are the minimum.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Lock the reply box until the agent has &lt;strong&gt;claimed&lt;/strong&gt; the conversation, with a conditional &lt;code&gt;UPDATE&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Make claims &lt;strong&gt;leases&lt;/strong&gt; (around 10 minutes, renewed on activity), so idle agents don't block chats.&lt;/li&gt;
&lt;li&gt;Let a person &lt;strong&gt;take over from the bot&lt;/strong&gt;, and have the bot check it still owns the chat before every reply.&lt;/li&gt;
&lt;li&gt;Keep a &lt;strong&gt;version&lt;/strong&gt; on each conversation, bumped on every inbound and outbound message.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reserve&lt;/strong&gt; each reply against the version the agent saw, and show what changed when that fails.&lt;/li&gt;
&lt;li&gt;Check the &lt;strong&gt;24-hour window&lt;/strong&gt; before a free-form reply. Outside it, offer a template.&lt;/li&gt;
&lt;li&gt;Give every composed message a &lt;strong&gt;client id&lt;/strong&gt;, and insert the row &lt;strong&gt;before&lt;/strong&gt; calling the Cloud API.&lt;/li&gt;
&lt;li&gt;Treat a timeout as &lt;strong&gt;unknown&lt;/strong&gt;, not failed. Never retry it blindly, and use &lt;code&gt;biz_opaque_callback_data&lt;/code&gt; to settle it from the status webhook.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;WAPGROWAI is built by &lt;a href="https://disolutions.net" rel="noopener noreferrer"&gt;DI Solutions&lt;/a&gt;, a custom software and AI development company. This series covers what we've learned building &lt;a href="https://www.wpautoai.com/solutions/developers" rel="noopener noreferrer"&gt;WAPGROWAI&lt;/a&gt; on the WhatsApp Cloud API.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Drafted with AI assistance.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>whatsapp</category>
      <category>typescript</category>
      <category>database</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
