Skip to content

feat: JSON-RPC daemon with full messaging support + LID routing#83

Open
g1e2x87 wants to merge 10 commits intosteipete:mainfrom
openprx:jsonrpc-daemon
Open

feat: JSON-RPC daemon with full messaging support + LID routing#83
g1e2x87 wants to merge 10 commits intosteipete:mainfrom
openprx:jsonrpc-daemon

Conversation

@g1e2x87
Copy link
Copy Markdown

@g1e2x87 g1e2x87 commented Feb 25, 2026

Summary

Complete JSON-RPC 2.0 daemon implementation for wacli, enabling external applications (AI agents, bots) to interact with WhatsApp programmatically via TCP or stdio.

Commits

  1. Phase 1 (b05cd13): Core JSON-RPC daemon — send, subscribe, listChats, getMessages
  2. Phase 2 (0c03b27): sendReaction, remoteDelete, sendFile, searchMessages, enhanced events
  3. Group support (e125b51): groupName in events, getGroupInfo/getContactName RPC methods
  4. (1e0732b): GetChat fallback for group name lookup
  5. (b829f05): selfJid in message events for self-identification
  6. (8a7747c): Pre-populate group names + in-memory cache for event handler
  7. LID→JID fix (9dd9687): Resolve WhatsApp Linked IDs to traditional JIDs for reply routing

Features

  • Transport: TCP (--transport tcp --listen addr) or stdio (default)
  • RPC methods: send, sendFile, sendReaction, remoteDelete, listChats, getMessages, searchMessages, getGroupInfo, getContactName, subscribe
  • Event streaming: subscribe pushes real-time message.received, message.sent, typing, presence notifications
  • LID resolution: Automatically resolves @lid JIDs to @s.whatsapp.net for reliable message delivery
  • Group awareness: Group names, selfJid, and sender info in all events

Testing

  • go build ./cmd/wacli/ passes
  • Tested on live WhatsApp with DM + group messages, multi-platform AI agent integration

wacli-dev added 7 commits February 22, 2026 07:06
WhatsApp now uses Linked IDs (@lid) instead of traditional JIDs
(@s.whatsapp.net). This causes reply routing failures when the
daemon receives events with LID-format chatJid/senderJid.

Changes:
- daemon.go: add resolvedJid field to event payload, resolve
  @lid to @s.whatsapp.net for DM chats
- methods.go: resolve @lid recipients before sending in rpc_send
- client.go: add ResolveRecipientJID(), IsLIDJID(), GetUserInfo()
  using whatsmeow store.GetAltJID + GetUserInfo fallback
- app.go: extend WAClient interface with new methods
- fake_wa_test.go: sync fake implementation
wacli-dev added 3 commits February 27, 2026 03:37
- daemon.go: fallback to WA server GetGroupInfo when cache/DB miss for group name
- daemon.go: add --lock-wait flag with 45s default for SQLite lock contention
- rpc/server.go: improve connection handling and cleanup
- rpc/events.go: enhance event delivery reliability
- rpc/methods.go: robustness improvements for RPC methods
@steipete steipete requested a review from dinakars777 as a code owner April 21, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant