Introduction
To develop and host a WhatsApp bot on Square Cloud, it’s essential to follow a structured sequence of configurations and prerequisites. This technical guide will cover the entire process, from initial setup to production deployment.Prerequisites
- Square Cloud Account: Register through the signup page using your email.
- Active plan: Ensures dedicated resources and optimized performance for your application. Check our available plans and choose the most suitable for your needs.
Create the project
You need WhatsApp installed on your phone to link the bot to your account. If you don’t have the app, visit the official WhatsApp website for download and setup.- Node.js verification: Confirm that Node.js is installed on your system. Otherwise, download it from the official Node.js website.
- Project initialization: Set up a new Node.js project by running the initialization command:
Terminal
- Dependencies installation: Install the essential libraries for bot functionality:
Terminal
Develop the bot
Create theindex.js file with the bot’s base structure:
index.js
Configure Square Cloud
Create asquarecloud.app file at the root of your project, next to index.js. It tells Square Cloud how to run your bot:
squarecloud.app
MEMORYis the bot’s RAM in MB. whatsapp-web.js runs a headless Chromium browser, so give it at least 1024 MB.AUTORESTART=truestarts the bot again if it crashes. See how auto restart works.- There is no
SUBDOMAIN: the bot doesn’t serve web pages.
What goes in the ZIP
index.jsand your other source files.package.json.squarecloud.app.
node_modules: Square Cloud installs your dependencies when the bot starts. Also leave out the .wwebjs_auth and .wwebjs_cache folders that a run on your computer creates, so the bot links its own session on Square Cloud. If you upload with the CLI, list both folders in your squarecloud.ignore file.
Deploy and verify
Create the ZIP described above, then upload it:Via dashboard
1
Access the Upload Page
Access the upload page and upload your project zip file.
2
Configure Your Environment
After uploading your zip, you will need to configure the name, main file or runtime environment and other settings for your project.
If you are uploading a web project, make sure to select “Web Publication” and set a subdomain to your project.
If you are uploading a web project, make sure to select “Web Publication” and set a subdomain to your project.
3
Deploy Your Project
Finally, click on the “Deploy” button to host your project on Square Cloud.
After deployment, you can monitor your project’s status and logs from the dashboard.
After deployment, you can monitor your project’s status and logs from the dashboard.

4
Confirm Your App Is Live
Your first deploy usually takes less than a minute. In the dashboard, wait for your application status to show as running and check the logs for any startup errors.
If you deployed a website or API, open
If you deployed a website or API, open
https://<your-subdomain>.squareweb.app in your browser: you should see your application responding. If you deployed a bot, send it a command to confirm it is online.
Via CLI
To use this method, your project needs a configuration file namedsquarecloud.app at its root. It tells Square Cloud how to run your application.
Configuration file guide
Learn how to create the
squarecloud.app configuration file that defines your application’s environment.1
Install the CLI
Install the Square Cloud CLI. If you already have it, run the same command to update it:
2
Log In
Run the command below. It opens your browser: approve the login there and the CLI is ready. There is no API key to copy. For scripts and CI, see CLI authentication.
3
Upload Your Project
From your project folder, run the command below. The CLI zips the current folder, leaving out what To upload a zip you created yourself, pass it with
squarecloud.ignore lists, and uploads it:--file:4
Confirm Your App Is Live
Your first deploy usually takes less than a minute. Check your application status and logs directly from the terminal:If you deployed a website or API, open
https://<your-subdomain>.squareweb.app in your browser: you should see your application responding. If you deployed a bot, send it a command to confirm it is online.
Link your WhatsApp account
Open the application logs in the Square Cloud dashboard. On first boot, the bot prints a QR Code there: on your phone, open WhatsApp, go to Linked devices > Link a device and scan it. TheWhatsApp client successfully initialized! message confirms the session is active. Then send !ping from another number to the linked WhatsApp account and confirm it replies with pong - Bot working correctly!.
LocalAuth saves the session in the .wwebjs_auth folder, so restarts reconnect without a new QR Code. To link a different number, delete that folder and restart the application.
Common errors
The QR Code can’t be scanned
The QR Code is drawn with text characters, and WhatsApp replaces it periodically, so scan the most recent one. If your phone can’t read it, zoom out until the whole code fits on screen, or switch the dashboard to the dark theme.Login stopped working after a WhatsApp Web update
Update the library withnpm install whatsapp-web.js@latest and deploy again. Avoid pinning an old WhatsApp Web version with the webVersionCache option: outdated versions tend to break login.
The bot runs out of memory
whatsapp-web.js runs a headless Chromium browser, which needs memory. KeepMEMORY at 1024 MB or more, or switch to Baileys, which runs without a browser.
Use Baileys instead of whatsapp-web.js
Baileys is an alternative library that connects to WhatsApp’s multi-device API directly over a WebSocket, without launching a headless browser. Since there’s no Chromium/Puppeteer instance to run, it uses significantly less RAM than whatsapp-web.js. Baileys saves its session (thecreds.json file and keys) in the auth folder through useMultiFileAuthState. Square Cloud keeps your application’s files between restarts, so you only need to scan the QR Code again if you log out or delete that folder. As with .wwebjs_auth, leave a local auth folder out of your ZIP.
- Install the library:
Terminal
- Create an
index.jsfile usingmakeWASocketanduseMultiFileAuthStateto load and persist the session:
index.js
MEMORY value than the whatsapp-web.js example above:
squarecloud.app
Next steps
App won't start
Fix missing modules, memory errors and other startup failures.
Evolution API
Run a WhatsApp API that manages many instances at once.
Bot hosting
What Square Cloud offers for bots that run 24/7.

