Skip to content

feat(gateway): resolve replied/quoted message context in Discord and WhatsApp #30049

@ivanarifin

Description

@ivanarifin

Problem

When a user replies to a specific message in Discord or WhatsApp, Hermes receives the new message text but has no awareness of which message was being replied to. This makes Hermes unable to understand the context of the reply, leading to confusing or incorrect responses.

Example (Discord)

  • User replies to message: "Tenang, gua cuma nambahin 2 baris logika doang..."
  • Hermes receives: "Ini gua reply ke message yang mana?"
  • Hermes has no idea what message the user is referring to

Example (WhatsApp)

  • Same issue — when a user quotes/replies to a specific message, Hermes only sees the new message, not the quoted content

Expected Behavior

When a user replies to a message, Hermes should receive the referenced/quoted message content as part of the conversation context, so it can respond intelligently.

This is already how OpenClaw handles it — it fetches the referenced message from the Discord API and injects it into the agent context.

Proposed Solution

Discord

  • Discord's message payload includes a message_reference field and a referenced_message object when a message is a reply
  • The gateway should extract referenced_message.content and inject it into the agent's context (e.g., as a system note or prepended to the user message)

WhatsApp

  • WhatsApp reply payloads include a quotedMessage field
  • Similarly, extract and inject the quoted message content into context

Impact

Without this feature, Hermes cannot participate meaningfully in threaded/reply-based conversations — a very common interaction pattern on both Discord and WhatsApp. Users have to repeat themselves or rephrase their message without using the reply feature, which is frustrating.

References

  • Discord API: Message.referenced_message (populated when message_reference is set)
  • WhatsApp Bridge: quotedMessage in message payload

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliveryplatform/discordDiscord bot adapterplatform/whatsappWhatsApp Business adaptertype/featureNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions