hermes - ✅(Solved) Fix feat(whatsapp): optional service-conversation support with safe defaults [1 pull requests, 1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#11751Fetched 2026-04-18 05:59:06
View on GitHub
Comments
1
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
commented ×1cross-referenced ×1referenced ×1

Add optional WhatsApp service-conversation support to Hermes so an agent can contact providers like Movistar, receive replies in the same thread, and continue the conversation under explicit safeguards.

This is not meant to become generic WhatsApp outreach automation. The feature should be conservative by default and narrowly shaped for support/provider conversations.

Root Cause

Add optional WhatsApp service-conversation support to Hermes so an agent can contact providers like Movistar, receive replies in the same thread, and continue the conversation under explicit safeguards.

This is not meant to become generic WhatsApp outreach automation. The feature should be conservative by default and narrowly shaped for support/provider conversations.

Fix Action

Fixed

PR fix notes

PR #11822: feat(whatsapp): add safe service conversation support

Description (problem / solution / changelog)

Summary

  • forward unknown WhatsApp DMs to the gateway so authorization can happen there instead of being dropped in the bridge
  • add conservative service-conversation policy helpers for approved provider/support chats
  • block slash-command/operator control from approved service chats while allowing normal conversation
  • add recent WhatsApp chat discovery plus explicit phone/JID target normalization for send_message

Test Plan

  • python -m pytest tests/gateway/test_unauthorized_dm_behavior.py tests/gateway/test_whatsapp_service_policy.py tests/gateway/test_whatsapp_recent_chats.py tests/tools/test_send_message_tool.py -q

Refs #11751

Changed files

  • gateway/config.py (modified, +10/-0)
  • gateway/platforms/whatsapp.py (modified, +28/-0)
  • gateway/run.py (modified, +34/-0)
  • gateway/whatsapp_service_policy.py (added, +166/-0)
  • hermes_cli/config.py (modified, +14/-0)
  • scripts/whatsapp-bridge/bridge.js (modified, +65/-2)
  • tests/gateway/test_unauthorized_dm_behavior.py (modified, +96/-0)
  • tests/gateway/test_whatsapp_recent_chats.py (added, +72/-0)
  • tests/gateway/test_whatsapp_service_policy.py (added, +71/-0)
  • tests/tools/test_send_message_tool.py (modified, +29/-0)
  • tools/send_message_tool.py (modified, +6/-0)

Code Example

whatsapp:
  service_conversations:
    enabled: false
    default_mode: draft_first
    approved_chats: []
    approved_patterns: []
    allow_agent_initiated_service_chats: false
    auto_promote_replied_to_chats: false
    max_new_service_chats_per_day: 3
    require_explicit_approval_for_first_contact: true
    allow_media: true
RAW_BUFFERClick to expand / collapse

Summary

Add optional WhatsApp service-conversation support to Hermes so an agent can contact providers like Movistar, receive replies in the same thread, and continue the conversation under explicit safeguards.

This is not meant to become generic WhatsApp outreach automation. The feature should be conservative by default and narrowly shaped for support/provider conversations.

Why

Current Hermes WhatsApp support already has the transport pieces for outbound messaging, but not the policy and discovery pieces needed for safe real provider conversations.

Verified current behavior:

  • scripts/whatsapp-bridge/bridge.js
    • POST /send already sends arbitrary { chatId, message }
    • POST /send-media already sends native media to arbitrary chatId
    • GET /chat/:id resolves a known chat ID
  • gateway/platforms/whatsapp.py
    • send(chat_id, content, ...) already calls the bridge /send

The actual blockers are:

  1. inbound replies from third parties are filtered out unless the sender matches the static allowlist
  2. there is no recent-chat discovery UX for selecting provider threads safely
  3. there is no explicit service-chat policy layer (draft-first, approved chats, revoke/pause, etc.)

Use case

  • user asks Nagatha/Skippy/Hermes to contact a provider over WhatsApp
  • first contact is drafted and approved by default
  • provider replies in the same WhatsApp thread
  • Hermes receives the reply and continues in the same session/thread
  • user can pause/revoke the service conversation at any time

Product constraints

This feature should be:

  • optional
  • off by default
  • conservative in defaults
  • explicit per-chat or per-policy
  • auditable
  • bounded with smart controls / rate limits

This feature should not rely on global wildcard allowlists like WHATSAPP_ALLOWED_USERS=*.

Safeguards required

Safe defaults

  • feature disabled by default
  • unknown inbound chats stay blocked by default
  • no automatic promotion of random chats into autonomous conversations

Explicit chat-level policy

Suggested config shape:

whatsapp:
  service_conversations:
    enabled: false
    default_mode: draft_first
    approved_chats: []
    approved_patterns: []
    allow_agent_initiated_service_chats: false
    auto_promote_replied_to_chats: false
    max_new_service_chats_per_day: 3
    require_explicit_approval_for_first_contact: true
    allow_media: true

First-contact restrictions

  • first outbound to an external provider should be draft-first by default
  • autonomous follow-up should only happen in explicitly approved service chats

Auditability

Log service-conversation state changes such as:

  • first contact approved/sent
  • chat promoted to approved service chat
  • policy changed to draft-only / autonomous / paused
  • service chat revoked

Blast-radius limits

At minimum:

  • max new service chats per day
  • optional max auto-sends per chat per hour
  • easy revoke/pause path

Proposed phased implementation

Phase 1 — safe foundation

  • add bridge GET /chats recent-chat discovery
  • add WhatsApp target normalization / discovery for send_message
  • add config scaffolding for service conversations
  • keep default inbound safety posture conservative

Phase 2 — controlled service-chat policy

  • allow inbound replies for explicitly approved service chats
  • support draft-first first contact
  • support optional promotion after approved first contact / reply
  • add audit logging and rate controls
  • ensure thread/session continuity

Likely files

  • scripts/whatsapp-bridge/bridge.js
  • scripts/whatsapp-bridge/allowlist.js if needed
  • gateway/platforms/whatsapp.py
  • tools/send_message_tool.py
  • gateway/channel_directory.py
  • gateway/config.py
  • tests covering discovery, target resolution, policy gating, and session continuity

Acceptance criteria

  1. Hermes can list recent WhatsApp chats safely
  2. Hermes can target a provider chat by phone/JID/recent-chat name
  3. Unknown inbound external chats remain blocked by default
  4. Approved service chats can receive replies into Hermes
  5. First contact requires approval by default
  6. Provider replies attach to the same Hermes conversation thread
  7. Service-chat approval can be revoked cleanly

Notes

I have a fuller local design/implementation plan and intend to send it to Codex for review before the Claude two-phase build-out. This issue is the product/spec anchor first.

extent analysis

TL;DR

Implement a service conversation feature in Hermes with explicit safeguards, including a conservative default policy, recent-chat discovery, and audit logging, to enable safe WhatsApp conversations with providers.

Guidance

  • Implement the GET /chats endpoint in scripts/whatsapp-bridge/bridge.js to enable recent-chat discovery.
  • Add config scaffolding for service conversations in gateway/config.py with a conservative default policy.
  • Update gateway/platforms/whatsapp.py to allow inbound replies for explicitly approved service chats and support draft-first first contact.
  • Implement audit logging for service-conversation state changes, such as first contact approval and chat promotion.

Example

whatsapp:
  service_conversations:
    enabled: false
    default_mode: draft_first
    approved_chats: []
    approved_patterns: []
    allow_agent_initiated_service_chats: false
    auto_promote_replied_to_chats: false
    max_new_service_chats_per_day: 3
    require_explicit_approval_for_first_contact: true
    allow_media: true

This example shows the suggested config shape for service conversations, which can be used as a starting point for implementation.

Notes

The implementation should follow a phased approach, with Phase 1 focusing on building a safe foundation and Phase 2 introducing controlled service-chat policy and audit logging. The feature should be optional, off by default, and conservative in defaults, with explicit per-chat or per-policy controls.

Recommendation

Apply the proposed phased implementation, starting with Phase 1, to ensure a safe and controlled introduction of the service conversation feature. This approach will allow for a gradual rollout of the feature while minimizing potential risks and ensuring compliance with product constraints.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING