fix(revoke): use protocolMessageKey for original message ID#201696
Open
Adi1231234 wants to merge 2 commits intowwebjs:mainfrom
Open
fix(revoke): use protocolMessageKey for original message ID#201696Adi1231234 wants to merge 2 commits intowwebjs:mainfrom
Adi1231234 wants to merge 2 commits intowwebjs:mainfrom
Conversation
read the original message key directly from protocolMessageKey instead of relying on the broken last_message cache that often failed to match.
Contributor
Author
|
Hi @2hoch1, I've re-submitted with the proper PR template this time. Let me know if everything looks good now! |
|
@Adi1231234 Thanks for this PR! I've been hitting this issue for a long time - I tested it recently and it works great. |
sofi-ans
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When a message is revoked (deleted for everyone), WWJS reports the wrong message ID. The old code used a
last_messagevariable to cache the most recent message, then compared it when a revoke came in. This was unreliable because the IDs don't match after revoke, and a single variable can only track one message at a time.WhatsApp stores the original message key on the revoked model as
protocolMessageKey. This PR reads it directly instead of guessing from a cache.Changes:
msg.protocolMessageKeyto get the original IDnew Message(this, { ...msg, id: originalKey })last_messagecacheVerified from WhatsApp's bundle source code that every revoke goes through a single code path that always sets
protocolMessageKeyto the original key. It's stored as a persistent property on the model, so it survives serialization.Testing Summary
Test Details
Ran a version with verification logs in production across multiple accounts for 3 weeks. 500 revoke events analyzed -
protocolMessageKeywas present and correct in 100% of cases. No edge cases or failures observed.Environment
Type of Change
Checklist
npm test).index.d.ts) have been updated if necessary.example.js) / documentation have been updated if applicable.