/Sych-WhatsApp

Whatsapp Web based automation library with a focus on bot development.

Primary LanguagePythonMIT LicenseMIT

Sych WhatsApp

license GitHub repo size in bytes GitHub last commit GitHub issues

About

Sych is a python library for automating WhatsApp web.

note: this codebase is outdated as of 2020 last actual commit may 15, 2018

How

Selenium.

This implementation does not involve direct calls to WhatsApp servers, making it safer to use than those that do.

Examples

The following examples call the library core directly, see cb01.py for a chat-bot example.

Sending a message with an emoji:

from whatsapp import WhatsApp
whatsapp = WhatsApp(10)
whatsapp.send_message("Recipient", ":heart: Good!")  

Result:
Image

Getting a contact's status message

from whatsapp import WhatsApp
whatsapp = WhatsApp(10)
print(whatsapp.get_status("Name"))

Getting a contact's last seen datetime

from whatsapp import WhatsApp
whatsapp = WhatsApp(10)
print(whatsapp.get_last_seen("Name"))

Getting the number of members in a group:

from whatsapp import WhatsApp
whatsapp = WhatsApp(10)
result = whatsapp.participants_for_group("group")

Running

  1. Clone git clone https://github.com/CNajm/Sych-WhatsApp.git
  2. Navigate to cd Sych-WhatsApp
  3. Install dependencies pip install -r requirements.txt
  4. Download the chrome webdriver
  5. Extract the chromedriver to Sych-WhatsApp/Sych

You can now use the library core as shown in the above screenshots.

To run the bot framework:

  1. Perform above steps
  2. Edit cb01.py: Change the value of group to whatever contact/group you wish to listen on.
  3. Run python3 cb01.py

Contributions

Branch your changes and pull request. (Step by step guide if this is new to you)

Do submit bugs and suggestions to the Issues tab, 1 issue = 1 cookie.