<?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: ZeroCost Tech</title>
    <description>The latest articles on DEV Community by ZeroCost Tech (@zerocosttech).</description>
    <link>https://dev.to/zerocosttech</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%2F4079491%2Fdbfa3229-21e9-4d94-b6ad-53ab90553a32.png</url>
      <title>DEV Community: ZeroCost Tech</title>
      <link>https://dev.to/zerocosttech</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zerocosttech"/>
    <language>en</language>
    <item>
      <title>How I Built a WhatsApp AI Bot That Runs for $0/Month on Windows</title>
      <dc:creator>ZeroCost Tech</dc:creator>
      <pubDate>Sat, 15 Aug 2026 21:37:11 +0000</pubDate>
      <link>https://dev.to/zerocosttech/how-i-built-a-whatsapp-ai-bot-that-runs-for-0month-on-windows-4kig</link>
      <guid>https://dev.to/zerocosttech/how-i-built-a-whatsapp-ai-bot-that-runs-for-0month-on-windows-4kig</guid>
      <description>&lt;p&gt;I wanted a simple WhatsApp AI bot without paying every month for cloud hosting or an AI API.&lt;/p&gt;

&lt;p&gt;So I built one that runs on a Windows PC I already have running 24/7.&lt;/p&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WhatsApp integration with Node.js&lt;/li&gt;
&lt;li&gt;Optional local AI using Ollama&lt;/li&gt;
&lt;li&gt;No VPS or cloud server required&lt;/li&gt;
&lt;li&gt;No paid AI API required&lt;/li&gt;
&lt;li&gt;Runs on Windows 10/11&lt;/li&gt;
&lt;li&gt;Can restart automatically after a reboot&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;«The "$0/month" refers to additional software, hosting, and AI API costs. It assumes you already have the PC, internet connection, and electricity.»&lt;/p&gt;

&lt;p&gt;The basic architecture&lt;/p&gt;

&lt;p&gt;The setup is intentionally simple:&lt;/p&gt;

&lt;p&gt;WhatsApp → Node.js bot → Local AI → WhatsApp reply&lt;/p&gt;

&lt;p&gt;The Node.js application handles incoming WhatsApp messages and decides how to respond.&lt;/p&gt;

&lt;p&gt;For AI responses, the bot can send the user's message to a locally running Ollama model and return the generated answer back to WhatsApp.&lt;/p&gt;

&lt;p&gt;That gives us:&lt;/p&gt;

&lt;p&gt;WhatsApp → Node.js → Ollama on localhost → Node.js → WhatsApp&lt;/p&gt;

&lt;p&gt;No cloud AI API is required.&lt;/p&gt;

&lt;p&gt;What you need&lt;/p&gt;

&lt;p&gt;For the basic setup:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows 10 or Windows 11&lt;/li&gt;
&lt;li&gt;Node.js LTS&lt;/li&gt;
&lt;li&gt;A WhatsApp account&lt;/li&gt;
&lt;li&gt;Ollama if you want local AI&lt;/li&gt;
&lt;li&gt;A computer that can stay powered on&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You don't need Kubernetes.&lt;/p&gt;

&lt;p&gt;You don't need AWS.&lt;/p&gt;

&lt;p&gt;You don't need Docker.&lt;/p&gt;

&lt;p&gt;And you don't need to rent a VPS.&lt;/p&gt;

&lt;p&gt;Connecting WhatsApp&lt;/p&gt;

&lt;p&gt;For this project I used "whatsapp-web.js".&lt;/p&gt;

&lt;p&gt;The first time the application starts, it displays a QR code.&lt;/p&gt;

&lt;p&gt;You scan the QR code with WhatsApp, similar to connecting WhatsApp Web.&lt;/p&gt;

&lt;p&gt;After authentication, the application can listen for incoming messages and send replies.&lt;/p&gt;

&lt;p&gt;A simplified example looks like this:&lt;/p&gt;

&lt;p&gt;const { Client, LocalAuth } = require('whatsapp-web.js');&lt;/p&gt;

&lt;p&gt;const client = new Client({&lt;br&gt;
  authStrategy: new LocalAuth()&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;client.on('qr', (qr) =&amp;gt; {&lt;br&gt;
  console.log('Scan the QR code to connect WhatsApp');&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;client.on('ready', () =&amp;gt; {&lt;br&gt;
  console.log('WhatsApp bot is ready');&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;client.on('message', async (message) =&amp;gt; {&lt;br&gt;
  if (message.body.toLowerCase() === 'hello') {&lt;br&gt;
    await message.reply('Hello from the bot!');&lt;br&gt;
  }&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;client.initialize();&lt;/p&gt;

&lt;p&gt;"LocalAuth" stores the authenticated WhatsApp session locally.&lt;/p&gt;

&lt;p&gt;That means you normally don't need to scan the QR code again every time the application restarts.&lt;/p&gt;

&lt;p&gt;Protect the WhatsApp session&lt;/p&gt;

&lt;p&gt;The authentication files should be treated like credentials.&lt;/p&gt;

&lt;p&gt;Do not:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Upload them to GitHub&lt;/li&gt;
&lt;li&gt;Share them with other people&lt;/li&gt;
&lt;li&gt;Include them in downloadable source packages&lt;/li&gt;
&lt;li&gt;Commit your ".env" file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Add sensitive files and directories to ".gitignore".&lt;/p&gt;

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

&lt;p&gt;.env&lt;br&gt;
.wwebjs_auth/&lt;br&gt;
.wwebjs_cache/&lt;br&gt;
node_modules/&lt;/p&gt;

&lt;p&gt;Adding local AI with Ollama&lt;/p&gt;

&lt;p&gt;The next step is connecting the bot to Ollama.&lt;/p&gt;

&lt;p&gt;Ollama runs the language model locally on the Windows machine.&lt;/p&gt;

&lt;p&gt;Instead of calling a paid cloud API, Node.js sends the prompt to Ollama on localhost.&lt;/p&gt;

&lt;p&gt;A simplified request might look like this:&lt;/p&gt;

&lt;p&gt;async function askOllama(prompt) {&lt;br&gt;
  const response = await fetch('&lt;a href="http://localhost:11434/api/generate" rel="noopener noreferrer"&gt;http://localhost:11434/api/generate&lt;/a&gt;', {&lt;br&gt;
    method: 'POST',&lt;br&gt;
    headers: {&lt;br&gt;
      'Content-Type': 'application/json'&lt;br&gt;
    },&lt;br&gt;
    body: JSON.stringify({&lt;br&gt;
      model: 'llama3.2',&lt;br&gt;
      prompt,&lt;br&gt;
      stream: false&lt;br&gt;
    })&lt;br&gt;
  });&lt;/p&gt;

&lt;p&gt;const data = await response.json();&lt;/p&gt;

&lt;p&gt;return data.response;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Then the WhatsApp handler can use it:&lt;/p&gt;

&lt;p&gt;client.on('message', async (message) =&amp;gt; {&lt;br&gt;
  try {&lt;br&gt;
    const answer = await askOllama(message.body);&lt;br&gt;
    await message.reply(answer);&lt;br&gt;
  } catch (error) {&lt;br&gt;
    console.error(error);&lt;br&gt;
    await message.reply('Something went wrong.');&lt;br&gt;
  }&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;Now the flow becomes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A WhatsApp message arrives&lt;/li&gt;
&lt;li&gt;Node.js receives it&lt;/li&gt;
&lt;li&gt;Node.js sends the prompt to Ollama&lt;/li&gt;
&lt;li&gt;Ollama generates the answer locally&lt;/li&gt;
&lt;li&gt;Node.js sends the answer back through WhatsApp&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Choosing a local model&lt;/p&gt;

&lt;p&gt;The model you can run comfortably depends on the hardware.&lt;/p&gt;

&lt;p&gt;Smaller models generally:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Require less RAM&lt;/li&gt;
&lt;li&gt;Respond faster&lt;/li&gt;
&lt;li&gt;Work better on older PCs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Larger models can provide better results for some tasks, but they require more resources.&lt;/p&gt;

&lt;p&gt;For a small personal bot or learning project, starting with a relatively small model is usually the easiest approach.&lt;/p&gt;

&lt;p&gt;Keeping the bot running&lt;/p&gt;

&lt;p&gt;During development, you can simply run:&lt;/p&gt;

&lt;p&gt;node index.js&lt;/p&gt;

&lt;p&gt;But that isn't enough for a machine that should host the bot continuously.&lt;/p&gt;

&lt;p&gt;You want the application to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start automatically&lt;/li&gt;
&lt;li&gt;Restart if it crashes&lt;/li&gt;
&lt;li&gt;Start again after Windows reboots&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One option is using PM2:&lt;/p&gt;

&lt;p&gt;npm install -g pm2&lt;/p&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;p&gt;pm2 start index.js --name whatsapp-ai-bot&lt;/p&gt;

&lt;p&gt;You can check its status with:&lt;/p&gt;

&lt;p&gt;pm2 status&lt;/p&gt;

&lt;p&gt;And view logs with:&lt;/p&gt;

&lt;p&gt;pm2 logs whatsapp-ai-bot&lt;/p&gt;

&lt;p&gt;For a long-running Windows setup, make sure you also configure a reliable startup mechanism so the process returns after a machine reboot.&lt;/p&gt;

&lt;p&gt;What can you build with it?&lt;/p&gt;

&lt;p&gt;Once the basic connection works, you can extend the bot in many directions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AI Q&amp;amp;A&lt;/li&gt;
&lt;li&gt;Group-specific commands&lt;/li&gt;
&lt;li&gt;Personal assistants&lt;/li&gt;
&lt;li&gt;Home automation&lt;/li&gt;
&lt;li&gt;Local knowledge bases&lt;/li&gt;
&lt;li&gt;API integrations&lt;/li&gt;
&lt;li&gt;Custom system prompts&lt;/li&gt;
&lt;li&gt;Different behavior for different groups&lt;/li&gt;
&lt;li&gt;Message summarization&lt;/li&gt;
&lt;li&gt;Simple internal tools&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The WhatsApp connection is really just the interface.&lt;/p&gt;

&lt;p&gt;The interesting part is what you put behind it.&lt;/p&gt;

&lt;p&gt;A note about whatsapp-web.js&lt;/p&gt;

&lt;p&gt;"whatsapp-web.js" is an unofficial integration that works through WhatsApp Web.&lt;/p&gt;

&lt;p&gt;It is not the official WhatsApp Business Platform.&lt;/p&gt;

&lt;p&gt;That makes it convenient for experiments and personal projects, but it also means you should understand the trade-offs before using it for a business-critical or production system.&lt;/p&gt;

&lt;p&gt;For an official commercial integration, the WhatsApp Business Platform is the appropriate route to evaluate.&lt;/p&gt;

&lt;p&gt;Why I built this&lt;/p&gt;

&lt;p&gt;I wanted something that didn't require a cloud account, recurring hosting bill, or complicated infrastructure.&lt;/p&gt;

&lt;p&gt;A Windows machine that was already online could do the job.&lt;/p&gt;

&lt;p&gt;For a developer, the setup is relatively straightforward.&lt;/p&gt;

&lt;p&gt;But there were enough small steps — Node.js setup, WhatsApp authentication, Ollama, configuration, persistent startup, and troubleshooting — that I decided to package the complete process into a beginner-friendly guide.&lt;/p&gt;

&lt;p&gt;Complete step-by-step version&lt;/p&gt;

&lt;p&gt;I created a downloadable guide that includes the full Windows setup and ready-to-run project files.&lt;/p&gt;

&lt;p&gt;It covers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows setup&lt;/li&gt;
&lt;li&gt;Node.js installation&lt;/li&gt;
&lt;li&gt;WhatsApp connection&lt;/li&gt;
&lt;li&gt;Local authentication&lt;/li&gt;
&lt;li&gt;Ollama setup&lt;/li&gt;
&lt;li&gt;Local AI integration&lt;/li&gt;
&lt;li&gt;Configuration&lt;/li&gt;
&lt;li&gt;Running the bot continuously&lt;/li&gt;
&lt;li&gt;Ready-to-use source files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can find it here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://payhip.com/b/VMK8o" rel="noopener noreferrer"&gt;https://payhip.com/b/VMK8o&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you build your own version, I'd be interested to hear what you're using your WhatsApp bot for.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>tutorial</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
