Skip to main content

aiowapy

CI Docs PyPI Python License

An asynchronous WhatsApp Multi-Device client for Python: a native implementation of the protocol (Noise + Signal + WABinary), no official Cloud API involved.

⚠️ Unofficial client. Using it violates WhatsApp's Terms of Service and the number may be banned. Use a test number and proceed at your own risk.

Installation

pip install aiowapy

The distribution is called aiowapy, the import is aiowapy:

from aiowapy import Client

Full documentation: https://yarfer800.github.io/aiowapy/

Quick start

import asyncio

from aiowapy import Client
from aiowapy.events import MessageEvent
from aiowapy.router import F


async def main() -> None:
    async with Client("bot.session") as client:
        print("connected as", client.info.jid)

        @client.router.message(F.text.startswith("/ping"))
        async def ping(event: MessageEvent) -> None:
            await client.send_text(event.chat_jid, "pong", quote=event.message_id)

        await client.run()


asyncio.run(main())

The first run needs linking: scan the QR code (qr_callback) or use ClientSession.pair_with_phone_number (see examples/pair_code.py). After that the session file keeps the keys and later runs only log in.

One session file, like Pyrogram

.session is SQLite and holds everything: credentials, Signal sessions, prekeys, app state, chats, contacts and messages.

history = await client.get_chat_history(chat_jid, limit=50)  # newest first
older = await client.get_chat_history(chat_jid, limit=50, before_timestamp=history[-1].timestamp)

chats = await client.get_chats()  # conversations, newest first
users = await client.get_users()  # contacts we have seen
chat = await client.get_chat(jid)  # Peer: .name, .push_name, .contact_name
await client.set_contact_name(jid, "Mom")
await client.download_stored(history[0])  # attachment of a stored message

Messages arrive from three places: live traffic, history sync chunks sent by the phone, and everything the bot sends. All of it lands in the same table, so get_chat_history returns a real conversation, not just what the process saw.

Sending

await client.send_text(jid, "hello")
await client.send_text(jid, "with a reply", quote=message_id)
await client.send_image(jid, picture_bytes, caption="look")
await client.send_document(jid, pdf_bytes, file_name="report.pdf", mime_type="application/pdf")
await client.send_audio(jid, voice_bytes, voice_note=True)
await client.send_reaction(jid, message_id, "\U0001f44d")
await client.edit_message(jid, message_id, "fixed text")
await client.revoke_message(jid, message_id)
await client.send_text("120363000000000001@g.us", "hello group")  # groups just work

send_* returns SendResult(message_id, sent, failed, acked): a message counts as delivered when at least one device accepted it; per-device failures are listed, not raised.

Receiving

from aiowapy.router import F


@client.router.message(F.text.contains("invoice") & F.chat("1203630@g.us"))
async def handle(event: MessageEvent) -> None:
    await client.mark_read(event)


@client.router.message(F.media("image"))
async def on_image(event: MessageEvent) -> None:
    data = await client.download_media(event.media)

Events: MessageEvent, ReactionEvent, EditEvent, RevokeEvent, HistorySyncEvent, ReceiptEvent, PresenceEvent, ChatStateEvent, ConnectedEvent, DisconnectedEvent, NotificationEvent.

Presence and typing:

await client.send_presence(True)
await client.subscribe_presence(jid)
await client.send_typing(jid, composing=True)

Groups

info = await client.group_info(group_jid)
group = await client.create_group("Team", [jid1, jid2])
await client.update_group_participants(group, "add", [jid3])
await client.leave_group(group)

A group message is encrypted once with a sender key; the key distribution message travels to every member device, exactly as the reference client does it.

App state

Contacts, mutes, pins and read markers live in WhatsApp's app state. Keys arrive from the phone; after that:

await client.sync_app_state()
await client.mute_chat(jid, True)
await client.pin_chat(jid, True)
await client.mark_chat_read(jid, True)

Coverage

Layer Module
Noise handshake, framing aiowapy.protocol.noise, aiowapy.protocol.transport
Pairing (QR and code) aiowapy.protocol.pairing, aiowapy.protocol.pairing_code
WABinary codec aiowapy.protocol.wabinary
Signal (X3DH, double ratchet) aiowapy.crypto.session
Sending: text, media, groups aiowapy.messaging
Receiving and decryption aiowapy.messaging.receiving
Receipts, retry requests aiowapy.protocol.receipts, aiowapy.client
Presence and typing aiowapy.protocol.presence
Groups (sender keys) aiowapy.messaging.groups
Media upload and download aiowapy.messaging.media
App state sync aiowapy.messaging.appstate
History sync aiowapy.messaging.history
Chats, contacts, messages aiowapy.store
Reactions, replies, edits, revokes aiowapy.protocol.messages

Not implemented: calls, channels (newsletters), statuses, polls and buttons, LID-based encryption (LID mappings are stored and exposed, but sessions still start on phone-number devices).

License

MIT.

Metadata

Release files for aiowapy 0.1.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 aiowapy 0.1.0
File Size Uploaded Provenance Actions
aiowapy-0.1.0.tar.gz 303.1 kB With provenance Details for aiowapy-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 434.6 kB

Release files / aiowapy-0.1.0.tar.gz

Download URL aiowapy-0.1.0.tar.gz
Size 303.1 kB
Tags Source
SHA-256 checksum
How to use checksums
002d52be810112a33567ec49ed9d57f207e4f3fdb3f773ea63f9b6bcd93e329f
BLAKE2b-256 checksum
How to use checksums
8b258aae7007fe396d7d743964e345c9a4794d0e7acc4e1e4025716bc1c99903
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / aiowapy-0.1.0-py3-none-any.whl

Download URL aiowapy-0.1.0-py3-none-any.whl
Size 131.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c1dd1af2837b93ad2cf91da836a7bf95fa468958628bb8b632b1e34318d2504
BLAKE2b-256 checksum
How to use checksums
ce42679ce96ab46c9b8a48b52090b1f4bb53e1f466585f591dd43b7a4e5d406d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Security for aiowapy 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aiowapy-0.1.0.tar.gz

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 Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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