Skip to content

feat(whatsapp): authorize @mentions in groups regardless of allowlist - #3636

Closed
ajayr wants to merge 1 commit into
NousResearch:mainfrom
ajayr:whatsapp-group-mention-authorization
Closed

feat(whatsapp): authorize @mentions in groups regardless of allowlist#3636
ajayr wants to merge 1 commit into
NousResearch:mainfrom
ajayr:whatsapp-group-mention-authorization

Conversation

@ajayr

@ajayr ajayr commented Mar 28, 2026

Copy link
Copy Markdown

Summary

Enables WhatsApp group members to trigger the bot via @mentions without being on the individual user allowlist.

Changes

  • MessageEvent (base.py): Added bot_mentioned: bool flag for cross-platform use
  • WhatsApp Bridge (bridge.js): Detects @mentions using the participant list in group messages, passes botMentioned: true when detected
  • WhatsApp Adapter (whatsapp.py): Extracts and forwards the botMentioned flag from bridge events
  • Gateway (run.py): Authorizes @mentions from any user in group chats, bypassing the allowlist check

Why

Previously, only users on the allowlist could trigger the bot, even in group chats. This blocked legitimate use cases where:

  1. A group chat has a specific rule like "only respond when @mentioned"
  2. Group members should be able to trigger the bot without individual authorization
  3. The bot owner wants per-group behavior constraints without managing individual allowlists

Behavior

  • Group @mentions are authorized regardless of the allowlist
  • DMs still require the user to be on the allowlist (or use pairing code if enabled)
  • Respects per-group memory rules (e.g., "only respond when @mentioned")

Testing

Tested in a WhatsApp group with a user not on the allowlist successfully triggering the bot via @mention.

Authorized bot @mention in group from 63694516043891@lid (Aarthi T) on whatsapp

Bot responded correctly to the @mention.

- Add bot_mentioned flag to MessageEvent for cross-platform use
- Bridge detects @mentions using participant list in group messages
- Gateway authorizes @mentions from any user in group chats
- Respects per-group memory rules (e.g., only respond when @mentioned)

This enables group members to trigger the bot without being on the
individual allowlist, while still respecting group-specific behavior
constraints stored in memory.
@teknium1

teknium1 commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Superseded by PR #4730 which implements the full require_mention/mention_patterns/free_response_chats config system for WhatsApp (mirroring Telegram's pattern). Your earlier work on @mention authorization for groups was appreciated — the merged solution covers that use case and more. Credit to @kshitijk4poor for the implementation.

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.

2 participants