Automating WhatsApp using python with custom multiple messaging options, attachment options and supporting images and video sending as well. auto_whatsapp also persist your login state once QR code is scanned on web whatsapp.
In the terminal type the following
pip install auto_whatsapp
Import auto_whatsapp module use its sendChat
function to send messages.
from auto_whatsapp import auto_whatsapp
msg = 'This is a test message'
users = ["user1", "user2", "+91 9876543210"]
auto_whatsapp.sendChat(users, msg)
users1 and user2 are saved contact name according to your use case.
Messages can also be send to unsaved contacts like +91 9876543210
as shown above.
Just run the code you can see the magic happening. It will open web whatsapp automatically send the given message to specified users.
Make sure you have selenium installed
pip install selenium
and have chromedriver in the same directory. If you don't have chromedriver installed click here
from auto_whatsapp import auto_whatsapp
users = ["user1", "user2", "+91 9876543210"]
src = 'C:\\Users\\Your_user\\Desktop\\dots.jpg'
auto_whatsapp.sendDoc(users, src)
Note that you have to provide absolute path as src argument and with double backslackes(\) as shown in example.
Media can be images, videos or audio which whatsapp supports.
from auto_whatsapp import auto_whatsapp
users = ["user1", "user2", "+91 9876543210"]
src = 'C:\\Users\\Your_user\\Desktop\\dots.jpg'
auto_whatsapp.sendMedia(users, src)
Note that you have to provide absolute path as src argument and with double backslackes(\) as shown in example.
auto_whatsapp is been licensed under MIT LICENSE