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

  1. Create a DigitalOcean Account Visit DigitalOcean and create an account. New users often receive free credits, which is great for getting started.

  2. Create a Droplet (Virtual Machine) After logging in, click on Create > Droplets. This will take you to the Droplet creation page.

  3. Choose an Image Select the Ubuntu operating system, preferably the latest LTS version (e.g., 22.04 LTS).

  4. Choose a Plan Select a plan that fits your needs. A basic plan with at least 1 GB of RAM is recommended.

  5. Choose a Datacenter Region Select a server location that is closest to you for lower latency.

  6. Choose an Authentication Method Select the Password method and create a strong root password. Make sure to save this password somewhere secure.

  7. 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.

  8. 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.

  9. 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
  10. 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
  11. 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
  12. 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 in bot.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.

  13. Access the Web Interface (Optional) If you have enabled the Web Interface in your bot.json, you can access it by navigating to http://<your_ipv4_address>:8080 in your browser. This allows you to modify bot.json and view messages without needing to SSH into the server.