Compare commits

...

1 Commits

Author SHA1 Message Date
Gavriel Cohen 3f1319273b fix(whatsapp): mark DMs as isMention so router auto-engages
DMs are addressed to the bot by definition. Mirror the chat-sdk-bridge
semantics (onDirectMessage forwards isMention=true) so the host router
can short-circuit DM auto-create + approval flow at router.ts:184
instead of silently dropping inbound from chats it doesn't recognize.

Without this, a v1 → v2 migration where Baileys' LID→phone translation
fails on the first message (no senderPn, signal repository cold) leaves
v2 unable to route DMs at all — the chatJid arrives as `<lid>@lid`,
the migrated messaging_group is keyed by `<phone>@s.whatsapp.net`, and
the router drops because !isMention.

Group messages keep isMention undefined so the router falls through to
agent-name regex matching, unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 15:24:26 +03:00
+7
View File
@@ -571,6 +571,13 @@ registerChannelAdapter('whatsapp', {
const inbound: InboundMessage = {
id: msg.key.id || `wa-${Date.now()}`,
kind: 'chat',
// DMs are addressed to the bot by definition. Mark them as
// platform-confirmed mentions so the router treats them like
// chat-sdk-bridge's onDirectMessage path — auto-creating an
// approval-required messaging_group when the chat is unknown,
// instead of silently dropping at router.ts:184.
isMention: !isGroup ? true : undefined,
isGroup,
content: {
text: content,
sender,