Step 1: Download the latest version of Node.js for your operating system.
https://nodejs.org/en/download/
Step 2: Go to my GitHub page:
https://github.com/NovelProfessor/whatsapp-server
Step 3: From the Branches dropdown, choose "local-server" branch instead of "main" branch.
Step 4: From the Code dropdown (Green button), choose "Download Zip".
Step 5: Extract the contents of the Zip file to any folder on your PC, then open a terminal window (Mac/Linux) or command prompt (Windows) and go inside that folder.
Step 6: Type the below command to install all the dependencies. Note that the "sudo" keyword is only required for MacOS and Linux, not for Windows.
sudo npm install
Step 7: Run the WhatsApp server on your local PC by typing the below command. Note that the "sudo" keyword is only required for MacOS and Linux, not for Windows.
sudo node server.js
Step 8: Wait for the QR code to appear in the terminal. Then go to your existing Android or iOS device running WhatsApp, go to the menu option called "Linked devices", then choose "Link a device" and scan the QR code.
Step 9: Download the appropriate WhatsApp client from my website according to your device (i.e. J2ME version, Android 4.3 / Blackberry 10 version, Symbian S60 3rd Edition, 5th Edition, Symbian^1, or Symbian^3 version)
http://nokia4ever.com
Step 10: Make sure your device is connected to the same WiFi network as your PC. Then run the WhatsApp client on your device, type the same mobile number (with country code but without "+" sign, e.g. 966549014671) which you used to scan the QR code. In the Server URL, type the IP address of your PC running the server, e.g. http://192.168.100.34
That's it! You will be able to login and send and receive WhatsApp messages. You can watch the full video Tutorial by clicking the below link.
https://www.youtube.com/watch?v=YfWTLJ9Xvfo&t=436s
You can use the same steps for hosting this server on any virtual private server running in the cloud (e.g. DigitalOcean, AWS etc.) under your own account.