Skip to main content

Async Python implementation of the WhatsApp Web protocol inspired by Baileys.

Project description

Baileys Python

Baileys-python is the product package for a native Python implementation of the WhatsApp Web protocol surface provided by Node Baileys.

This project is an unofficial Python implementation inspired by WhiskeySockets/Baileys. It is not affiliated with, endorsed by, sponsored by, or maintained by WhiskeySockets/Baileys, WhatsApp, Meta, or any of their subsidiaries or affiliates. WhatsApp and related names, marks, emblems, and images are trademarks of their respective owners.

This repository is being built from the proven feasibility work in ../baileys-python-test. The spike remains the lab/reference; this package is the production implementation target.

Current State

The product package has live-proven auth, inbound, outbound, media, app-state, business/catalog, newsletter, and Phase 5 API foundations. Phase 8 core-beta hardening gates are in place:

  • installable Python package under src/baileys
  • generated WAProto and WABinary token package data
  • proven crypto, Noise, Signal, WABinary, media, pairing-code, retry, USync, and saved-auth client modules copied from the spike
  • offline parity tests and minimal public API tests
  • examples for saved-auth login, pairing-code request, and a small echo bot
  • compatibility matrix in docs/compatibility-matrix.md
  • public API guide in docs/public-api.md
  • migration guide for Node Baileys users in docs/migration-guide.md
  • release checklist in docs/release-checklist.md
  • architecture and remaining implementation designs in docs/architecture-design.md
  • live/proof scripts under scripts/
  • product QR pairing plus saved reconnect through scripts/product_qr_pairing_probe.py
  • product outbound text/media API probes through scripts/send_text_probe.py and scripts/send_image_probe.py
  • reusable product content/media probes through scripts/message_content_probe.py and scripts/send_media_probe.py
  • product chat, presence, profile, privacy, blocklist, and group method surfaces with Baileys-compatible aliases
  • explicit IQ errors for account-side server rejections in public query APIs
  • encrypted app-state patch encoding plus product app-state snapshot fetch/decrypt diagnostics, blocked-key tracking, live key-share ingestion, and app-state replay proof on a freshly linked test session
  • scripts/phase5_live_probe.py for read-only Phase 5 live validation
  • scripts/phase5_mutation_probe.py for explicit Phase 5 mutation validation
  • scripts/app_state_key_probe.py for app-state key and snapshot diagnostics
  • scripts/phase7_live_probe.py and scripts/phase7_remaining_probe.py for Phase 7 business, newsletter, community, WAM, privacy-token, bot-list, and peer-data proof tracking
  • scripts/live_suite.py for JSON summaries of selected read-only and explicit write live probes
  • scripts/live_suite.py --write-nightly-plan for scheduled read-only probe command planning
  • scripts/soak_suite.py for timed reconnect/receive-loop soak summaries
  • scripts/release_gate.py for compile, test, generated artifact, docs, package build, clean install, and import smoke checks
  • scripts/release_status.py for roadmap, matrix, and deferred-proof consistency checks
  • optional Postgres stores with versioned migration and live database integration proof

This is not full Baileys parity yet. Account-gated live proof items are tracked as explicit Todos in the compatibility matrix while core beta hardening continues.

Install

python -m pip install baileys-python

Install For Development

python -m pip install -e ".[dev]"

Run Tests

python -m pytest -q

Run Release Gates

python scripts/release_gate.py

Run Live Suite Summary

python scripts/live_suite.py --include-remaining --skip-collections

Write probes are opt-in:

python scripts/live_suite.py --include-write --to 120363000000000000@g.us

Run Soak Summary

python scripts/soak_suite.py --duration 3600

License

This package is released under the MIT License. See LICENSE and NOTICE for license text, attribution, and affiliation notices.

Minimal Saved-Auth Login

import asyncio
from pathlib import Path
from baileys import WhatsAppWebClient

async def main():
    async with WhatsAppWebClient(Path("auth/live_pair_creds.json")) as client:
        success = await client.wait_for_success(timeout=60)
        print(success.attrs)

asyncio.run(main())

Roadmap

See docs/roadmap.md for the implementation timeline and docs/compatibility-matrix.md for the public Baileys parity checklist. See docs/public-api.md for the current Python API and docs/migration-guide.md for Node Baileys migration notes. See docs/publishing.md for the PyPI release flow and docs/architecture-design.md for the remaining implementation design.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

baileys_python-0.1.0a0.tar.gz (320.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

baileys_python-0.1.0a0-py3-none-any.whl (286.6 kB view details)

Uploaded Python 3

File details

Details for the file baileys_python-0.1.0a0.tar.gz.

File metadata

  • Download URL: baileys_python-0.1.0a0.tar.gz
  • Upload date:
  • Size: 320.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for baileys_python-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 48eecd043a92a2d9230c47290e6c1127059e2a5dd211304ecba4ffd9ab6ac089
MD5 ced35ec767e631c2197dc7c617b32426
BLAKE2b-256 3fa4d92564fc3ec10eec9da5c6b177521c48575ffb5b1a53c304004339462bb6

See more details on using hashes here.

File details

Details for the file baileys_python-0.1.0a0-py3-none-any.whl.

File metadata

File hashes

Hashes for baileys_python-0.1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9f0ec77f384a3997a5ab9d89f572df4f5a72814d3d6259a76b3c88c79589737
MD5 990519aa3518752caf2e0276b1045d3d
BLAKE2b-256 d2df40997f06f6e963217f5c7850886e1bc653bc3795a22a559a788547683b6b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page