Deploying WBOT on a Server
To run WBOT 24/7, it's best to deploy it on a cloud server (VPS). This guide provides a step-by-step walkthrough for deploying WBOT on a DigitalOcean Droplet.
How to deploy WBOT on DigitalOcean
-
Create a DigitalOcean Account Visit DigitalOcean and create an account. New users often receive free credits, which is great for getting started.
-
Create a Droplet (Virtual Machine) After logging in, click on Create > Droplets. This will take you to the Droplet creation page.
-
Choose an Image Select the Ubuntu operating system, preferably the latest LTS version (e.g., 22.04 LTS).
-
Choose a Plan Select a plan that fits your needs. A basic plan with at least 1 GB of RAM is recommended.
-
Choose a Datacenter Region Select a server location that is closest to you for lower latency.
-
Choose an Authentication Method Select the Password method and create a strong root password. Make sure to save this password somewhere secure.
-
Finalize and Create Review your selections and click the Create Droplet button. It will take a minute or two for your server to be provisioned.
-
Connect to Your Droplet via SSH Once the Droplet is created, copy its public IPv4 address. Open a terminal on your local machine and connect to the server using SSH:
ssh root@<your_ipv4_address>
Replace
<your_ipv4_address>
with the IP you copied. You will be prompted for the root password you created earlier. -
Clone the WBOT Repository Once logged into your server, clone the WBOT project from GitHub:
git clone https://github.com/vasani-arpit/WBOT.git cd WBOT
-
Run the Setup Script The repository includes a setup script to install all the necessary dependencies for Node.js and Puppeteer on a fresh Ubuntu system. Run it using:
sh setup/setup.sh
-
Start the Bot After the setup script completes, you can start the bot:
npm start
Important Note for Headless Servers: Since a server doesn't have a graphical interface, you must run the bot with a virtual display like
Xvfb
. First, you may need to install it:sudo apt-get install xvfb
Then, run the bot using:
xvfb-run npm start
-
Initial Setup (QR Scan) For the first run, you need to scan the QR code. To do this, you might need to temporarily set
"headless": false
inbot.json
, but this is tricky on a server. The recommended approach is to: a. Run the bot locally on your own computer first. b. Scan the QR code to create a session file. c. Stop the bot and copy the generated session folder (.wwebjs_auth
or similar) to your server. -
Access the Web Interface (Optional) If you have enabled the Web Interface in your
bot.json
, you can access it by navigating tohttp://<your_ipv4_address>:8080
in your browser. This allows you to modifybot.json
and view messages without needing to SSH into the server.