Node.js
WhatsApp bots on Node.js.
What the runtime gives you, what 256 MB will and will not carry, and the warning that applies whichever language you pick.
We will host it. We do not recommend it.
Automating a personal WhatsApp account is not something WhatsApp supports. The tools that do it work by pretending to be the official app, they break whenever the protocol changes, and using one can get your number banned — sometimes permanently, sometimes without warning, and always without an appeal you can rely on.
That risk is yours, not ours. We accept no responsibility for a number, an account, or a set of contacts lost while running a bot hosted here, and nothing on this page should be read as advice that it is safe to do. If losing the number would be a problem, do not use one you care about.
If your use is commercial, the officially supported business API exists precisely so you do not have to take that risk, and a bot that receives its messages through official channels has no ban exposure of this kind at all.
Deploying
Getting it running
- 1
Upload your project
Drag the folder into the file manager or push it over SFTP, and leave node_modules behind. It is installed on deploy, and uploading it would spend disk you are going to want for session state.
- 2
Dependencies install themselves
Your package.json is read and installed before the bot starts. Pin your versions here rather than floating them: in this corner of the ecosystem a minor release can change behaviour that matters.
- 3
Point us at your entry file
Usually index.js. Anything sensitive belongs in an environment variable, and your session directory belongs in your project folder where it survives a restart.
Memory
What actually fits in 256 MB
Node's baseline is small, which is the main reason this works at all on a free allocation. A socket-based client that keeps a connection open and reacts to messages is comfortable in 256 MB, and the runtime is out of your way for most of it.
What does not fit is any approach that starts a browser. Node makes it very easy to pull in a package that quietly downloads a browser engine on install, and the first sign of trouble is a deploy that fills your disk followed by a process that will not start. If your install step is downloading hundreds of megabytes, that is what is happening.
The Node-specific memory trap after that is buffering media. Reading an incoming file into a Buffer holds all of it in memory at once, and WhatsApp carries video. Stream it to disk instead, do the work there, and delete it — 512 MB of disk absorbs what 256 MB of memory will not.
Long-running socket clients also leak through listeners. Every reconnect that re-registers handlers without removing the old ones adds another copy, and a bot that reconnects a hundred times a week will be killed by the accumulation rather than by any single message.
FAQ
Questions
Will a WhatsApp bot fit in 256 MB on Node?
If it talks over a socket, yes, with room to spare. If it drives a browser, no, and not because of anything you can tune — a browser engine wants more memory than the entire allocation before your bot has done anything.
How do I stop having to re-pair after every restart?
Write your session state to a directory inside your project rather than keeping it in memory. Your files persist across restarts, crashes and redeploys, so a bot that saves its credentials reconnects on its own and one that does not will ask you to pair again every time.
Can I write it in TypeScript?
Yes. Compile it to JavaScript before you upload and point us at the compiled entry file. The server runs the JavaScript output, the same as it would anywhere.
Is Node safer than Python for this?
It is better supplied and a little lighter on memory. It is not safer. The ban risk described above comes from automating an account at all, and it is identical whichever runtime you choose.
Am I covered if the account is banned?
No. We host the process; the account and the number are yours, and we accept no responsibility for losing either. That is stated in the terms of service as well as on this page.
More on WhatsApp bots
Hosting something else?