diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index 22839fd451..ce3206121c 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -5155,6 +5155,16 @@ export class BaileysStartupService extends ChannelStartupService { private prepareMessage(message: WAMessage): Message { const keyAny = message.key as any; + + // When a contact has disappearing messages enabled, WhatsApp wraps the + // real payload in an `ephemeralMessage` envelope. `getContentType` then + // reports `ephemeralMessage` and the actual content (text, media, etc.) + // stays buried, so downstream consumers never see a usable message and the + // event is effectively dropped (issue #2773). Unwrap the envelope so the + // message is processed as its inner type. Non-ephemeral messages are left + // untouched by the `?? message.message` fallback. + const content = message.message?.ephemeralMessage?.message ?? message.message; + const messageRaw: any = { key: { ...message.key, @@ -5166,15 +5176,15 @@ export class BaileysStartupService extends ChannelStartupService { (message.key.fromMe ? 'VocĂȘ' : message?.participant || (message.key?.participant ? message.key.participant.split('@')[0] : null)), - message: this.deserializeMessageBuffers({ ...message.message }), - messageType: getContentType(message.message), + message: this.deserializeMessageBuffers({ ...content }), + messageType: getContentType(content), messageTimestamp: Long.isLong(message.messageTimestamp) ? message.messageTimestamp.toNumber() : (message.messageTimestamp as number), source: getDevice(keyAny.id), instanceId: this.instanceId, status: status[message.status], - contextInfo: this.deserializeMessageBuffers(message.message?.messageContextInfo), + contextInfo: this.deserializeMessageBuffers(content?.messageContextInfo), }; if (!messageRaw.status && message.key.fromMe === false) {