Automate WhatsApp messaging using Python and Selenium.
Auto WhatsApp is a Python-based tool designed to automate the process of sending messages through WhatsApp Web. Utilizing Selenium WebDriver, it simulates user interactions to send messages to specified individual or multiple contacts.
- 🤖 Automated message sending via WhatsApp Web
- 👥 Supports for sending messages to individual or multiple contacts
- ✏️ Customizable message content
- 📎 Allows single or multiple attachments upload
- 🌐 Utilizes Selenium for browser automation
- Python 3.9+
- Selenium 4.28+
-
Clone the repository:
git clone https://github.com/davutbayik/auto-whatsapp cd auto-whatsapp -
Create and activate a virtual environment (Optional-Recommended):
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install the required packages:
pip install -r requirements.txt
-
📝 Prepare your message and recipients:
- Edit
main.pyto specify the message content and list of recipients.
- Edit
-
🔗 Add attachments:
- If you have any attachments to include the message, add them to
assetsfolder.
- If you have any attachments to include the message, add them to
-
▶️ Run the script:python autoWhatsApp.py
-
📲 Scan the QR Code:
- Set
HEADLESS_MODE=Falsebefore the first use of the application. - A browser window will open directing to WhatsApp Web.
- Scan the QR code with your WhatsApp mobile app to log in.
- After initial QR Scan, the app will automatically logging in to your WhatsApp account unless you delete the connection from your phone.
- You can set
HEADLESS_MODE=Truefor a better experience after an initial successful QR login.
- Set
-
📤 Automated messaging:
- Once logged in, the script will automatically send the specified messages and attachments to the listed contacts one by one.
- Change
SEND_BUTTON_NAMEvariable andPENDING_MARKinautoWhatsApp.pyfile to your WhatsApp Web account's display language. For example setSEND_BUTTON_NAME = 'Send',PENDING_MARK = ' Pending 'for English and setSEND_BUTTON_NAME = 'Gönder',PENDING_MARK = ' Bekliyor 'for Turkish languages. If the word not matches to your language then the program may fail.
import os
from autoWhatsApp import send_individual_contact
send_individual_contact(
phone_number="+905xxxxxxxxx",
message="Hello, this is an automated message sent via autoWhatsApp module.",
headless=True,
attachments=os.listdir("assets") # Send all the files in the 'assets' folder
)import os
from autoWhatsApp import send_multiple_contacts
send_multiple_contacts(
phone_number=["+905xxxxxxxxx", "+905yyyyyyyyy"]
message="Hello, this is an automated message sent via autoWhatsApp module.",
headless=True,
attachments=os.listdir("assets") # Send all the files in the 'assets' folder
)🎥 Example Demo
auto_whatsapp_demo.mp4
This project is licensed under the terms of the MIT License.
You are free to use, modify, and distribute this software as long as you include the original license.
Made with ❤️ by Davut Bayık — feel free to reach out via GitHub for questions, feedback, or collaboration ideas.
⭐ If you found this project helpful, consider giving it a star!