Skip to main content

pywhats

CI PyPI version Python versions License

Async Python client for the WhatsApp multi-device protocol.

Status: pre-alpha (0.2.0). Implements QR pairing, connect, send/receive text, disconnect, app-state sync, media (images, video, audio/voice notes, documents, stickers), reactions, quoted replies, edits/revoke, history sync, read receipts, presence, and group messaging.

⚠️ Use at your own risk. This is an independent, unofficial client and may violate WhatsApp's Terms of Service — using it can get an account banned; prefer a dedicated number. The bundled Signal crypto (pywhats.signal.experimental) is clean-room and unaudited — see SECURITY.md.

Install

pip install pywhats

Requires Python 3.11+.

Quick start

import asyncio
from pywhats import Client

async def main():
    client = Client()

    @client.on("qr")
    async def on_qr(qr: str):
        print("Scan this QR in WhatsApp → Linked Devices:")
        print(qr)

    @client.on("message")
    async def on_message(msg):
        print(f"{msg.sender}: {msg.text}")
        if msg.text == "ping":
            # Event handlers run on the receive loop, so don't `await` a
            # client call that waits on a server reply (send, receipts,
            # group info) directly here — it would block the loop that has
            # to read that reply. Dispatch it as a task instead.
            asyncio.create_task(client.send_text(msg.chat, "pong"))

    await client.connect()
    await client.wait_closed()

asyncio.run(main())

Note: event handlers are dispatched on the connection's receive loop. Keep them quick, and never await a Client call that waits on a server response (send_text, send_image, mark_read, get_group_info, send_group_text, …) from inside a handler — schedule it with asyncio.create_task(...) so the receive loop stays free to read the reply.

Roadmap

  • 0.1.0 — QR pair, connect, send/receive text, disconnect, app-state sync, media (send/receive images), history sync, read receipts, presence, group messaging
  • 0.2.0 — more media types (video/audio/document/sticker), message features (reactions/replies/edits/revoke)
  • 0.3.0+ — calls, newsletters, business

License

Apache License 2.0. See LICENSE.

This is an independent clean-room implementation of the WhatsApp multi-device protocol. It is not affiliated with or endorsed by WhatsApp LLC or Meta. Using unofficial clients may violate WhatsApp's Terms of Service and can get an account banned — use at your own risk, preferably with a dedicated number.

Acknowledgments

The protocol behavior implemented here was informed by public reverse-engineering writeups and by studying the documented behavior of the open-source whatsmeow (Go) and Baileys (TypeScript) projects. No code was copied from either; pywhats is an independent implementation.

Metadata

Release files for pywhats 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pywhats 0.2.0
File Size Uploaded
pywhats-0.2.0.tar.gz 235.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pywhats 0.2.0
File Interpreter ABI Platform
pywhats-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 413.7 kB

Release files / pywhats-0.2.0.tar.gz

Download URL pywhats-0.2.0.tar.gz
Size 235.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d5ae7dbdb024921b38aa47c5db79dfdeed1d2fe9a06a4551c7c91a79742b96bb
BLAKE2b-256 checksum
How to use checksums
243a20c1c69c32c2646692f3a2dda09ff1c242adb58b912b7c1940bacb81e3f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.

Transparency log

Release files / pywhats-0.2.0-py3-none-any.whl

Download URL pywhats-0.2.0-py3-none-any.whl
Size 178.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
274df72892ddd9b7ed2b7ac6b278b0957b277e0e0ee9e00c754803ed04b9d262
BLAKE2b-256 checksum
How to use checksums
3cf44106b6b1cb9de2df57c9930d8e67d214de727b22cd14d04b834b15756d96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page