Skip to content

[Feature]: WhatsApp: Telegram-like group behavior controls (ignore_groups, mention-only replies, and group allowlists) #7992

@gitNetw0rk

Description

@gitNetw0rk

Problem or Use Case

Hermes currently supports open WhatsApp onboarding well for direct messages through WHATSAPP_ALLOW_ALL_USERS=true or WHATSAPP_ALLOWED_USERS=*. That is useful when the goal is to let new users start chatting immediately without DM pairing.

The problem appears when the same WhatsApp bot is also present in group chats. In that setup, Hermes can respond in groups too, which makes it harder to use WhatsApp in a way that matches common Telegram bot behavior.

A common bot pattern is:

  • accept new direct messages from anyone
  • stay silent in group chats unless explicitly invoked
  • optionally allow responses only in selected groups

This is especially useful for business or assistant-style bots where the operator wants:

  • open onboarding in DMs
  • low-noise presence in groups
  • predictable trigger behavior
  • less accidental or socially awkward group replies

Right now, WhatsApp seems to have user access controls, but not first-class group behavior controls comparable to:

  • mention-only behavior
  • group allowlists
  • ignore-groups-by-default behavior

This makes WhatsApp bot mode harder to operate safely in mixed DM + group environments.

Proposed Solution

Add WhatsApp group gating controls similar to what Hermes already supports conceptually on other platforms.

Recommended options:

whatsapp.ignore_groups: true|false

  • If true, Hermes ignores all WhatsApp group messages.
  • If false, group messages may be processed normally.
  • Default could be false for backward compatibility, though true may be safer long-term.

whatsapp.require_mention: true|false

  • When enabled, Hermes only replies in WhatsApp groups if explicitly triggered.
  • Trigger conditions could include:
    • message mentions the bot
    • message replies to a bot message
    • message starts with a configured wake prefix such as hermes: or /hermes

WHATSAPP_GROUP_ALLOWED_USERS=<group_id_1,group_id_2,...> or WHATSAPP_ALLOWED_GROUPS=...

  • Only listed WhatsApp groups are allowed for bot replies.
  • If unset, groups are ignored or controlled only by require_mention.
    • could optionally mean all groups.

whatsapp.wake_prefixes: ["hermes:", "/hermes"]

  • Useful because WhatsApp group mention semantics may be less reliable or ergonomic than Telegram usernames.
  • Gives a simple explicit invocation pattern.

Suggested evaluation order for group messages:

  1. If group replies are globally disabled, ignore.
  2. If group allowlist is configured and this group is not allowed, ignore.
  3. If mention/prefix/reply trigger is required and not present, ignore.
  4. Otherwise process and respond.

This would let operators run WhatsApp with:

  • open DMs for new users
  • quiet groups by default
  • explicit wake-up behavior when needed

Alternatives Considered

No response

Feature Type

Gateway / messaging improvement

Scope

Medium (few files, < 300 lines)

Contribution

  • I'd like to implement this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    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