Skip to content

monimahmadh/what_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WhatsApp Automation Bot

This project automates sending WhatsApp messages using Python, Selenium, and ChromeDriver. It supports dynamically loading contacts and messages, making it flexible for personal or small-scale automation purposes.

Features

  • Automated Messaging: Send messages to individual contacts via WhatsApp Web.
  • Chrome User Data Persistence: Maintain session data to avoid re-scanning the QR code.
  • Customizable Messages: Easily configure messages directly in the script.

Installation and Setup

Prerequisites

  1. Python: Ensure Python 3.x is installed. Download it from python.org.
  2. Google Chrome: Install the latest version of Google Chrome.
  3. ChromeDriver: ChromeDriver will be automatically installed using webdriver_manager.

Installation

  1. Clone the repository:

    https://github.com/monimahmadh/what_bot.git
    cd whatsapp-automation-bot
  2. Install required Python libraries:

    pip install -r requirements.txt
  3. Create a .env file in the root directory to store phone numbers:

    PHONE_NUMBERS=+8801878119442,+880164*****,+19758*****
    
  4. Create a config.py file to store your Chrome user data settings. It will allow you to avoid re-scanning the QR code:

    USER_DATA_DIR = r"C:\Users\YourUsername\AppData\Local\Google\Chrome\User Data"
    PROFILE_DIRECTORY = "Profile 1"

Usage

  1. Open the terminal and navigate to the project directory.
  2. Run the script:
    python what_bot.py
  3. On the first run, you will need to scan the QR code on WhatsApp Web to log in.
  4. The script will:
    • Load the phone numbers from the .env file.
    • Send the specified message to each contact.

File Structure

whatsapp-automation-bot/
│
├── what_bot.py         # Main script
├── config.py           # Configuration file for Chrome user data
├── .env                # Environment file for phone numbers
├── requirements.txt    # Python dependencies
├── README.md           # Project documentation

Dependencies

The following libraries are used in this project:

Install dependencies using:

pip install -r requirements.txt

Troubleshooting

  1. Error initializing WebDriver: Ensure Google Chrome and ChromeDriver versions are compatible.
  2. QR Code not appearing: Check the USER_DATA_DIR and PROFILE_DIRECTORY paths in config.py.
  3. No messages sent: Verify the phone numbers in .env are in the correct format (e.g., +8801234567890).

Contributing

Feel free to fork this repository and submit pull requests to improve functionality or add new features.


License

This project is open-source and available under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages