Skip to content

whatsapp_baileys

diapason.channels.whatsapp_baileys

WhatsAppBaileysChannel -- bidirectional WhatsApp messaging via Baileys protocol.

Spawns a Node.js subprocess that runs the Baileys bridge (JSON-line protocol on stdio). The bridge handles QR-code authentication, message sending, and incoming-message forwarding.

WhatsAppBaileysChannel

Bases: BaseChannel

Bidirectional WhatsApp channel using the Baileys protocol.

Communicates with a Node.js bridge subprocess over JSON-line stdio.

Parameters

auth_dir: Directory for Baileys auth state persistence. Defaults to ~/.diapason/whatsapp_baileys_bridge/auth. assistant_name: Display name used by the assistant in conversations. assistant_has_own_number: If True the assistant has a dedicated WhatsApp number and will not filter out its own messages. bus: Optional event bus for publishing channel events.

connect()

Spawn the Node.js bridge subprocess and start the reader thread.

disconnect()

Send disconnect command to the bridge and terminate the subprocess.

list_channels()

Return available channel identifiers.

on_message(handler)

Register a callback for incoming messages.

send(channel, content, *, conversation_id='', metadata=None)

Send a message to a WhatsApp JID via the bridge subprocess.

status()

Return the current connection status.