Square CloudSquare Cloud

How much does it cost to host a WhatsApp bot?

Hosting a WhatsApp bot costs the RAM of a process that runs 24/7, and the library decides how much memory it uses. whatsapp-web.js and WPPConnect load Chromium and need much more RAM than Baileys. A database, AI and, on the official API, the messages Meta bills come on top.

Updated 8 min read

Learning objectives

After reading this article you will be able to:

  • Separate the cost of hosting the process from the cost of Meta's messages
  • Measure how much RAM your bot uses, with and without Chromium
  • Build the monthly bill with database, media, AI and a dedicated number
On this page

A WhatsApp bot produces two bills that people tend to mix up. The first is for the server that keeps the process running day and night. The second is for messages, and it only exists on Meta's official Cloud API. With an unofficial library such as Baileys, whatsapp-web.js or WPPConnect, you pay only the first; with the official API, you pay both, to different companies.

This guide covers hosting and shows where Meta's bill comes in. The memory figures are hypothetical, picked to keep the math simple: they are not measurements or prices from any vendor.

What goes into the cost of a WhatsApp bot?#

Seven items explain almost all of the spend:

  1. Process (RAM and CPU): the bot stays up 24 hours a day to receive messages. It is the fixed item, and the one that changes most with the library.
  2. Persistent disk: the auth folder (the session paired with the phone) is small, but it must survive restarts and deploys.
  3. Media: audio, images and documents the bot downloads or sends.
  4. Database: only if the bot stores customers, orders or history, or if your stack requires one.
  5. Dedicated number: a line just for the bot, separate from your personal number.
  6. Messages: on the Cloud API only, billed by Meta.
  7. AI: tokens, if the bot answers with a language model.

How much RAM does each library use?#

The way the bot connects to WhatsApp sets its memory footprint:

Option How it connects What sits in memory Charges beyond the server
Baileys direct WebSocket, as a linked device the Node.js process none
whatsapp-web.js Puppeteer driving WhatsApp Web in Chromium Node.js plus a full browser none
WPPConnect Puppeteer with WhatsApp Web in Chromium Node.js plus a full browser none
Evolution API REST server that exposes the account as an API (Baileys or Cloud API) Node.js, PostgreSQL or MySQL and, recommended, Redis the database, plus messages if you use the Cloud API
Official Cloud API HTTPS webhook and Graph API calls just your web server messages, billed by Meta

Baileys talks to WhatsApp's servers over a WebSocket, with no browser, which makes it the light option among the unofficial ones. whatsapp-web.js and WPPConnect run the real WhatsApp Web inside a Chromium instance driven by Puppeteer: the API is simple, but the browser stays in memory next to Node.js. The Cloud API keeps no session: your server only receives webhooks and replies, like a small web API. The full comparison is in Baileys vs whatsapp-web.js vs the official WhatsApp API.

How do you measure your bot's memory?#

Measure before you buy. In a bot with Chromium, process.memoryUsage() misleads you: it only sees the Node.js process, while the browser runs in separate processes that also count toward the limit of a VPS or a container. On Linux, this script adds up the resident memory (RSS) of a process and all of its descendants:

bash
#!/usr/bin/env bash
# mem-tree.sh: sums the resident memory (RSS) of a process and all its descendants.
# Usage: ./mem-tree.sh "$(pgrep -of 'node index.js')"
tree() {
  local child
  echo "$1"
  for child in $(pgrep -P "$1"); do tree "$child"; done
}
ps -o rss= -p "$(tree "$1" | paste -sd, -)" |
  awk '{ kb += $1 } END { printf "%d processes, %.0f MB\n", NR, kb / 1024 }'

Save it as mem-tree.sh, run chmod +x mem-tree.sh and replace node index.js with the command that starts your bot. The sum counts the memory that Chromium's processes share more than once, so the result is a conservative ceiling, which is what you want for sizing.

Measure with the bot connected and handling real messages for a few hours, media downloads included. Write down the peak, add 30% headroom and round up to the next tier, as how much RAM and CPU does my app need explains. If the bot goes over the limit, the system kills the process and the log often shows exit code 137; Chromium running out of memory is the classic case, covered in exit code 137, 143 and 1.

What does Meta charge on the official API?#

On the Cloud API, Meta charges per delivered message, with rates that depend on the message category (marketing, utility, authentication or service) and on the recipient's country. The rate card and the rules change over time, so this guide quotes no figures: check Meta's pricing page before you do the math. The guide on what the official WhatsApp API costs explains the categories and includes a script to estimate the month.

Hosting is billed by reserved RAM, not per message; Meta's bill grows with every delivered message. For a high-volume notification bot, it tends to be the biggest line; for a small support bot, hosting may weigh more.

Where should it run: at home, on a VPS or on a platform?#

  • On your own computer: you pay for electricity (watts × 24 × 30 ÷ 1,000 gives the month's kWh), and the bot goes down whenever the machine shuts off or the connection drops.
  • On a VPS: a fixed monthly price, and the work is yours: Node.js, Chromium's system dependencies (for whatsapp-web.js and WPPConnect), a process manager such as systemd and security updates.
  • On a hosting platform: you upload the code and pick the memory. Check that the disk is persistent (otherwise the session disappears on every deploy), that the process never sleeps when idle and that it restarts on its own after a crash.

Serverless doesn't work for Baileys or whatsapp-web.js: both hold a connection open all the time, and a function that only wakes up on requests can't keep it. The Cloud API webhook is plain HTTP. The math between the two models is in serverless or an always-on server, and the step by step is in how to host a WhatsApp bot 24/7.

What hidden costs show up?#

  • A banned number. WhatsApp doesn't authorize unofficial clients, and the number can be banned, taking contacts and history with it. Use a dedicated line, never your main one. See WhatsApp bot banned or not working.
  • Repeated pairing. A disk wiped on every deploy forces you to pair again, with the bot offline until someone picks up the phone.
  • Piled-up media. Files downloaded for processing stay on disk. Delete them after use or move them to object storage.
  • Maintenance. Unofficial libraries have to keep up with WhatsApp's changes, and a late update can disconnect the bot.
  • A database that comes along. Evolution API requires PostgreSQL or MySQL and recommends Redis: two extra lines, even in a small project.
  • AI tokens. A bot that answers with a language model pays per token, and that line can exceed hosting. See WhatsApp AI bot: architecture and costs.

How do you estimate your bot's bill?#

Add up the measured RAM with headroom, disk and database (if any), the variable lines (Meta's messages and AI tokens), the dedicated number and your maintenance hours. Hypothetical example, with made-up numbers for the math: the same support bot written three ways.

Baileys whatsapp-web.js Cloud API
Peak (hypothetical) 180 MB 700 MB 90 MB
With 30% headroom 234 MB 910 MB 117 MB
Session on disk yes yes no
Messages no charge from Meta no charge from Meta Meta's rate card, per delivered message
Ban risk yes yes no unofficial-client risk

In the example, Baileys fits a small memory tier, and whatsapp-web.js needs close to 1 GB on its own. The Cloud API runs the lightest server, but trades the RAM savings for a bill that grows with volume. None of them is cheapest in every case: the library decides the RAM, while message volume and who starts the conversation decide Meta's bill.

How to do this on Square Cloud#

Square Cloud is self-service hosting for bots: you deploy and pick the memory for each application. It works with Baileys, WPPConnect, whatsapp-web.js and the official Cloud API. The auth folder lives on the application's disk, which is persistent: the session stays connected after a restart, and a new deploy overwrites only the files in the ZIP.

Containers are always on, with no idle sleep, and automatic restart, on by default for dashboard deploys, brings back a bot that exits with an error. Running out of memory is different: the application stops and doesn't come back on its own, so raise its RAM and start it again.

Every plan is paid and billed in Brazilian reais. Hobby costs R$12.49 a month with 1 GB of RAM, a pool shared across your applications, with a minimum of 256 MB per bot and 512 MB per web application. With the example's hypothetical numbers, the Baileys bot (234 MB with headroom) fits in the 256 MB minimum; the whatsapp-web.js one (910 MB) takes almost the whole 1 GB, leaving no room for another application, and the 2 GB Hobby, at R$24.99, leaves about 1 GB for the rest. For the Cloud API, the webhook server is a web application, so it reserves at least 512 MB, and it gets an HTTPS squareweb.app subdomain that can serve as Meta's webhook; the messages stay on Meta's bill.

Evolution API runs on the Node.js runtime with PostgreSQL or MySQL, and hosting for those databases starts on Standard, from R$44.99 a month. You install and maintain Evolution API; support covers the hosting, not the software. See the details on WhatsApp bot hosting.

Bot hosting

Keep your bot online 24/7 with automatic restarts

WhatsApp bot hosting

FAQs

How much does it cost to keep a WhatsApp bot online 24/7?

The fixed cost is the RAM the process uses at peak, on a machine that never turns off. A Baileys bot fits a small plan; with whatsapp-web.js or WPPConnect, which run Chromium, it needs much more memory. Official API messages, a database and AI are added on top.

Does whatsapp-web.js use more memory than Baileys?

Yes. whatsapp-web.js drives a Chromium instance through Puppeteer, so a whole browser stays in memory next to Node.js. Baileys talks to WhatsApp over a WebSocket, with no browser, and uses less.

Does the official WhatsApp API have a monthly fee?

Meta's pricing page describes per-message billing for delivered messages, with rates by category and recipient country, and lists no platform subscription. The server that receives the webhook is a separate cost. Check the current rules on the official page.

Do I need a database for a WhatsApp bot?

Not for a simple bot: the session lives in a folder on persistent disk. A database comes in when the bot stores customers, orders or history, or when you run Evolution API, which requires PostgreSQL or MySQL.

Next articleWhich database should your Discord bot use?SQLite fits a small single-process Discord bot. PostgreSQL or MongoDB fit when you have several processes, lots of writes or frequent deploys. Here is how to choose.