<?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>5 Problems I Hit Running a WhatsApp AI Bot 24/7 on Windows - And How I Fixed Them</title>
      <dc:creator>ZeroCost Tech</dc:creator>
      <pubDate>Mon, 21 Sep 2026 19:49:51 +0000</pubDate>
      <link>https://dev.to/zerocosttech/5-problems-i-hit-running-a-whatsapp-ai-bot-247-on-windows-and-how-i-fixed-them-2570</link>
      <guid>https://dev.to/zerocosttech/5-problems-i-hit-running-a-whatsapp-ai-bot-247-on-windows-and-how-i-fixed-them-2570</guid>
      <description>&lt;p&gt;Running a WhatsApp AI bot locally sounds simple:&lt;/p&gt;

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

&lt;p&gt;In practice, keeping it running reliably 24/7 on a Windows PC taught me a few things the hard way.&lt;/p&gt;

&lt;p&gt;Here are 5 problems I ran into — and how I fixed them.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The bot stopped when the terminal closed
&lt;/h2&gt;

&lt;p&gt;During development, running &lt;code&gt;node index.js&lt;/code&gt; worked perfectly.&lt;/p&gt;

&lt;p&gt;But the moment the terminal was closed, the bot disappeared with it.&lt;/p&gt;

&lt;h3&gt;
  
  
  The fix
&lt;/h3&gt;

&lt;p&gt;Use a process manager such as PM2:&lt;/p&gt;

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

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

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

&lt;p&gt;And save the process list:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pm2 save&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This makes the bot much easier to manage and restart.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. WhatsApp kept asking me to scan the QR code
&lt;/h2&gt;

&lt;p&gt;Scanning a QR code every time the bot starts isn't practical for a machine that's supposed to run 24/7.&lt;/p&gt;

&lt;h3&gt;
  
  
  The fix
&lt;/h3&gt;

&lt;p&gt;With &lt;code&gt;whatsapp-web.js&lt;/code&gt;, use persistent local authentication:&lt;/p&gt;

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

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

&lt;p&gt;The authentication session is stored locally, so normal restarts don't require pairing the account again.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Ollama worked — but responses were painfully slow
&lt;/h2&gt;

&lt;p&gt;A local LLM means no paid AI API, but your hardware now does the inference.&lt;/p&gt;

&lt;p&gt;Running a model that's too large can make a WhatsApp bot feel unusable.&lt;/p&gt;

&lt;h3&gt;
  
  
  The fix
&lt;/h3&gt;

&lt;p&gt;Start with a smaller model.&lt;/p&gt;

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

&lt;p&gt;&lt;code&gt;ollama run llama3.2:3b&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then test response time before moving to something larger.&lt;/p&gt;

&lt;p&gt;For a chat bot, a fast smaller model can be more useful than a smarter model that takes forever to answer.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. One failure could crash the whole bot
&lt;/h2&gt;

&lt;p&gt;Network requests fail.&lt;/p&gt;

&lt;p&gt;Ollama may temporarily be unavailable.&lt;/p&gt;

&lt;p&gt;Messages may contain unexpected content.&lt;/p&gt;

&lt;p&gt;Without error handling, one bad request can take down a bot that's supposed to run unattended.&lt;/p&gt;

&lt;h3&gt;
  
  
  The fix
&lt;/h3&gt;

&lt;p&gt;Treat every external operation as something that can fail.&lt;/p&gt;

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

&lt;p&gt;&lt;code&gt;try { const response = await askOllama(message.body); await message.reply(response); } catch (error) { console.error('Bot error:', error); }&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Also log failures instead of silently ignoring them.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. "$0/month" doesn't mean "zero resources"
&lt;/h2&gt;

&lt;p&gt;This was an important distinction.&lt;/p&gt;

&lt;p&gt;The setup can avoid:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;VPS hosting fees&lt;/li&gt;
&lt;li&gt;Paid AI API fees&lt;/li&gt;
&lt;li&gt;Cloud compute bills&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But the Windows machine still needs to remain powered on and connected to the internet.&lt;/p&gt;

&lt;p&gt;For me, that's the useful part of this architecture: reuse hardware you already own instead of paying for another server every month.&lt;/p&gt;




&lt;h2&gt;
  
  
  The final setup
&lt;/h2&gt;

&lt;p&gt;The architecture ended up being surprisingly small:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WhatsApp → whatsapp-web.js → Node.js → Ollama → Local LLM&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;No paid AI API.&lt;/p&gt;

&lt;p&gt;No monthly hosting subscription.&lt;/p&gt;

&lt;p&gt;If you want the complete Windows setup, source code, configuration, and step-by-step instructions, I put everything together here:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Complete WhatsApp AI Bot Setup Guide + Code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://payhip.com/b/VMK8o?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=sale2&amp;amp;utm_content=5_problems" rel="noopener noreferrer"&gt;https://payhip.com/b/VMK8o?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=sale2&amp;amp;utm_content=5_problems&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you're building something similar, I'd also be interested to hear what problems you ran into.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>node</category>
      <category>javascript</category>
      <category>windows</category>
    </item>
    <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?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=sale2" rel="noopener noreferrer"&gt;https://payhip.com/b/VMK8o?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=sale2&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>
