<?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: Chandan Kumar</title>
    <description>The latest articles on DEV Community by Chandan Kumar (@chandan_kumar_04fbeac3907).</description>
    <link>https://dev.to/chandan_kumar_04fbeac3907</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%2F4284239%2F861e16e5-a822-45e9-83ed-b62c0b640c08.png</url>
      <title>DEV Community: Chandan Kumar</title>
      <link>https://dev.to/chandan_kumar_04fbeac3907</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chandan_kumar_04fbeac3907"/>
    <language>en</language>
    <item>
      <title>WhatsApp follow-ups that stop themselves: n8n, Google Sheets and an AI reply reader</title>
      <dc:creator>Chandan Kumar</dc:creator>
      <pubDate>Sat, 05 Dec 2026 09:29:38 +0000</pubDate>
      <link>https://dev.to/chandan_kumar_04fbeac3907/whatsapp-follow-ups-that-stop-themselves-n8n-google-sheets-and-an-ai-reply-reader-oo2</link>
      <guid>https://dev.to/chandan_kumar_04fbeac3907/whatsapp-follow-ups-that-stop-themselves-n8n-google-sheets-and-an-ai-reply-reader-oo2</guid>
      <description>&lt;p&gt;Most leads don't answer the first message. The follow-up is where the sale is, and it is also the job everyone forgets.&lt;/p&gt;

&lt;p&gt;I built an n8n workflow that does the chasing on WhatsApp, reads the replies with AI, and tells the team exactly who to call. It is published in n8n's template library (&lt;a href="https://n8n.io/workflows/23631" rel="noopener noreferrer"&gt;workflow 23631&lt;/a&gt;), so you can import it and read every node. This post walks through how it is put together and the decisions that made it reliable.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;p&gt;Two triggers, one Google Sheet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Every hour, 9 am to 6 pm, Monday to Saturday:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Read the enquiries sheet.&lt;/li&gt;
&lt;li&gt;Work out each open lead's next step.&lt;/li&gt;
&lt;li&gt;Send a first WhatsApp nudge, a final nudge, or mark the lead cold.&lt;/li&gt;
&lt;li&gt;Save every step back to the sheet and email the team one digest.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;The moment a lead replies on WhatsApp:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Find their enquiry by mobile number.&lt;/li&gt;
&lt;li&gt;Let an AI model read the reply: do they want a call, an appointment, have a question, or not interested? When do they want the call?&lt;/li&gt;
&lt;li&gt;Update the sheet (which stops further nudges), email the team, and send a short thank-you.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Decision 1: the sheet is the state machine
&lt;/h2&gt;

&lt;p&gt;There is no database. A &lt;strong&gt;Follow-up stage&lt;/strong&gt; column holds the state:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(empty) → Nudge 1 sent → Nudge 2 sent → Cold
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and &lt;code&gt;Replied&lt;/code&gt;, &lt;code&gt;Opted out&lt;/code&gt;, &lt;code&gt;Call only&lt;/code&gt; or &lt;code&gt;WhatsApp failed&lt;/code&gt; end the sequence.&lt;/p&gt;

&lt;p&gt;The planning step is a single Code node that reads each row and returns only the leads that need an action right now:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&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;stage&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;waited&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;hoursSince&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;received&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;waited&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;firstAfter&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;waited&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;maxAge&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="c1"&gt;// too soon, or too old to start&lt;/span&gt;
  &lt;span class="n"&gt;action&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s1"&gt;'call_only'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'first_nudge'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&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;stage&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'Nudge 1 sent'&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="n"&gt;last&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nf"&gt;hoursSince&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;finalAfter&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;action&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s1"&gt;'call_only'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'final_nudge'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&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;stage&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'Nudge 2 sent'&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="n"&gt;last&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nf"&gt;hoursSince&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;coldAfter&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;action&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'mark_cold'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&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="c1"&gt;// replied, opted out, etc.&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The timings live in a &lt;strong&gt;Settings&lt;/strong&gt; node: first nudge after 24 hours, final nudge 48 hours later, cold 48 hours after that. Leads older than 96 hours are never started, so switching the workflow on doesn't suddenly message last month's enquiries. If you copy only one idea from this post, copy that guard.&lt;/p&gt;

&lt;p&gt;Because a person can change the &lt;strong&gt;Status&lt;/strong&gt; column to anything other than "New" and the workflow leaves that lead alone, the team stays in control without touching n8n.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decision 2: no consent, no WhatsApp
&lt;/h2&gt;

&lt;p&gt;If the lead didn't agree to WhatsApp, or the number doesn't look like a real mobile, the action becomes &lt;code&gt;call_only&lt;/code&gt; instead of a message. It shows up in the team's digest as someone to phone.&lt;/p&gt;

&lt;p&gt;For Indian numbers, the number check needs its own rules (10 digits starting 6-9, with or without 0, +91, 0091). I wrote that up with tested code in &lt;a href="https://dev.to/chandan_kumar_04fbeac3907/cleaning-indian-mobile-numbers-for-the-whatsapp-cloud-api-in-n8n-tested-code-4b2"&gt;a separate post&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decision 3: approved templates, and a clear way out
&lt;/h2&gt;

&lt;p&gt;Both nudges are WhatsApp &lt;strong&gt;utility templates&lt;/strong&gt;, because business-initiated messages outside the 24-hour window need one. The final nudge always offers an exit:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hi [first name], this is a final check-in from [business] about your enquiry. If you'd still like our help, reply with a good day and time to call. If not, reply STOP and we won't message you again.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Two messages, then stop. Chasing harder than that annoys people and risks your number's quality rating with Meta.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decision 4: let the AI extract, not decide
&lt;/h2&gt;

&lt;p&gt;When a reply comes in, n8n's &lt;strong&gt;Information Extractor&lt;/strong&gt; node (with an OpenAI chat model) turns free text into three fields:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"intent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"wants_call | wants_appointment | question | not_interested | other"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"preferred_call_time"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"in the person's own words, or empty"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"summary"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"one short sentence for the team"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The system prompt tells it to extract only what the person actually says and &lt;strong&gt;never invent a call time&lt;/strong&gt;. If someone writes "kal shaam ko call karna" or "after 6 works", that text goes into the sheet as-is. A person reads it and books the call. The AI sorts; it doesn't promise anything on the business's behalf.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;not_interested&lt;/code&gt; sets the stage to &lt;strong&gt;Opted out&lt;/strong&gt; and the status to &lt;strong&gt;Not interested&lt;/strong&gt;, which ends the sequence for good. Everything else becomes &lt;strong&gt;Replied&lt;/strong&gt;, which also stops the nudges.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decision 5: match replies carefully
&lt;/h2&gt;

&lt;p&gt;The WhatsApp trigger gives you the sender's number. The workflow normalises the numbers in the sheet the same way and looks for a match. If one person has several enquiries, it prefers the one currently being nudged, then the newest. Messages from numbers that aren't in the sheet are ignored by the workflow and left in WhatsApp for a person to handle.&lt;/p&gt;

&lt;h2&gt;
  
  
  Watch it run
&lt;/h2&gt;

&lt;p&gt;I recorded a 2-minute walkthrough of the whole workflow on the canvas, node by node. It's on the &lt;a href="https://workflowdecoded.in/automations/whatsapp-follow-up/" rel="noopener noreferrer"&gt;WhatsApp follow-up automation page&lt;/a&gt;. It pairs with the &lt;a href="https://n8n.io/workflows/22640" rel="noopener noreferrer"&gt;instant-reply workflow&lt;/a&gt;, which answers new enquiries and logs them into the same sheet this one reads.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you build your own
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Keep state in one visible place your team already opens.&lt;/li&gt;
&lt;li&gt;Put every timing in one Settings node.&lt;/li&gt;
&lt;li&gt;Add an age limit before you switch anything on.&lt;/li&gt;
&lt;li&gt;Route "can't message" to a human, never to nowhere.&lt;/li&gt;
&lt;li&gt;Use AI to read and summarise, and keep the decisions with people.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Questions about any node, ask in the comments.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Chandan Kumar builds CRM, WhatsApp API and n8n automations for Indian businesses at &lt;a href="https://workflowdecoded.in" rel="noopener noreferrer"&gt;Workflow Decoded&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>n8n</category>
      <category>whatsapp</category>
      <category>ai</category>
      <category>automation</category>
    </item>
    <item>
      <title>Cleaning Indian mobile numbers for the WhatsApp Cloud API in n8n (tested code)</title>
      <dc:creator>Chandan Kumar</dc:creator>
      <pubDate>Sat, 05 Dec 2026 09:28:47 +0000</pubDate>
      <link>https://dev.to/chandan_kumar_04fbeac3907/cleaning-indian-mobile-numbers-for-the-whatsapp-cloud-api-in-n8n-tested-code-4b2</link>
      <guid>https://dev.to/chandan_kumar_04fbeac3907/cleaning-indian-mobile-numbers-for-the-whatsapp-cloud-api-in-n8n-tested-code-4b2</guid>
      <description>&lt;p&gt;If you send WhatsApp messages from n8n to Indian customers, the first thing that breaks is not the API. It is the phone number.&lt;/p&gt;

&lt;p&gt;People type their number every possible way into a form, an IndiaMART enquiry or a Google Sheet:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;9810012345&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;98100 12345&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;098100-12345&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;+91 98100 12345&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;0091 98100 12345&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;91 98100 12345&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The WhatsApp Cloud API wants one thing: country code plus number, digits only, like &lt;code&gt;919810012345&lt;/code&gt;. Send anything else and the message fails, or worse, goes to the wrong number.&lt;/p&gt;

&lt;p&gt;I hit this while adapting one of my published n8n workflows (&lt;a href="https://n8n.io/workflows/22640" rel="noopener noreferrer"&gt;instant WhatsApp reply + enquiry log&lt;/a&gt;) for Indian businesses. The original was written for UK numbers, where "starts with 0, so swap the 0 for the country code" works. In India it doesn't, because most people never type the leading 0 at all. They type 10 digits.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rules that actually matter for India
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Indian mobile numbers are &lt;strong&gt;10 digits and start with 6, 7, 8 or 9&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;People may add a leading &lt;code&gt;0&lt;/code&gt;, &lt;code&gt;+91&lt;/code&gt;, &lt;code&gt;0091&lt;/code&gt;, &lt;code&gt;091&lt;/code&gt; or &lt;code&gt;91&lt;/code&gt;, with any spaces, dashes or brackets.&lt;/li&gt;
&lt;li&gt;Landlines (like &lt;code&gt;0120 4xxxxxx&lt;/code&gt; in Noida) look similar but are not mobiles. Flag them instead of sending.&lt;/li&gt;
&lt;li&gt;If someone types &lt;code&gt;+&lt;/code&gt; or &lt;code&gt;00&lt;/code&gt; first, trust them: it is an international number, so leave the country code alone.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The function
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Turns whatever an Indian customer typed into the number format the&lt;/span&gt;
&lt;span class="c1"&gt;// WhatsApp Cloud API expects: country code + number, digits only (no +).&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;toWhatsAppNumberIN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entered&lt;/span&gt;&lt;span class="p"&gt;)&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;s&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;entered&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s1"&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;trim&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;let&lt;/span&gt; &lt;span class="n"&gt;international&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="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&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="o"&gt;^&lt;/span&gt;\&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;            &lt;span class="c1"&gt;// keep digits and a leading +&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;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&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;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&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;span class="n"&gt;international&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;else&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;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'00'&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;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;international&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="no"&gt;D&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&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;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;international&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="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;\&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;9&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="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'91'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;    &lt;span class="c1"&gt;// 98100 12345, 098100 12345&lt;/span&gt;
    &lt;span class="k"&gt;else&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="mi"&gt;091&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;\&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;9&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="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&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;span class="c1"&gt;// 091 98100 12345&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;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'91'&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="c1"&gt;// Indian mobiles are 10 digits starting 6-9. Anything else (a landline,&lt;/span&gt;
    &lt;span class="c1"&gt;// a short number) can't reliably receive WhatsApp from you.&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;/^&lt;/span&gt;&lt;span class="mi"&gt;91&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;\&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;9&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="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&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;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&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;s&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;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&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;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'not an Indian mobile number'&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="c1"&gt;// Other countries: accept a plausible international number (E.164 is max 15 digits).&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;international&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;
    &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&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;s&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;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&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;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;international&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s1"&gt;'number too short or too long'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'not a mobile number we recognise'&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;Note the order of the checks. A 10-digit mobile can itself start with &lt;code&gt;91&lt;/code&gt; (for example &lt;code&gt;9112345678&lt;/code&gt;), so the "10 digits starting 6-9" rule runs before the "already has a country code" rule. Get that order wrong and you send to the wrong person.&lt;/p&gt;

&lt;h2&gt;
  
  
  The test cases
&lt;/h2&gt;

&lt;p&gt;I ran it against the inputs I actually see in Indian enquiry forms:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Typed by the customer&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;9810012345&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;919810012345&lt;/code&gt; ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;98100 12345&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;919810012345&lt;/code&gt; ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;098100-12345&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;919810012345&lt;/code&gt; ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;+91 98100 12345&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;919810012345&lt;/code&gt; ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;+91-98100-12345&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;919810012345&lt;/code&gt; ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0091 98100 12345&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;919810012345&lt;/code&gt; ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;919810012345&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;919810012345&lt;/code&gt; ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;091 98100 12345&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;919810012345&lt;/code&gt; ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;(+91) 7011 223344&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;917011223344&lt;/code&gt; ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;+44 7700 900123&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;447700900123&lt;/code&gt; ✅ (international left alone)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0120 4567890&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;❌ not a mobile number&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;5810012345&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;❌ not a mobile number&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;+91 98100 1234&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;❌ not an Indian mobile number (one digit short)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;12345&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;❌ too short&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;empty&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;15 out of 15 pass.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using it in an n8n Code node
&lt;/h2&gt;

&lt;p&gt;Put this in a &lt;strong&gt;Code&lt;/strong&gt; node (Run once for all items) right after your trigger. It keeps the original number for your records and adds the cleaned one plus a flag you can route on with an &lt;strong&gt;If&lt;/strong&gt; node.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// paste toWhatsAppNumberIN() from above here, then:&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&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;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;typed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'Mobile number'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mobile&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s1"&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;phone&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;toWhatsAppNumberIN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;typed&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;json&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="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;phone_entered&lt;/span&gt;&lt;span class="p"&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;typed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;phone_whatsapp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;phone&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;phone_ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;phone_problem&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reason&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;pairedItem&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;index&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="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;Then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;If&lt;/strong&gt; &lt;code&gt;phone_ok&lt;/code&gt; is true &lt;strong&gt;and&lt;/strong&gt; the person agreed to WhatsApp → &lt;strong&gt;WhatsApp&lt;/strong&gt; node → &lt;em&gt;Send Template&lt;/em&gt;, with &lt;code&gt;phone_whatsapp&lt;/code&gt; as the recipient.&lt;/li&gt;
&lt;li&gt;Otherwise → log it as &lt;strong&gt;Call only&lt;/strong&gt; in your sheet or CRM, so a person phones them instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That second branch matters. A silent failure is how leads disappear: the workflow "ran", nobody got a message, and nobody knows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two things the code can't fix
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Consent.&lt;/strong&gt; Business-initiated WhatsApp messages need the person's opt-in and an approved template. Ask "Can we reply on WhatsApp?" on the form and store the answer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The 24-hour window.&lt;/strong&gt; Free-form replies only work within 24 hours of the customer's last message. Outside it, you need a template.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where this fits
&lt;/h2&gt;

&lt;p&gt;This is the first step in every WhatsApp workflow I build for Indian businesses, before the instant reply, the follow-ups or the CRM update. If you want to see it in context, there's a 2-minute walkthrough of the full workflow on the &lt;a href="https://workflowdecoded.in/automations/whatsapp-follow-up/" rel="noopener noreferrer"&gt;WhatsApp follow-up automation page&lt;/a&gt;, and the template itself is free on &lt;a href="https://n8n.io/workflows/22640" rel="noopener noreferrer"&gt;n8n.io&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you find an input format that breaks it, drop it in the comments and I'll add a case.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Chandan Kumar builds CRM, WhatsApp API and n8n automations for Indian businesses at &lt;a href="https://workflowdecoded.in" rel="noopener noreferrer"&gt;Workflow Decoded&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>n8n</category>
      <category>whatsapp</category>
      <category>javascript</category>
      <category>automation</category>
    </item>
    <item>
      <title>How I reply to IndiaMART leads in under a minute with n8n, WhatsApp and a Google Sheet</title>
      <dc:creator>Chandan Kumar</dc:creator>
      <pubDate>Sat, 05 Dec 2026 07:56:13 +0000</pubDate>
      <link>https://dev.to/chandan_kumar_04fbeac3907/how-i-reply-to-indiamart-leads-in-under-a-minute-with-n8n-whatsapp-and-a-google-sheet-1b9l</link>
      <guid>https://dev.to/chandan_kumar_04fbeac3907/how-i-reply-to-indiamart-leads-in-under-a-minute-with-n8n-whatsapp-and-a-google-sheet-1b9l</guid>
      <description>&lt;p&gt;If you sell chemicals, machines or packaging on IndiaMART, you already know the pattern: a buyer sends an enquiry, often contacts several other suppliers at the same time, and talks to whoever replies first with something useful.&lt;/p&gt;

&lt;p&gt;Most small sellers don't lose those buyers on price. They lose them in the first hour. The enquiry sits in an email or the IndiaMART app, nobody owns it, one call goes unanswered and that's the end of it.&lt;/p&gt;

&lt;p&gt;I've set up lead flows like this for B2B sellers for a few years. Here's the n8n workflow I now use as a starting point. It costs very little to run and takes an afternoon to build.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the workflow does
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Receives every IndiaMART enquiry in real time&lt;/strong&gt; through IndiaMART's Lead Manager Push API.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cleans the data&lt;/strong&gt; (phone number to E.164, product name, city, quantity if given).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checks for duplicates&lt;/strong&gt; in a Google Sheet, so a buyer who enquires twice isn't treated as two leads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assigns an owner&lt;/strong&gt; by product or round robin.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sends the buyer a WhatsApp template within a minute&lt;/strong&gt; through the official WhatsApp Business (Cloud) API.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Notifies the owner&lt;/strong&gt; on WhatsApp with the buyer's details.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reminds the owner&lt;/strong&gt; on day 1, 3 and 7 until the lead is marked contacted, won or lost.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 1: Get leads in with the IndiaMART Push API
&lt;/h2&gt;

&lt;p&gt;Paid IndiaMART sellers can push each new lead to a webhook. In n8n, add a &lt;strong&gt;Webhook&lt;/strong&gt; node (POST), copy its production URL, and paste it on IndiaMART's Push API integration page. Choose "others" as your CRM if yours isn't listed.&lt;/p&gt;

&lt;p&gt;Two things to know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IndiaMART provides the Push API in do-it-yourself mode. Their team won't connect it for you.&lt;/li&gt;
&lt;li&gt;There's also a Pull API that fetches leads on a schedule. Its key expires if it isn't used for 7 days, so the Push API is the better choice for a real-time reply.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;JustDial leads can come in the same way through a webhook set up on the JustDial account, which makes it easy to merge both sources into one flow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Normalise and de-duplicate
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Code&lt;/strong&gt; node turns IndiaMART's payload into a clean object:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// The Push API wraps the lead in RESPONSE; check your own payload first&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;RESPONSE&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nv"&gt;$json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;RESPONSE&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nv"&gt;$json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nv"&gt;$json&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;phone&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;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;SENDER_MOBILE&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&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;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="no"&gt;D&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&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;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;10&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="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'IndiaMART'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;SENDER_NAME&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;'there'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;phone&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="s1"&gt;'91'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;phone&lt;/span&gt; &lt;span class="p"&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;product&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;QUERY_PRODUCT_NAME&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;SENDER_CITY&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&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;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;QUERY_MESSAGE&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;received_at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;QUERY_TIME&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="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toISOString&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="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then a &lt;strong&gt;Google Sheets&lt;/strong&gt; lookup on the phone column. If the buyer already exists and was contacted in the last 3 days, skip the auto-reply and just notify the owner.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Assign an owner
&lt;/h2&gt;

&lt;p&gt;For small teams, a round robin is enough. I keep a tiny "owners" tab in the same sheet with a counter, read it, pick the next person, and write the counter back. For sellers with technical products, a &lt;strong&gt;Switch&lt;/strong&gt; node on the product name routes the lead to the right person instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Reply on WhatsApp within a minute
&lt;/h2&gt;

&lt;p&gt;Use an &lt;strong&gt;HTTP Request&lt;/strong&gt; node to call the WhatsApp Cloud API with an approved template. Keep the template about the enquiry, not a pitch:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Namaste {buyer name}, thanks for your enquiry about {product} on IndiaMART. I'm {salesperson} from {company}. Could you share the quantity and delivery city? I'll send you a quote today.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Messages like this go out as utility templates. In India, Meta lists utility messages at about ₹0.115 each (December 2026), which is pocket change next to the value of one B2B order. Promotional wording pushes a template into the marketing category, which costs more, so keep it plain.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Tell the owner and set reminders
&lt;/h2&gt;

&lt;p&gt;A second WhatsApp message goes to the owner with the buyer's name, product, city and a tap-to-call link. A &lt;strong&gt;Schedule Trigger&lt;/strong&gt; workflow runs every morning, reads the sheet, and reminds owners about leads that are still "new" or "follow-up" on day 1, 3 and 7. After day 7 the owner marks the lead won, lost or later, with a reason.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Watch one number
&lt;/h2&gt;

&lt;p&gt;The only metric I ask sellers to watch at first: &lt;strong&gt;what share of leads got a first human call or message within 5 minutes.&lt;/strong&gt; When that goes up, everything downstream improves.&lt;/p&gt;

&lt;h2&gt;
  
  
  Error handling (don't skip this)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;An &lt;strong&gt;Error Trigger&lt;/strong&gt; workflow that sends a WhatsApp or email to a named person when any step fails.&lt;/li&gt;
&lt;li&gt;A retry on the WhatsApp HTTP node for temporary errors.&lt;/li&gt;
&lt;li&gt;A daily "leads received vs leads replied" count, so silent failures show up the next morning.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;I've published related workflows in the official n8n template library, including one that sends instant WhatsApp confirmations for new enquiries and one that sends WhatsApp follow-ups and sorts replies with OpenAI. You can import them from my n8n creator profile: &lt;a href="https://n8n.io/creators/workflowdecoded/" rel="noopener noreferrer"&gt;https://n8n.io/creators/workflowdecoded/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I wrote a longer, non-technical version of this for business owners, with a follow-up cadence table, here: &lt;a href="https://workflowdecoded.in/indiamart-justdial-leads-reply-fast.html" rel="noopener noreferrer"&gt;https://workflowdecoded.in/indiamart-justdial-leads-reply-fast.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you're building something similar and get stuck on the IndiaMART payload or WhatsApp templates, ask in the comments. Happy to help.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I run Workflow Decoded, a small automation studio in Noida that sets up CRMs, the WhatsApp Business API and n8n workflows for Indian businesses.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>n8n</category>
      <category>automation</category>
      <category>whatsapp</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
