It does not open any browser window while sending messages through WhatsApp. It works completely in the background.
This package is to be used for educational and testing purposes only. Don't use this package to spam people.
If anyone uses this to spam people, I will not be responsible.
I created this just for educational purposes to help the learners get a better understanding of selenium.
Created by Samrat Dutta
Github: https://github.com/SamratDuttaOfficial
Linkedin: https://www.linkedin.com/in/SamratDuttaOfficial/
Please visit the Github repository for a quick tutorial.
https://github.com/SamratDuttaOfficial/autowhatspy
Pull requests are always welcome.
- Send text and image messages through WhatApp to unlimited numbers/contacts/groups.
- Send emails to multiple email addresses through your email client.
- It does not open any browser window while sending messages through WhatsApp. It works completely in the background.
This package is completely built with python.
Here are some packages you'll need to run this package.
- Selenium - For the webdriver
- Pyperclip - To copy and paste text. (not used in this version)
- Gechodriver - Firefox driver for Selenium
It works best with python 3.9 or above and the latest version of pip to install this package.
pip install autowhatspy
To update the package (if a new version is there)
pip install autowhatspy --upgrade
Bulk WhatsApp messages to numbers
To send a single text or image (or both) message to multiple numbers through WhatsApp. This will work even if the numbers are not saved in your contacts. This will work even if you have never messaged the numbers from your WhatsApp. This will not work for a number which is not registered or active on WhatsApp.
message_to_numbers(msg, numbers_list, gechodriver, gechodriver_log, user_profile, country_code, image)
Bulk WhatsApp messages to contacts
To send a single text or image (or both) message to multiple contacts through WhatsApp
message_to_contacts(msg, contacts, gechodriver, gechodriver_log, user_profile, image)
Bulk WhatsApp messages to groups
To send a single text or image (or both) message to multiple groups through WhatsApp. You have to be a member of the groups with permission to send messages.
message_to_groups(msg, groups, gechodriver, gechodriver_log, user_profile, image)
msg - Path to the text file containing the message text.
Do not use unnecessary new lines in the text as they will be sent as separate messages to the receipients.
numbers_list - Path to the text file containing the list of numbers.
The contents of the text file should be like this:
919836xxxx10
9624xxxx78
919745xxxx69
7898xxxx56
8985xxxx65
The numbers may or may not have a country code attached to it. It will work either way.
contacts - Path to the text file containing the list of contacts.
The contents of the text file should be like this:
Samrat Dutta
Abraham Lincoln
Sachin
Sourav
Mr. Das
The names in the text file should be exactly same as they are saved in your phone. You must be already talking to them on WhatsApp.
groups - Path to the text file containing the list of groups.
The contents of the text file should be like this:
Group One
Group Two
Personal Group
Family Group
Work Group
The group names in the text file should be exactly same as they are in your WhatsApp (case-sensitive). You have to be a member of the groups with permission to send messages.
country_code - The country code of the numbers, without any symbols. Example: 91
gechodriver - Path to the gechodriver.exe file. Download the gechodriver.exe (link above) and send the path as an argument. You may use the absolute path or the relative path based on how your interpreter works. Make sure gechodriver.exe is in the same project folder you are working on. Or add the folder where gechodriver.exe is located in the PATH. Otherwise, an error might occur.
gechodriver_log - Path to the text file where the logs of gechodriver will be saved. Make sure gechodriver.log is in the same project folder you are working on. Otherwise, an error might occur.
user_profile - Path to the saved firefox user profile.
- Open firefox. Go to about:profiles and make a new profile.
- Save it in your project directory with whatever name firefox assigns it.
- Open that profile, open web.whatsapp.com and scan the QR.
- Send the path of the profile as the argument to the function.
- image - (Optional) Path to the image/video you want to send. Make sure that it is supported by WhatsApp and is of the permissible length.
Bulk WhatsApp messages to groups To send test based email to multiple email addresses.
send_emails(_smtp, msg, address_list, subject, your_email_address, passwrd)
_smtp - SMTP server address of you email client. I used smtp.gmail.com:587 for Gmail in my experiments
- Gmail SMTP server address: smtp.gmail.com
- Gmail SMTP name: Your full name
- Gmail SMTP username: Your full Gmail address (e.g. [email protected])
- Gmail SMTP password: The password that you use to log in to Gmail
- Gmail SMTP port (TLS): 587
- Gmail SMTP port (SSL): 465
- Note: You can use the SMTP server even if you’ve enabled two-factor authentication on your Google account. However, you will need to generate an app password so that the app can still connect.
msg - Path to the text file containing the message text.
address_list - Path to the text file containing the list of email addresses.
The contents of the text file should be like this:
subject - Subject of the email you are sending.
your_email_address - Your email address associated with the email client you are using.
passwrd - Password of the email address you are using.
Make sure the number of emails in the list does not exceed your daily/monthly limit.
For Gmail: With just a free Gmail account, you’ll be able to send up to 500 emails per day. If you have a paid Google Workspace account, your limit is 2,000 emails per day. The limits apply to a “rolling 24 hour period”.
If the program fails to send emails to all the given email addresses, check your own email address and password. Also check if your daily limit is exceeded or not.
MIT