Contact
wa-bridge
Back to Work
design / ID_009

wa-bridge

wa-bridge: Taking back WhatsApp automation My family uses WhatsApp for everything, so I started wondering if I could automate it. I dug into the official API, but that was a dead end; they require business verification,

Read raw project notes

wa-bridge: Taking back WhatsApp automation

My family uses WhatsApp for everything, so I started wondering if I could automate it. I dug into the official API, but that was a dead end; they require business verification, which I obviously don’t have. I kept looking for a way, and while I found unofficial open-source projects, the stories of people getting their accounts hacked scared me. Other services that rely on virtual sessions felt like a privacy nightmare—I store too many keys to risk a ban or a data leak. For a while, I just gave up.

The spark came from a chat with Grok. I asked if it was possible to build a local VLM for auto-replying to messages, and it said yes. That became my first MVP. It was fun showing it to my family, but it left me with a new question: is there an actual API I can interact with without AI constantly running in the middle? I tasked an agent to scrape my own project, understand it, and build a new, independent bridge. The project is still private for now—I want to make sure it’s secure and that I’m being careful with how I use WhatsApp’s ecosystem, since this is for people like me who don’t have the resources for official verification.

Capabilities

  • Native HTTP communication: Interacts via RESTful endpoints rather than being forced into traditional PowerShell scripts.
  • Message lifecycle management: Uses the main function to handle incoming message hooks and triggers responses.
  • AI inference bridge: The handleAiReply function acts as an optional gateway to local VLM models for context-aware automation.
  • Local environment execution: Operates as its own self-contained server without external dependencies on cloud-based session scrapers.

Technical Specs

Built as a Node.js application, wa-bridge leverages @whiskeysockets/baileys as the core engine for mimicking WhatsApp Web sessions. The architecture uses Express to expose internal triggers over local endpoints, managed by WebSocket connections for real-time messaging. Data is processed through a pino-logged pipeline, with session persistence handled by UUID-tagged instances. The system is designed to run entirely in the local environment, decoupling the WhatsApp interface from the AI inference layer through a standardized bridge pattern.

Most Interesting Code

The handleAiReply function is the heart of the logic, allowing the bot to parse incoming text before deciding whether to pass it to the local server. It is interesting because it manages the transition between a dumb bridge and an intelligent agent without crashing the session if the AI server is offline. This snippet handles the inference call: async function handleAiReply(message, sender) { const response = await fetch('http://localhost:11434/api/generate', { method: 'POST', body: JSON.stringify({ model: 'llama3', prompt: message }) }); const data = await response.json(); return data.response; }

Changelog

  • v1.0 — 2026-06-24 — Initial documentation generated.
  • v1.1 — 2026-06-24 — Migrated from PowerShell scripts to standalone Express API endpoints.

Record: /project/wa-bridge

Mi/OS 7.0

A personal portfolio in two operating systems.