{"slug": "5-problems-i-hit-running-a-whatsapp-ai-bot-24-7-on-windows-and-how-i-fixed-them", "title": "5 Problems I Hit Running a WhatsApp AI Bot 24/7 on Windows - And How I Fixed Them", "summary": "A developer documented five reliability problems encountered while running a WhatsApp AI bot 24/7 on a Windows PC, including process persistence, repeated QR-code authentication, local LLM inference speed, and unhandled errors. The fixes rely on PM2 for process management, whatsapp-web.js LocalAuth for persistent sessions, smaller Ollama models such as llama3.2:3b for faster replies, and try/catch error handling around every external call. The resulting architecture runs entirely on owned hardware with no VPS or paid AI API.", "body_md": "Running a WhatsApp AI bot locally sounds simple:\n\nWhatsApp → Node.js → Ollama → done.\n\nIn practice, keeping it running reliably 24/7 on a Windows PC taught me a few things the hard way.\n\nHere are 5 problems I ran into — and how I fixed them.\n\nDuring development, running `node index.js` worked perfectly.\n\nBut the moment the terminal was closed, the bot disappeared with it.\n\nUse a process manager such as PM2:\n\n`npm install -g pm2`\n\nThen:\n\n`pm2 start index.js --name whatsapp-ai-bot`\n\nAnd save the process list:\n\n`pm2 save`\n\nThis makes the bot much easier to manage and restart.\n\nScanning a QR code every time the bot starts isn't practical for a machine that's supposed to run 24/7.\n\nWith `whatsapp-web.js`, use persistent local authentication:\n\n`const { Client, LocalAuth } = require('whatsapp-web.js');`\n\n`const client = new Client({ authStrategy: new LocalAuth() });`\n\nThe authentication session is stored locally, so normal restarts don't require pairing the account again.\n\nA local LLM means no paid AI API, but your hardware now does the inference.\n\nRunning a model that's too large can make a WhatsApp bot feel unusable.\n\nStart with a smaller model.\n\nFor example:\n\n`ollama run llama3.2:3b`\n\nThen test response time before moving to something larger.\n\nFor a chat bot, a fast smaller model can be more useful than a smarter model that takes forever to answer.\n\nNetwork requests fail.\n\nOllama may temporarily be unavailable.\n\nMessages may contain unexpected content.\n\nWithout error handling, one bad request can take down a bot that's supposed to run unattended.\n\nTreat every external operation as something that can fail.\n\n`try { const response = await askOllama(message.body); await message.reply(response); } catch (error) { console.error('Bot error:', error); }`\n\nAlso log failures instead of silently ignoring them.\n\nThis was an important distinction.\n\nThe setup can avoid:\n\nBut the Windows machine still needs to remain powered on and connected to the internet.\n\nFor me, that's the useful part of this architecture: reuse hardware you already own instead of paying for another server every month.\n\nThe architecture ended up being surprisingly small:\n\n**WhatsApp → whatsapp-web.js → Node.js → Ollama → Local LLM**\n\nNo VPS.\n\nNo paid AI API.\n\nNo monthly hosting subscription.\n\nIf you want the complete Windows setup, source code, configuration, and step-by-step instructions, I put everything together here:\n\n👉 **Complete WhatsApp AI Bot Setup Guide + Code**\n\nIf you're building something similar, I'd also be interested to hear what problems you ran into.", "url": "https://wpnews.pro/news/5-problems-i-hit-running-a-whatsapp-ai-bot-24-7-on-windows-and-how-i-fixed-them", "canonical_source": "https://dev.to/zerocosttech/5-problems-i-hit-running-a-whatsapp-ai-bot-247-on-windows-and-how-i-fixed-them-2570", "published_at": "2026-09-21 19:49:51+00:00", "updated_at": "2026-09-21 19:54:38.813500+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "large-language-models", "developer-tools"], "entities": ["WhatsApp", "Windows", "Node.js", "Ollama", "PM2", "whatsapp-web.js", "llama3.2:3b"], "alternates": {"html": "https://wpnews.pro/news/5-problems-i-hit-running-a-whatsapp-ai-bot-24-7-on-windows-and-how-i-fixed-them", "markdown": "https://wpnews.pro/news/5-problems-i-hit-running-a-whatsapp-ai-bot-24-7-on-windows-and-how-i-fixed-them.md", "text": "https://wpnews.pro/news/5-problems-i-hit-running-a-whatsapp-ai-bot-24-7-on-windows-and-how-i-fixed-them.txt", "jsonld": "https://wpnews.pro/news/5-problems-i-hit-running-a-whatsapp-ai-bot-24-7-on-windows-and-how-i-fixed-them.jsonld"}}