Skip to main content

Introduction

This guide covers creating and deploying WhatsApp bots on Shard Cloud using the whatsapp-web.js library.
WhatsApp bots work by connecting to WhatsApp Web. Your phone must stay connected to the internet for the bot to work.

Creating Your Bot

Setup

Basic Bot Code

index.js

Package.json

package.json

Authentication

When you first run the bot, it will generate a QR code (qrcode.png). You need to:
  1. Download the QR code from Shard Cloud’s file manager
  2. Scan it with WhatsApp on your phone (Settings → Linked Devices → Link a Device)
  3. Once authenticated, the session is saved and you won’t need to scan again
The LocalAuth strategy saves the session in a .wwebjs_auth folder. This persists between restarts.

Shard Cloud Configuration

.shardcloud
WhatsApp bots require more memory due to Puppeteer. Use at least 512MB-1024MB.

Deploying

1

Prepare Your Files

Ensure you have:
  • index.js
  • package.json
  • .shardcloud
2

Exclude Unnecessary Files

Remove: node_modules/, package-lock.json
3

Create ZIP Archive

Compress your project folder.
4

Upload to Shard Cloud

Go to Shard Cloud Dashboard and upload.
5

Authenticate

After first start, download the QR code from the file manager and scan with WhatsApp.

Additional Resources

Visit the whatsapp-web.js documentation for more information.

Troubleshooting

  • Ensure Puppeteer has enough memory (1024MB+)
  • Check logs for Chromium errors
  • Ensure your phone stays connected to the internet
  • Keep the WhatsApp app open on your phone
Make sure you’re using the --no-sandbox and --disable-setuid-sandbox flags.