Skip to content

aleapc/whatsapp-g2-win11

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

WhatsApp G2 Bridge — Win11 App

.NET 9 console app that reads WhatsApp Desktop notifications on Windows 11 and exposes them via a local WebSocket for the bridge backend to consume. Also accepts reply-request messages and types them into WhatsApp Desktop via Win32 SendInput.

Part of the WhatsApp G2 Bridge stack:

WhatsApp Desktop → [THIS APP] → WebSocket → Bridge Backend → SSE → G2 app → Glasses
                                                 ↓
                                       (voice replies via Whisper)

Requirements

  • Windows 10 19041+ or Windows 11
  • .NET 9 SDK
  • WhatsApp Desktop (free from Microsoft Store or web.whatsapp.com/download)
  • WhatsApp Desktop must be logged in and running (can be minimized)
  • Notification access permission for this app (Windows prompts you on first run)

Setup

1. Install WhatsApp Desktop

Microsoft Store: ms-windows-store://pdp/?productid=9NKSQGP7F2NH or https://www.whatsapp.com/download

Log in by scanning the QR code with your phone.

2. Build and run

cd WhatsAppG2Bridge
dotnet build
dotnet run

On first run, Windows will prompt you to allow notification access. Go to:

Settings → Privacy & security → Notifications → Let apps access your notifications

and enable it for this app.

3. Verify it's working

When a new WhatsApp message arrives, you should see:

[WhatsApp] Alex: Hey, quer almoçar?

in the console output.

How it works

Reading notifications

Uses Windows.UI.Notifications.Management.UserNotificationListener — an official Windows API available since Windows 10 19041. Polls every 500 ms for new toast notifications, filters for WhatsApp, and parses the MessagingStyle payload correctly (the bug that probably makes Even Realities' own forwarder silent on WhatsApp).

Parsing

WhatsApp notifications come in two forms:

  • Direct message: two text lines — sender name + body
  • Group message: two text lines — group name + "SenderName: message body"

The parser detects both patterns. Group sender is annotated as "João (Família)" so the replier knows both the chat name and who sent it.

WebSocket bridge

Exposes a WebSocket on ws://localhost:8788/ where the Node backend connects. Messages flow backend-bound; reply requests flow app-bound.

  • Outgoing: { type: "message", id, sender, text, timestamp, isGroup }
  • Incoming: { type: "reply", recipient, text }

Also exposes GET /health for quick checks.

Replying

When a reply request arrives, the app:

  1. Finds the WhatsApp Desktop window via EnumWindows + GetWindowText
  2. Brings it to foreground (restoring if minimized)
  3. If a recipient is specified, opens search via Ctrl+F and selects the top match
  4. Types the reply text via SendInput (Unicode, handles accents and emoji)
  5. Presses Enter to send

Important: this is UI automation of an official app — no WhatsApp ToS violation, no risk of account ban (unlike Baileys/whatsapp-web.js). It's the same mechanism Wear OS notifications use.

Known limitations

  • WhatsApp Desktop must be open (can be minimized to system tray but not closed)
  • Windows must be unlocked when a reply is sent (SendInput requires interactive session)
  • Non-BMP emoji (like 🙂) work via SendInput surrogate pairs
  • Group replies: recipient matching by chat name may fail if the group has a near-duplicate name
  • Notifications for attachments (images, voice notes, videos): the parser sees only the caption / "Photo" / "Voice message" placeholder text

Security notes

  • This app only reads notifications — it never accesses the WhatsApp database or message content beyond what Windows surfaces
  • The WebSocket server binds to localhost only — not accessible from the network
  • No telemetry, no data leaves your PC except via the explicit WebSocket connection to the local backend

License

MIT

About

.NET 9 Win11 app reading WhatsApp Desktop notifications for Even Realities G2 bridge

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages