About 📟
Do you ever wonder sending messages automatically by just running a simple python script? Yes, you heard it right, it can be done easily by using this package with selenium. Selenium is a very smart package in python with which developers can automate the browser’s activity. With this, we can make use of Whatsapp-web through the browser and use it to automate message transfers.
PYPI.org ⚗️
You can find pywakit command to install on your local system.
Basic Requirement 📖
- Library/Packages — Selenium , Chromedriver(for web automation).
- IDE — Jupyter Notebook, Sublime, Visual Studio Code (It can even your command prompt, it just have to run Python).
- Browser — Opensource Chromium web browser(FYI Google chromedriver is preffered).
Pip And Use 📋
# You can easily start using this Library
# Run the following command in your command prompt
# Make use pip library is installed on your system.
# run the following command to ensure it
>> pip --version
# To install pywakit, run the following command
>> pip install pywakit
Clone and use 📋
# You can also clone the repository by running the follwoing command
>> git clone https://github.com/y-agg/pywakit.git
Get Started Code 🏃
# This will import WhatsApp class to send message
>> from pywakit import Whatsapp
# This will create the object of WhatsApp class
>> wa = Whatsapp()
# [Optional] If you slow internet connection, set
>> wa.retry= 20 #or anything higher then 10
# Default value of retry is 10
# This is for initial setup to run the program
# If You don't have Chromedriver in your system, call this function with no parameters.
# Function will automatically download The chrome Driver file based on sys config.
# This will properly work with google chrome and window user for now. In the future function, functionality will be fixed to work with all platforms.
# For the rest to the users, pass the chrome driver location as a parameter to the function.
# By any chance window use is facing problem for chrome driver downloading. Download it manually and pass the location of the file as a parameter.
>> wa.setup_driver()
# Alternative option
# CHROMEDRIVER _PATH is the path of chrome driver
>> wa.setup_driver(CHROMEDRIVER _PATH)
# This function is designed to QR code
>> wa.scan_code()
# This Function will send a message. It requires number(to whom the message is being sent) and the message(what should be sent?) as parameters.
# Both Should be of String type
>> wa.send_message(number,message)
# This will close of all the object and pointers. Its is for better practice.
>> wa.destroy()
# This Function will show all the log generated by the program.
>> wa.show_log()
# This function will print all the number to whom message is been sent till now.
>> wa.show_history()
Technologies used 🛠️
Bugs? 🍥
“I think there’re some bugs on your code… !”. or maybe, “I think there’re some bugs on your code” Whatever the language is! You’re right, there are.
- The program will crash. There is no such thing as perfect code. Some or other possibilities will found to cause program failure. But I do my best to keep this module bug be.
- Feel free to fix, reuse, and duplicate this repository.
- Any Problem? I’ve must have inserted something that will point to contact detail.
LICENCE ✨
This project under the MIT License — see the MIT License file for details.