PyWhatsapp | Whatsapp Automation

Shaurya Uppal
3 min readSep 29, 2018


by Shaurya Uppal

Python Automation using Selenium & Scheduling of messages and media



Pywhatsapp is used to Automate Whatsapp through Whatsapp web. We can add a number of contacts whom we want to send messages or Media attachments ( like Video or Images). Selenium, Autoit, and Schedule have been used one from Automation and other for Scheduling messages.

Use Case:

We can schedule Good Morning or Good night messages with a nice Picture at a particular time to our loved ones. We can set reminders. Suppose at 12 o’clock you want to wish your friend happy birthday so schedule your messages and sleep peacefully.


$ pip install -r requirements.txt


$ pip install selenium

$ pip install schedule

$ pip install PyAutoIt

Platform: Windows

ChromeDriver used: If this versions becomes outdated or gives problem download the latest version from Download Link

For Sending Attachments you need to Install AutoIt (Optional if you only what to send messages):

You may install from the links given below or Install from the folder named “Install Auto-It for Sending Attachments” in the repository.

Official Website Download Webpage

Installation Link of AutoIt.exe

AutoitScript Editor (optional to install)

Installation is pretty Simple no changes in setting are required keep everything default. Few clicks on Next and you are done.



In this functions Contacts list can be hard coded or you can give input accordingly.(Make changes in Contact array according to you)

1.Enter Saved Contact number->
2.Enter Unsaved Contact number->
Enter your choice(1 or 2):->1
# For saved Contacts
Enter number of Contacts to add(count)->1
Enter contact name(text)->Shaurya
# For unsaved Contacts
Enter number of unsaved Contacts to add(count)->1
Enter unsaved contact number with country code(integer)->919899123456

NOTE: For unsaved contacts:

Do enter your country code then contact number.

Use: 919899123456

Don’t Use: +919899123456


In this function we take input of message to send to all the Contacts list from user.


Enter the msg to send-> Good morning

Enter choice whether to send attachments or not.

Would you like to send attachment(yes/no): yes Answer the input with yes or no.


NOTE: Add Photos & Videos in the Media Folder.

image_path = os.getcwd() +”\Media\” + ‘goodmorning.jpg’

Example path to send goodmorning image to your listed Contacts.

  • “hour” variable is used to check current Hour on the clock and according image is sent to the Contact.
  • If time is after 5am and before 11am schedule goodmorning.jpg image.
  • If time is after 9pm schedule goodnight image.
  • If time is anyother send howareyou image.

You can set your own photos at a particular time feel free to do that.


NOTE: Add the document in the documents folder.

Would you file to send a Document file(yes/no): yes

Enter the Document file name you want to send: opportunity

  • If the document file names are same then write the document name with extension like opportunity.pdf or opportunity.txt

Schedule messages and Attachments





  • You make change these schedule days and time according to you.

Input Screenshot:

Demo of Working (GIF)


Issues and Pull requests are most welcome.


License Code and documentation are available according to the Apache License (see LICENSE).


Shaurya Uppal

Feel free to mail me for any queries (After you have tried finding your solution).