diff --git a/extensions/whatsapp/src/inbound/extract.test.ts b/extensions/whatsapp/src/inbound/extract.test.ts index 9b11bd1340b..0414c11621e 100644 --- a/extensions/whatsapp/src/inbound/extract.test.ts +++ b/extensions/whatsapp/src/inbound/extract.test.ts @@ -169,6 +169,16 @@ describe("hasInboundUserContent", () => { ).toBe(true); }); + it("returns true for contactsArrayMessage via contact placeholder extraction", () => { + expect( + hasInboundUserContent({ + contactsArrayMessage: { + contacts: [{ displayName: "Alice", vcard: "BEGIN:VCARD\nEND:VCARD" }], + }, + } as proto.IMessage), + ).toBe(true); + }); + it("returns true for buttons response (user button click)", () => { expect( hasInboundUserContent({ diff --git a/extensions/whatsapp/src/inbound/extract.ts b/extensions/whatsapp/src/inbound/extract.ts index 70071efe588..043fdab81ff 100644 --- a/extensions/whatsapp/src/inbound/extract.ts +++ b/extensions/whatsapp/src/inbound/extract.ts @@ -456,7 +456,7 @@ function hasInteractiveResponseContent(message: proto.IMessage | undefined): boo } /** - * Fast O(1) check that a Baileys message carries user-visible inbound content + * Fast check that a Baileys message carries user-visible inbound content * (text, media, contact, location, button/list selection). Returns false for * protocol/receipt/typing notifications that arrive on the same * `messages.upsert` stream as real messages but should not trigger pairing @@ -472,19 +472,13 @@ export function hasInboundUserContent(rawMessage: proto.IMessage | undefined): b if (extractMediaPlaceholder(rawMessage)) { return true; } - if (extractContactContext(rawMessage)) { - return true; - } if (extractLocationData(rawMessage)) { return true; } - if (hasInteractiveResponseContent(rawMessage)) { - return true; - } // Walk wrappers (ephemeral, viewOnce, etc.) — interactive responses // can arrive nested. for (const candidate of buildMessageChain(rawMessage)) { - if (candidate !== rawMessage && hasInteractiveResponseContent(candidate)) { + if (hasInteractiveResponseContent(candidate)) { return true; } }