This script sends WhatsApp messages automatically from WhatsApp web application to contacts. The name of the contact, their phone number and the message you want to send to all of them at once are saved in an excel file.
- The user scans web QR code to log in into the WhatsApp web application.
- The script reads a message from an excel sheet.
- The script reads each row and then searches for the contact number in the search box.
- If the number is found on WhatsApp, it will send a customized message to them otherwise it will read the next row.
- Python 3.8
- Selenium Web Driver
- Google Chrome
- Pandas
- Xlrd
- Selenium
You will also need an excel file that contains 3 columns- the name of your contact, their phone number and the message we want to send to all of them
-
Clone this repo
-
Create an environment using :
conda create -n "env name" python=3.8
-
Activate the environment using:
conda activate "env name"
-
Install Packages using:
pip install -r requirements.txt
-
Store your session details so that you do not have to be logging in to WhatsApp web every time
-
Initialize chrome and then specify the path to the location where the chromdriver is located. Also, add the options as you initialize chrome. You can also add a maximum wait time for an element to load on a webpage
-
Once chrome is initialized we can now open the WhatsApp web URL
It will open a WhatsApp web interface which automatically asks you to scan the QR code -
This loop each row and then searches for the contact number in the search box. If the number is found on WhatsApp, it will send a customized message to them otherwise it will read the next row