Skip to main content

Baileys-style WhatsApp Web socket for Python

Project description

wa-socket

wa-socket is a Python library that provides a WhatsApp Web socket interface using a Node.js backend powered by the Baileys library.

The goal is to let Python developers interact with WhatsApp Web without writing Node.js code.


Features

  • WhatsApp Web connection via QR code
  • Session persistence (scan once, reconnect automatically)
  • Python-first API
  • Node.js backend managed automatically
  • Suitable for scripts, services, and FastAPI apps

Requirements

  • Python 3.9+
  • Node.js 22+

⚠️ Node.js 20 / 22 are NOT supported
This is due to upstream dependency constraints in Baileys.

Download Node.js 18 LTS from: https://nodejs.org/en/download

Verify installation:

node -v
npm -v


## How it works

`wa-socket` runs a lightweight Node.js process internally.

- Python controls everything
- Node.js is only used for WhatsApp Web (Baileys)
- Communication happens via stdin/stdout (JSON events)
- QR codes are rendered directly in the terminal


## Quick Start

```python
from wa_socket import WhatsAppSocket

sock = WhatsAppSocket(session_id="default")

sock.on_message(lambda msg: print(msg))
sock.start()
sock.wait_for_connection()

sock.send_message("919XXXXXXXXX", "Hello from Python")

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

wa_socket-0.1.6.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

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

wa_socket-0.1.6-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file wa_socket-0.1.6.tar.gz.

File metadata

  • Download URL: wa_socket-0.1.6.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for wa_socket-0.1.6.tar.gz
Algorithm Hash digest
SHA256 8ad7445692b4c7c64e245a61261c33cd754b4e624ada29b862ea7e2d7595f527
MD5 b67d2b3a3be536148208c85b9ef81d6e
BLAKE2b-256 e2bd6d54e535256876591af6a2358ef43cfacf9e0794c7f943f51a05b1e40b4d

See more details on using hashes here.

File details

Details for the file wa_socket-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: wa_socket-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for wa_socket-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 783e8ba3d871e5cd706e7437374a81797ce1bb0821a77eb92c3ce5d34b7d066c
MD5 8d1d900c4dec5e8941e35547ab1fb4b3
BLAKE2b-256 9319fb7869945caba06cedfca545eae5b7ba6f94a5e22952bdca4632f2b63b4a

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