Web WhatsApp automation tool -- using Selenium-webdriver over Socket IO -- lightining fast messaging over WhatsApp.
Earlier I made a project using pusher and selenium-webdriver to automate whatsapp web for sending messages over whatsapp. But it had flaws in it -
- For sending each new message you got to refresh the whole page again and again, which implies a lot a time to send each whatsapp message or file.
- the code highly depended upon css of the DOM, which rapidly keeps changing.
- Most important of all it didn't have proper error handling etc.
Now in the new release following features have been added -
- Lightining speed text and file sending.
- No dependency on DOM of web whatsapp.
- can send to any new mobile number without even refresh.
- you can send seen to any message.
- get all unread messages.
- Use of Socket IO, which makes it's integration with any tech very simple.
- send any file from internet, just by giving link of the file.
- Download and Install NodeJS.
- Download Chrome Driver latest version as per your system. (Mac/Linux/Windows)
- Place the downloaded driver in ChromeDriver Folder in Project.
- Set global path variable for this folder (ChromeDriver folder) in your system.
- Run 'npm install' in root directory of the project.
-
The socket client must send data in following format which contains following parameters as json -- a) To send text messages (country code to be added in start)
EVENT: 'send_text_message' { message: 'YOUR MESSAGE HERE', mobile_number: '91XXXXXXXXXX' }
b) To send files (country code to be added in start)
EVENT: 'send_file_message' { message: 'YOUR MESSAGE HERE', mobile_number: '91XXXXXXXXXX', type: 'FILE MIME TYPE', caption: 'FILE CAPTION (ONLY IN CASE OF IMAGES and VIDEOS)' }
c) To get all unread messages
EVENT: 'get_unread_replies' { payload: 'not required' } RESPONSE EVENT: 'get_unread_response'
d) To send seen (country code to be added in start)
EVENT: 'send_seen_reply' { msg_id: 'msg id you get form the response of the event "get_unread_response"' }
-
run 'node index.js' in cmd in root directory of the project.
-
For the first time you need to scan QR code from your mobile.
-
Now as the request is sent through socket the driver will start executing as per server command.
-
Wooolaaah....!!! You are done now.
-
Go to
localhost:3000
in your browser and send bulk messages.
- Donot close the chrome instance else you will have to rescan the QR code.
- In case of ubuntu provide proper permission to files directory in project.
- Do not leave any entries blank, else it may crash server
Please contribute to this repo and also feel free to raise issues. Merge request will be accepted only after proper testing.
SAURASS (Saurabh Srivastava)