<?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: Deepak Padliya</title>
    <description>The latest articles on DEV Community by Deepak Padliya (@deepak_padliya_72bbc2219d).</description>
    <link>https://dev.to/deepak_padliya_72bbc2219d</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3683138%2F8134cd50-db57-4628-aa90-264e67fe0d4c.jpg</url>
      <title>DEV Community: Deepak Padliya</title>
      <link>https://dev.to/deepak_padliya_72bbc2219d</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/deepak_padliya_72bbc2219d"/>
    <language>en</language>
    <item>
      <title>🎉 WhatsApp Message Automation for New Year Greetings with Node.js🎉</title>
      <dc:creator>Deepak Padliya</dc:creator>
      <pubDate>Sun, 28 Dec 2025 20:46:33 +0000</pubDate>
      <link>https://dev.to/deepak_padliya_72bbc2219d/whatsapp-message-automation-for-new-year-greetings-with-nodejs-4hbj</link>
      <guid>https://dev.to/deepak_padliya_72bbc2219d/whatsapp-message-automation-for-new-year-greetings-with-nodejs-4hbj</guid>
      <description>&lt;p&gt;The new year is the perfect time to reach out to your friends, family, and contacts. But manually sending messages to dozens or hundreds of people can be exhausting.  &lt;/p&gt;

&lt;p&gt;In this tutorial, you’ll learn how to &lt;strong&gt;automate sending Happy New Year messages on WhatsApp&lt;/strong&gt; using &lt;strong&gt;Node.js&lt;/strong&gt; and &lt;strong&gt;&lt;a href="https://www.npmjs.com/package/whatsapp-web.js" rel="noopener noreferrer"&gt;whatsapp-web.js&lt;/a&gt;&lt;/strong&gt; — entirely locally and securely.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Important:&lt;/strong&gt; This automation runs entirely on your computer. Your WhatsApp account remains private, and your credentials are never shared.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Step 1: Install Node.js
&lt;/h2&gt;

&lt;p&gt;We’ll use &lt;strong&gt;Node.js v18 LTS&lt;/strong&gt; or higher.&lt;/p&gt;

&lt;h3&gt;
  
  
  macOS
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install Homebrew if not already&lt;/span&gt;
/bin/bash &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh]&lt;span class="o"&gt;(&lt;/span&gt;https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="c"&gt;# Install Node 18&lt;/span&gt;
brew &lt;span class="nb"&gt;install &lt;/span&gt;node@18
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'export PATH="/usr/local/opt/node@18/bin:$PATH"'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.zshrc
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.zshrc

&lt;span class="c"&gt;# Verify installation&lt;/span&gt;
node &lt;span class="nt"&gt;-v&lt;/span&gt;
npm &lt;span class="nt"&gt;-v&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Windows
&lt;/h3&gt;

&lt;p&gt;Download Node.js LTS (v18 or higher) from nodejs.org&lt;br&gt;
 and run the installer.&lt;/p&gt;

&lt;p&gt;Make sure “Add to PATH” is checked.&lt;br&gt;
Verify installation in PowerShell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node -v
npm -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Set Up Project Folder and Install Dependencies
&lt;/h2&gt;

&lt;h3&gt;
  
  
  macOS
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir ~/whatsapp-bot
cd ~/whatsapp-bot
npm init -y
npm install whatsapp-web.js qrcode-terminal formdata-node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Windows
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir C:\whatsapp-bot
cd C:\whatsapp-bot
npm init -y
npm install whatsapp-web.js qrcode-terminal formdata-node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Packages Installed:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;whatsapp-web.js → Automates WhatsApp Web&lt;/li&gt;
&lt;li&gt;qrcode-terminal → Displays QR codes in the terminal&lt;/li&gt;
&lt;li&gt;formdata-node → Provides File polyfill for Node.js environments&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 3: Create the Automation Script
&lt;/h2&gt;

&lt;p&gt;Create a file named contacts2025_send.js in your project folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { Client, LocalAuth } = require('whatsapp-web.js');

const client = new Client({
  authStrategy: new LocalAuth({ clientId: 'default' }),
  puppeteer: { headless: false } // Opens Chrome for authentication
});

client.on('ready', async () =&amp;gt; {
  console.log('✅ WhatsApp Web authenticated');

  const chats = await client.getChats();
  const contacts2025 = [];

  for (const chat of chats) {
    if (chat.isGroup) continue; // skip groups; remove this line to include groups

    const messages = await chat.fetchMessages({ limit: 50 });
    for (const msg of messages) {
      if (!msg.fromMe) {
        const msgDate = new Date(msg.timestamp * 1000);
        if (msgDate.getFullYear() === 2025) {
          contacts2025.push({ id: chat.id._serialized, name: chat.name || chat.id._serialized });
          break;
        }
      }
    }
  }

  console.log('Contacts who messaged you in 2025:');
  contacts2025.forEach(c =&amp;gt; console.log(c.name));

  for (const contact of contacts2025) {
    await client.sendMessage(contact.id, '🎉 Happy New Year! 🎉');
    console.log(`Message sent to ${contact.name}`);
    await new Promise(r =&amp;gt; setTimeout(r, 5000)); // 5-second delay
  }

  client.destroy();
});

client.initialize();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Run the Script
&lt;/h2&gt;

&lt;h3&gt;
  
  
  macOS
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~/whatsapp-bot
node contacts2025_send.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Windows
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd C:\whatsapp-bot
node contacts2025_send.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Workflow:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;The first time you run it, a QR code will appear in the terminal.
Open WhatsApp → Linked Devices → Link a Device → Scan QR code.&lt;/li&gt;
&lt;li&gt;The session is saved locally using LocalAuth. Future runs won’t require scanning the QR code again.&lt;/li&gt;
&lt;li&gt;The script automatically sends Happy New Year messages to all contacts who messaged you in 2025.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 5: Optional Enhancements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Include Groups: Remove the line:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;if (chat.isGroup) continue;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Personalized Messages:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;await client.sendMessage(contact.id, `🎉 Happy New Year, ${contact.name}! 🎉`);&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Adjust Delays: Increase the setTimeout duration to avoid WhatsApp rate limits.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Logging: Save sent messages to a log file for tracking.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>whatsapp</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
