How to Deploy a WhatsApp Bot: Free Hosting, Panels, Termux, Vercel and VPS
By Erfan Ahmed, founder of Erfan MD · Updated October 2026
To deploy a WhatsApp bot, you run its code on a computer that stays online and keep its session or webhook connected. This guide compares the main places to host a WhatsApp bot, including free hosting, hosting panels, Termux on Android, Vercel, Railway, Replit and an Ubuntu VPS. It also gives the commands, the common traps of "24/7 free" claims, and fixes for the problems people hit most.
First, Know How Your Bot Connects
Hosting advice only makes sense once you know which type of bot you have, because the two types need different servers.
- Webhook bots (official Cloud API): Meta calls a web address on your server each time a message arrives. The server can sleep between messages, so serverless platforms such as Vercel work.
- Linked-device bots (Baileys-style bots): The bot holds a live connection open all day, like WhatsApp Web. It needs an always-on server and a session folder that survives restarts.
Choosing a platform built for short requests for a bot that must stay connected is the most common reason bots "keep disconnecting".
Where to Host a WhatsApp Bot: Comparison
| Option | Cost | Good for | Main catch |
|---|---|---|---|
| Termux on Android | Free | Learning and testing | Phone sleeps, loses signal, drains battery |
| Free cloud tiers (Render, Railway, Replit, Koyeb and similar) | Free or trial credits | Short experiments | Apps may sleep, credits run out, limits change |
| Vercel and serverless | Free tier available | Webhook (Cloud API) bots | Cannot keep a live connection open |
| Hosting panel | Free or cheap | Beginners with ready bots | You trust the panel owner with your session |
| VPS (Ubuntu) | Low monthly fee | Reliable 24/7 bots | You manage updates and security |
| Docker on any server | Same as server | Repeatable, portable setups | Needs basic Docker knowledge |
Free plans change often. Some platforms have removed their free tiers in the past, so check each provider's current terms before you build around one.
Prepare Your Bot Before Deploying
- Get it running locally first. Run it on your computer and confirm it replies.
- Move secrets into environment variables: API keys, tokens and owner numbers should never be written into the code or pushed to GitHub.
- Check the Node.js version the project asks for in its documentation or
package.json. - Note extra tools such as FFmpeg, which sticker and media features often need.
- Keep session files out of version control. Add the session or auth folder to
.gitignore.
Deploy a WhatsApp Bot on Termux (Android)
Termux gives you a Linux terminal on your phone. It is popular for searches like "WhatsApp bot Termux commands" or "Termux WhatsApp bot GitHub" because it costs nothing. Install Termux from F-Droid or its official GitHub releases, since the Play Store version is outdated. Then run:
pkg update && pkg upgrade
pkg install git nodejs ffmpeg
git clone https://github.com/your-name/your-bot.git
cd your-bot
npm install
termux-wake-lock
npm startUse only a repository you have read or trust, since you are running its code with access to your session. termux-wake-lock asks Android to keep Termux awake, but phones still kill background apps, so Termux suits learning more than customer service. Turn off battery optimization for Termux and keep the phone charging.
Deploy on an Ubuntu VPS With PM2
A small Ubuntu VPS is the most dependable way to host a WhatsApp bot for 24/7 use. After connecting over SSH:
sudo apt update && sudo apt upgrade -y
sudo apt install -y git ffmpeg
# install Node.js (LTS) using nvm or NodeSource, then:
git clone https://github.com/your-name/your-bot.git
cd your-bot && npm install
sudo npm install -g pm2
pm2 start index.js --name wa-bot
pm2 save
pm2 startupPM2 restarts the bot if it crashes and, with pm2 startup, after the server reboots. Use pm2 logs wa-bot to read errors and pm2 restart wa-bot after changes. Protect the server: use SSH keys, keep the system updated and open only the ports you need.
Deploy With Docker
Docker packages the bot and its tools so it runs the same everywhere. A basic setup for a Node.js bot looks like this:
FROM node:lts-slim
RUN apt-get update && apt-get install -y ffmpeg git && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package*.json ./
RUN npm install --omit=dev
COPY . .
CMD ["node", "index.js"]Run it with docker run -d --restart unless-stopped -v bot-session:/app/session --env-file .env wa-bot. The volume matters: without it, the session is lost when the container is recreated and you must pair again.
Deploy on Vercel, Railway and Replit
Vercel
Vercel runs code in short bursts, so it is a good home for a Cloud API webhook that replies to each message. It is a poor fit for linked-device bots that need a connection open all day. If you deploy a webhook there, set your tokens as environment variables and point Meta's webhook setting at the deployed URL.
Railway
Railway deploys from a GitHub repository and supports always-on services, which suits linked-device bots. It has used trial credits and paid plans rather than a permanent free tier, so check current terms. Add a persistent volume for the session folder.
Replit
Replit is convenient for learning because you edit and run in the browser. Free projects can stop when idle, so a "24/7" bot usually needs a paid deployment type. Check Replit's current plans.
Hosting Panels and "Free Deploy" Sites
Many people search "WhatsApp bot hosting panel free" or "WhatsApp bot deploy panel". These are dashboards, often built on game-server software, where you upload a bot, enter your settings and start it. They are easy, but think carefully:
- The panel owner can see your files, including your session and keys.
- Free panels vanish without warning, and your session goes with them.
- Do not use your main number on a panel you cannot verify.
- Never pay for access through a link shared in a random group.
Keeping the Bot Online: Realistic Advice
Some guides tell you to ping a free host every few minutes to stop it sleeping. This may break the host's rules, and it still does not fix a platform that restarts your app. For a bot that matters, pay a small monthly fee for a server that does not sleep. Then add:
- Process management: PM2 or Docker restart policies.
- Monitoring: an uptime checker that alerts you by email or message.
- Backups: a copy of the session folder and your configuration.
- Logs: check them weekly for repeated errors.
Common Deployment Problems and Fixes
| Problem | Likely cause | Fix |
|---|---|---|
| Build or npm install fails | Wrong Node.js version or missing tools | Match the required Node version and install build tools |
| Bot logs out after every restart | Session folder not saved | Use a persistent volume or disk |
| Bot goes offline after a while | Free tier sleeping or credits used up | Move to an always-on paid host |
| Stickers or media fail | FFmpeg missing | Install FFmpeg on the server |
| Webhook not receiving messages | Wrong URL, verify token or subscription | Recheck the callback URL and the messages subscription in Meta settings |
| Termux bot stops in the background | Android battery optimization | Disable it for Termux and use wake lock |
| Bot works then loses connection | Session conflict or WhatsApp restriction | Remove old linked devices and pair again |
Security and Ban Checklist
- Use a spare number for experiments.
- Keep tokens in environment variables and rotate them if exposed.
- Read third-party code or use sources you trust.
- Limit message volume, and only message people who expect to hear from you.
Which Host Should You Pick?
- Just learning: Termux or a free tier.
- Official Cloud API bot: Vercel or any small server.
- Linked-device bot for real use: a VPS with PM2 or Docker.
- No server skills: a service that hosts it for you.
Related guides: how to create a WhatsApp bot, WhatsApp bot pair code, WhatsApp bot GitHub guide and free WhatsApp bot.
Frequently Asked Questions
Can I deploy a WhatsApp bot for free?
Yes, for testing, using Termux or free cloud tiers. Free hosting often sleeps or has limits, so it is unreliable for customers.
Can I host a WhatsApp bot on Vercel?
You can host a Cloud API webhook bot on Vercel. Bots that need a constant live connection do not suit it.
What is the best hosting for a WhatsApp bot?
A small VPS running the bot under PM2 or Docker is the most dependable option for a 24/7 bot.
Why does my bot disconnect after a few hours?
Common causes are a sleeping free host, a lost session folder, or a conflict with another linked device.
Is it safe to use a hosting panel?
Only if you trust the owner, since they can access your files and session. Use a spare number if unsure.
Don't want to manage a server?
With Erfan MD you choose a server, enter your number and link it with a pairing code. There is no hosting setup on your side.
Explore Erfan MD