yowsup
The WhatsApp lib
A Python library for building applications that send and receive messages over WhatsApp. It handles the WhatsApp protocol and encryption so you can write custom bots or notification senders without reverse-engineering the protocol yourself.
yowsup is a Python library for building applications that can communicate with WhatsApp users. The project started as the internal protocol engine for unofficial WhatsApp clients on the Meego and BlackBerry 10 mobile platforms, and has since been separated into a standalone library that developers can use to power their own custom WhatsApp-compatible tools.
The library handles the low-level details of the WhatsApp protocol, including the cryptographic handshake and end-to-end encryption. To keep the codebase maintainable, several protocol components were spun out into separate Python packages: python-axolotl handles the Signal encryption protocol used by WhatsApp, consonance implements WhatsApp's connection handshake using the Noise Protocol, and dissononce is a general-purpose Noise Protocol implementation. These companion libraries are installed automatically as dependencies.
A command-line tool called yowsup-cli comes alongside the library and provides a way to interact with WhatsApp from a terminal. Optional features like image sending and media handling require additional packages such as Pillow and requests.
Installation is via pip on Linux, Mac, and Windows. Linux users need Python development headers and ncurses-dev before running the setup script. Windows requires the mingw compiler and a small configuration change. The library supports Python 2.7 through 3.7.
The README is brief and refers readers to the project wiki for architecture documentation, a sample application walkthrough, and a guide to using the command-line tool. The last recorded update in the README is December 2021. The library is licensed under GPLv3+.
Where it fits
- Build a custom WhatsApp bot that receives incoming messages and replies automatically based on your own logic.
- Create a command-line WhatsApp client for scripting or automation on Linux, Mac, or Windows.
- Send WhatsApp notifications from your own application when a server alert or scheduled event fires.