All Projects → shauryauppal → Pywhatsapp

shauryauppal / Pywhatsapp

Licence: apache-2.0
Python Automation using selenium & Scheduling of messages and media

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pywhatsapp

Webwhatsappbot
Core to automatize whatsapp - working 11/2018
Stars: ✭ 59 (-77.04%)
Mutual labels:  automation, whatsapp, selenium
Python Scripts
Collection of Various Python Script's.💻
Stars: ✭ 195 (-24.12%)
Mutual labels:  automation, hacktoberfest, selenium
Aet
AET - a system that detects visual changes on web sites and performs basic page health checks
Stars: ✭ 100 (-61.09%)
Mutual labels:  automation, hacktoberfest, selenium
Playwright Go
Playwright for Go a browser automation library to control Chromium, Firefox and WebKit with a single API.
Stars: ✭ 272 (+5.84%)
Mutual labels:  automation, hacktoberfest, selenium
Whatsapp Bulk Sender
Send bulk messages right from your WhatsApp Android Client or WhatsApp Web
Stars: ✭ 135 (-47.47%)
Mutual labels:  automation, hacktoberfest, whatsapp
Nvidia Sniper
🎯 Autonomously buy Nvidia Founders Edition GPUs as soon as they become available.
Stars: ✭ 193 (-24.9%)
Mutual labels:  automation, selenium
Splinter
splinter - python test framework for web applications
Stars: ✭ 2,476 (+863.42%)
Mutual labels:  automation, selenium
Pychromeless
Python Lambda Chrome Automation (naming pending)
Stars: ✭ 219 (-14.79%)
Mutual labels:  automation, selenium
Cdp4j
cdp4j - Chrome DevTools Protocol for Java
Stars: ✭ 232 (-9.73%)
Mutual labels:  automation, selenium
Tox
Command line driven CI frontend and development task automation tool.
Stars: ✭ 2,523 (+881.71%)
Mutual labels:  automation, hacktoberfest
Errbot
Errbot is a chatbot, a daemon that connects to your favorite chat service and bring your tools and some fun into the conversation.
Stars: ✭ 2,605 (+913.62%)
Mutual labels:  automation, hacktoberfest
Nightwatch Cucumber
[DEPRECATED] Cucumber.js plugin for Nightwatch.js.
Stars: ✭ 243 (-5.45%)
Mutual labels:  automation, selenium
Reporting
Zebrunner Reporting Tool
Stars: ✭ 198 (-22.96%)
Mutual labels:  automation, selenium
Community.kubernetes
Kubernetes Collection for Ansible
Stars: ✭ 214 (-16.73%)
Mutual labels:  automation, hacktoberfest
Thirtyfour
Selenium WebDriver client for Rust, for automated testing of websites
Stars: ✭ 191 (-25.68%)
Mutual labels:  automation, selenium
Automation Scripts
Repo for creating awesome automation scripts to make my panda lazier
Stars: ✭ 223 (-13.23%)
Mutual labels:  automation, hacktoberfest
tithiwa
Automate Web WhatsApp with selenium in python.
Stars: ✭ 17 (-93.39%)
Mutual labels:  selenium, whatsapp
whatsapp-web
Simon is a Python library that helps made easy the browser automation for WhatsApp Web service
Stars: ✭ 67 (-73.93%)
Mutual labels:  selenium, whatsapp
WaWebSessionHandler
(DISCONTINUED) Save WhatsApp Web Sessions as files and open them everywhere!
Stars: ✭ 27 (-89.49%)
Mutual labels:  selenium, whatsapp
RomanceBreaker
Python script which sends a custom morning message to your significant other every morning at a given time range on Facebook Messenger, WhatsApp, Telegram or SMS, for lazy people
Stars: ✭ 36 (-85.99%)
Mutual labels:  selenium, whatsapp

PyWhatsapp

made-with-python License GitHub stars HitCount

Python Automation using Selenium & Scheduling of messages and media

Objective:

Pywhatsapp is used to Automate Whatsapp through Whatsapp web. We can add 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.

Installation

$ pip install -r requirements.txt

OR

$ pip install selenium

$ pip install schedule

$ pip install PyAutoIt

NOTE: If there is any issue in installation of pyautoit then clone the repo and install from repo. LINK

Platform: Windows

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

Platform Mac

Remove the ChromeDriverused in the repository and install Mac ChromeDrive Download Link

Set ChromeDriver path in function whatsapp_login() Set ChromeDriver Path in MacOS


For Sending Attachments you need to Install AutoIt (Optional, if you only want to send messages) | (Only FOR WINDOWS USERS):

You may install from the links given below or Install from the folder named "Install AutoIt 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.


Feature Enhancement:

QR CODE Scanning: On receiving a lot of complaints about QR Code Scanning Issue again and again. I have added a Cookie system that will save your session so that whatsapp don't think you are login for first time. By Saving Session data you will have to scan QR Code to Login only once or till the time whatsapp doesnot log you out from whatsappweb.

NOTE: A folder User_Data will be created which has all your session information. Keep this Folder VERY SAFE.

Code:

Added ArgParser

python3 PyWhatsapp.py --help
--chrome_driver_path (required) CHROME_DRIVER_PATH chromedriver executable path (MAC and Windows path would be different)
--message (optional) MESSAGE Enter the msg you want to send
--remove_cache (optional) REMOVE_CACHE Remove Cache | Scan QR again or Not
--import_contact (optional) IMPORT_CONTACT reads contacts from contact.txt text file
--enable_headless (optional) Enable Headless Driver (True/False)

For Windows: python3 PyWhatsapp.py --chrome_driver_path 'driver/chromedriver.exe' --message 'Hi Shaurya, How Are you?'
For MACOS: python3 PyWhatsapp.py --chrome_driver_path 'driver/chromedriver' --message 'Hi Shaurya, How Are you?'

input_contacts()

In this functions Contacts list can be hardcoded 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(interger)->919899123456

NOTE: For unsaved contacts:

Do enter your country code then contact number.

Use: 919899123456

Don't Use: +919899123456

input_message()

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

Example:

Enter the msg to send-> Good morning

Enter choice to schedule message or not.

Do you want to schedule your Message(yes/no): yes

input time in 24 hour (HH:MM) format - 10:10

NOTE: If testing program for the first time Scheduling should be no inorder to check it is working perfectly.

Enter choice whether to send attachments or not.

Would you like to send attachment(yes/no): yes

Answer the input with yes or no.

send_attachments()

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.

send_files()

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

schedule.every().Monday.at("06:00").do(sender)

schedule.every().Tuesday.at("07:00").do(sender)

schedule.every().Friday.at("07:30").do(sender)

schedule.every().day.at("08:30").do(sender)

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

How to write contacts in contacts.txt file (check commited file)?

shaurya <- isdigit() = False so this is saved contact

919899312345 <- isdigit() = True so this is unsaved contact

Input Screenshot:


Demo of Working (GIF)


Contributions

Issues and Pull requests are most welcome.


License

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


Author:

Shaurya Uppal

Endorse me at LinkedIn if this project was helpful. Linkedin LinkedIn

[email protected]

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

If this helped you in any way gift me a cup of coffee ☕️

paypal

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].