diff --git a/src/core/engines/gows/session.gows.core.ts b/src/core/engines/gows/session.gows.core.ts index 1e524943..c2a25c04 100644 --- a/src/core/engines/gows/session.gows.core.ts +++ b/src/core/engines/gows/session.gows.core.ts @@ -419,9 +419,12 @@ export class WhatsappSessionGoWSCore extends WhatsappSession { }), mergeMap(async (message): Promise => { const afterMessage = await this.toWAMessage(message); + // Extract the revoked message ID from protocolMessage.key + const revokedMessageId = message.Message.protocolMessage.key?.ID; return { after: afterMessage, before: null, + revokedMessageId: revokedMessageId, _data: message, }; }), diff --git a/src/core/engines/noweb/session.noweb.core.ts b/src/core/engines/noweb/session.noweb.core.ts index 8e0e5001..361e70a8 100644 --- a/src/core/engines/noweb/session.noweb.core.ts +++ b/src/core/engines/noweb/session.noweb.core.ts @@ -1831,9 +1831,12 @@ export class WhatsappSessionNoWebCore extends WhatsappSession { ), mergeMap(async (message): Promise => { const afterMessage = await this.toWAMessage(message); + // Extract the revoked message ID from protocolMessage.key + const revokedMessageId = message.message.protocolMessage.key?.id; return { after: afterMessage, before: null, + revokedMessageId: revokedMessageId, _data: message, }; }), diff --git a/src/core/engines/webjs/session.webjs.core.ts b/src/core/engines/webjs/session.webjs.core.ts index 09b765a6..94c00cd7 100644 --- a/src/core/engines/webjs/session.webjs.core.ts +++ b/src/core/engines/webjs/session.webjs.core.ts @@ -1418,9 +1418,12 @@ export class WhatsappSessionWebJSCore extends WhatsappSession { const beforeMessage = event.before ? this.toWAMessage(event.before) : null; + // Extract the revoked message ID from the before message + const revokedMessageId = beforeMessage?.id; return { after: afterMessage, before: beforeMessage, + revokedMessageId: revokedMessageId, }; }), ); diff --git a/src/structures/webhooks.dto.ts b/src/structures/webhooks.dto.ts index 21dbe1ad..de22526f 100644 --- a/src/structures/webhooks.dto.ts +++ b/src/structures/webhooks.dto.ts @@ -93,6 +93,13 @@ export class PollVotePayload { export class WAMessageRevokedBody { after?: WAMessage; before?: WAMessage; + + @ApiProperty({ + description: 'ID of the message that was revoked', + example: 'A06CA7BB5DD8C8F705628CDB7E3A33C9', + }) + revokedMessageId?: string; + _data?: any; }