Skip to content

feat: add reply/quote context to messages#178

Open
Raid112 wants to merge 2 commits intolharries:mainfrom
Raid112:feature/reply-quote-context-121
Open

feat: add reply/quote context to messages#178
Raid112 wants to merge 2 commits intolharries:mainfrom
Raid112:feature/reply-quote-context-121

Conversation

@Raid112
Copy link
Copy Markdown

@Raid112 Raid112 commented Mar 10, 2026

Summary

Adds reply/quote context support to both the Go bridge and Python MCP server, resolving #121.

When a WhatsApp message is a reply to another message, the original quoted content is now captured and displayed.

Changes

Go bridge (whatsapp-bridge/main.go):

  • Added QuotedMessageID and QuotedContent fields to the Message struct
  • New extractQuoteInfo() function that extracts ContextInfo from all message types (text, image, video, audio, document)
  • Schema migration: ALTER TABLE adds quoted_message_id and quoted_content columns (safe for existing DBs)
  • Quote context captured in both real-time messages and history sync

Python MCP server (whatsapp-mcp-server/whatsapp.py):

  • Added quoted_message_id and quoted_content fields to the Message dataclass
  • Updated all queries (list_messages, get_message_context, get_last_interaction) to SELECT and populate the new fields
  • format_message() shows [Replying to: "..."] prefix when quote context is present

Also includes:

  • Updated whatsmeow to latest version (fixes 405 "client outdated" error)
  • Updated context.Context API calls (Download, sqlstore.New, GetFirstDevice, GetGroupInfo, GetContact)

Test plan

  • Build succeeds with CGO_ENABLED=1 on Windows (MinGW)
  • Bridge connects and syncs history (including quoted messages)
  • SQLite DB contains quoted_message_id and quoted_content columns
  • Verified quoted content populated for reply messages
  • Migration is backward-compatible (existing DBs get columns added via ALTER TABLE)
  • MCP server displays [Replying to: "..."] for messages with quotes

Closes #121

Raid112 added 2 commits March 9, 2026 22:14
Extract and store quoted message ID and content from WhatsApp replies.
The whatsmeow library already exposes ContextInfo with StanzaId and
QuotedMessage on all message types — this change captures that data
and surfaces it through the MCP server.

Changes:
- Go bridge: new extractQuoteInfo() function covering ExtendedText,
  Image, Video, Audio, Document message types
- SQLite schema: add quoted_message_id and quoted_content columns
  with ALTER TABLE migration for existing databases
- Python MCP server: display "[Replying to: ...]" prefix in formatted
  messages, expose quote fields in all query functions
- Update whatsmeow to v0.0.0-20260305 (fixes 405 client outdated error)
- Add context.Context parameter to API calls (new whatsmeow requirement)
- Fix GetStanzaId -> GetStanzaID naming
- Add .gitignore for compiled binary
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.

How to add support for giving reply to specific message ?

1 participant