Skip to content

aleapc/whatsapp-bridge-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WhatsApp Bridge Backend

Node.js + TypeScript backend that connects the Win11 notification reader to the Even Realities G2 glasses app.

Architecture

Win11 app (ws://localhost:8788) ──WebSocket──> [THIS BACKEND] ──SSE──> G2 app on iPhone
                                                      │                     │
                                                      │                     │ voice reply
                                                      │                     ▼
                                                      │            POST /reply { pcm, recipient }
                                                      │                     │
                                                      ▼                     │
                                        speechcoach-backend (Whisper) ◄─────┘
                                                      │
                                                      ▼ transcribed text
                                        Win11 app types reply in WhatsApp

Setup

cd whatsapp-bridge-backend
npm install
cp .env.example .env
npm run dev

The server listens on http://localhost:8787 by default.

Environment variables

PORT=8787
WIN11_URL=ws://localhost:8788/
STT_BACKEND_URL=http://localhost:8787
STT_ENABLED=true
  • PORT: HTTP port this backend listens on
  • WIN11_URL: WebSocket URL of the Win11 app (usually localhost)
  • STT_BACKEND_URL: URL of the speechcoach-backend (can be the same process if colocated)

API

GET /health

Returns backend status and Win11 connection state:

{
  "status": "ok",
  "time": 1712876400000,
  "win11Connected": true,
  "messagesBuffered": 12
}

GET /stream (SSE)

Live stream of WhatsApp messages for the G2 app.

  • On connection: fires snapshot event with the 20 most recent messages
  • On new message: fires message event
  • Heartbeat every 30s to keep proxies alive (important for Cloudflare Tunnel)

GET /messages

Returns the last 20 messages as JSON (fallback for clients without SSE).

POST /reply

Body:

{ "recipient": "João", "pcm": [/* Int16 samples */] }

or:

{ "recipient": "João", "text": "Direct text reply" }
  • If pcm is provided, it's transcribed via the STT backend and the resulting text is used
  • The reply is forwarded to the Win11 app via the WebSocket connection
  • Returns: { "ok": true, "transcribed": "...", "queued": false }

Remote access (Cloudflare Tunnel)

For accessing the backend from anywhere (not just local Wi-Fi), use Cloudflare Tunnel. See the main WhatsApp G2 Bridge README for setup.

Development

npm run dev      # tsx watch mode
npm run typecheck  # tsc --noEmit

License

MIT

About

Node/TS backend connecting Win11 WhatsApp reader to Even Realities G2 glasses via SSE

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors