* fix: recover ciphertext messages via PLACEHOLDER_MESSAGE_RESEND
Add automatic recovery for ciphertext messages using WhatsApp's built-in
PLACEHOLDER_MESSAGE_RESEND (PDO type 4). Override the AB test gate and
send recovery requests after a 5s grace period.
Also adds message_ciphertext_failed event at 15s and fixes incorrect
JSDoc on onAddMessageCiphertextEvent.
* fix: skip message event when ciphertext resolves to revoked
when a ciphertext message is revoked before it decrypts, WhatsApp's
internal revoke handler calls model.set({ type: 'revoked', ... }) on
the existing model in place. This triggers change:type on the ciphertext
model, which fired the deferred listener and emitted a spurious message
event with type === 'revoked'.
add an early return in the once('change:type') callback to skip
onaddmessageevent when the resolved type is revoked.
fixeswwebjs/whatsapp-web.js#201668
* fix: use handlePlaceholderMsgsSeen for ciphertext recovery
replace the manual sendPeerDataOperationRequest call with a direct call
to handlePlaceholderMsgsSeen. This adds subtype filtering (skips
bot_unavailable_fanout, hosted_unavailable_fanout,
view_once_unavailable_fanout), an age check (14 day limit via the
placeholder_message_resend_maximum_days_limit AB prop), and internal
deduplication so the same message doesn't get multiple PDO requests.
the true second argument is the 'is visible' flag the function expects.
since the gate override is already in place earlier in the evaluate
block, the function passes its own internal gate check and proceeds
normally.
suggested by @sofi-ans in review.
* fix: batch ciphertext PDO requests instead of sending per-message
handleplaceholdermsgsseen has built-in chunking (batches of 32 per PDO)
but calling it with [msg] per message from Msg.on('add') bypasses that.
collect ciphertext messages into a shared buffer and flush them in a
single call after the 5s grace period.
also guard the failTimer to skip if the message type already changed.
* fix: replace silent catch blocks with established patterns
address reviewer feedback - remove catch (_) { // comment } pattern:
- Gate override now uses injectToFunction (existing utility)
- PDO call uses direct require without silent error swallowing
* fix(types): add on() overload for message_ciphertext_failed event
* fix: skip unavailable fanout placeholders from ciphertext recovery
unavailable fanout placeholders (view_once, hosted, bot) are
unrecoverable - WhatsApp's handlePlaceholderMsgsSeen explicitly
skips them and won't resend via PDO. Without this check, the
15s failTimer fires message_ciphertext_failed as a false positive.
* feat: add cancelPairingCode() and allow requestPairingCode()
- requestPairingCode() now exposes onCodeReceivedEvent if needed,
so it works on clients initialized in QR mode
- Add cancelPairingCode() method to stop pairing and return to QR
- Update TypeScript definitions
* fix(auth): dynamic ADV key in getQR + structural cancelPairingCode
the getQR closure captured advSecretKey once during initialize(), but
requestpairingcode/cancelPairingCode changes the key in IndexedDB.
the stale closure key caused QR scans to fail with HMAC validation error.
fix: read key dynamically via WAWebUserPrefsMultiDevice.getADVSecretKey()
(synchronous in-memory cache) on every getQR call, matching how WhatsApp
web's internal QR component works.
cancelpairingcode now mirrors WhatsApp Web's resetLinkDeviceState:
refreshqr() restarts WebSocket for fresh refs, then
initializeqrlinking() generates a new key. QR emission happens
automatically via the existing change:ref listener.
---------
Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com>
* ci: setup workflows, dependabot, labeler and commit linting
* docs: update README, community files and issue templates
* chore: configure prettier, editorconfig and format codebase
* chore: restore changes lost during rebase
* docs: adjust url for new logo
* fix: align badges
* chore: resolve conflicts and re-add temp lint
* support sending message from status broadcast
* add to index.d.ts
* add method to contact
* new modules
* Update Utils.js
* add for the examples
* add color assertion function
* finishing..
* added waveforms for audio messages and minor fixes
* fix eslint
* refactor
reorganize the store to include additional modules.
* adapt
* the last one.
---------
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
* fix: remove high cpu consumption by adding waiting for message logic
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
* refactor: use already defined msg id
* refactor: use optional arg for waiting for msg ack
* fix(webpack-exodus): Added the new patch
* fix(webpack-exodus): Fixed v2.3000.x and v2.24
* chore(webpack-exodus): eslint
* fix(webpack-exodus): Fixed Store
* fix(webpack-exodus): slight store fix
* chore(webpack-exodus): fix example so that I don't crash on every load
* chore: eslint fix
* fix(webpack-exodus): prevent confusion with build systems
* fix(webpack-exodus): Add proper groups module
* fix(webpack-exodus): Fix order queries
* fix(webpack-exodus): Bad export name
* feat(webpack-exodus): Re-injection, No more selectors, Pairing Code auth
* fix(webpack-exodus): Eslint and better login/logout handling
* fix(webpack-exodus): 2.24 compatibility
* revert testing options
* chore(webpack-exodus): ESLint
* chore(webpack-exodus): final eslint tweak (did not commit with last commit for some reason)
* style: fix broken link in readme file
* fix(webpack-exodus): Fix forwarding messages
* fix(webpack-exodus): finish forwarding function
* Making the ESLint god happy
* Fix window.Store.ProfilePic.profilePicFind is not a function error (#3001)
* Change window.Store.ProfilePic.profilePicFind to window.Store.ProfilePic.requestProfilePicFromServer
* Prevent breaking v2.2x
* refactor: make it more readable
---------
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
* Sanitize, improves and fixes
* make ESList god happy
* fix getInviteCode for group (#3007) (#3029)
* fix getInviteCode for group (#3007)
* move changes to proper getInviteCode method.
* style fix
* refactor: add try-catch in a case the user is not a group admin
* refactor: handle promise properly
---------
Co-authored-by: Sven Neumann <s.neumann@websix.de>
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
* fixes
* Update LocalWebCache.js
* fix delete on 2.3000 (#3048)
* fix delete on 2.3000
* fix compareWwebVersions
* fix: use proper comparison operator
---------
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
* Implement bot invoking capabilities (#3009)
* Implement bot invoking capabilities
* Update index.d.ts
* Eslint
* Webpack exodus fix message_reaction event (#3099)
* exposed WAWebAddonReactionTableMode
* capture reaction using WAWebAddonReactionTableMode
* move compareWwebVersions and check version before trying to expose new store
* message_reaction on example.js (#3102)
* handle message_reaction event on example.js
* log wweb version on ready
* fix reactions on pvt chats (#3104)
* New group function
* new group settings
* Update Client.js
* Switch pairing method between QR and phone number
* Remove existing pairing code interval
* Modify example.js
* Update docs
* Small improvements in inject function
* Fix ESLint
* example.js correction
* docs: fix docs for 'requestPairingCode' method
Co-authored-by: Leandro Matilla <30844484+wis-dev@users.noreply.github.com>
* Update Utils.js getChatModel because Meta chat object affected Group Chats
* Ajust to set isGroup as false as default
* Remove the need for custom interval
* Fix typo
* Fix intermittent response bug #9864
Co-authored-by: Mob Code 100 <66469454+MobCode100@users.noreply.github.com>
* fix: eslint fix
* Revert "Remove the need for custom interval"
This reverts commit c5d5e5626684742cadbf58f28739c1c2c9dcc582.
* Add wait for PairingCodeLinkUtils on requestPairingCode
* Remove unused vars WhatsWebStaticURL
Co-authored-by: Mob Code 100 <66469454+MobCode100@users.noreply.github.com>
* style: format code
---------
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>
Co-authored-by: Seow Zhen Jun <56989187+seowzhenjun0126@users.noreply.github.com>
Co-authored-by: Sven <sven2neumann@gmail.com>
Co-authored-by: Sven Neumann <s.neumann@websix.de>
Co-authored-by: Jorge Rocha Gualtieri <jorge@jrg.com.br>
Co-authored-by: Mateus Mercer <accounts@matbm.net>
Co-authored-by: Leandro Matilla <30844484+wis-dev@users.noreply.github.com>
Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com>
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
* feat: add createCallLink function
* feat: create Event class
* feat: add functionality for sending Events
* feat: add editEvent function
* refactor: send event location prop as wa does
* refactor: combine modules
* feat: add sendResponseToEvent function
* fix: createEventCallLink parameter
* docs: add documentation
* fix: eslint
* refactor: change timestamp to Date for the user's convenience
* refactor: rename 'Event' to 'ScheduledEvent' for more clarity
* style: fix typo in inner function
* refactor: remove unnecessary inner function
* refactor: rename 'sendResponseToEvent' to 'sendResponseToScheduledEvent' for more clarity
* fix: update the module name
* Changing the quality of media downloads
* return function result
* add option sendImageAsHd
* change example
* fix quotes
* chore: remove unused code
---------
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
* fix: change mentionedIds type from ChatId[] to string[] in Message interface
* fix: correct types for mentionedIds and groupMentions
---------
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
* Send message without quote if quoteFails
New option to send a message without quote when quotedMessage fails
* Rest
* Changing to sendMessage level
* Update Utils.js
* Update Utils.js
* Update Utils.js
---------
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
* fix(webpack-exodus): Added the new patch
* fix(webpack-exodus): Fixed v2.3000.x and v2.24
* chore(webpack-exodus): eslint
* fix(webpack-exodus): Fixed Store
* fix(webpack-exodus): slight store fix
* chore(webpack-exodus): fix example so that I don't crash on every load
* chore: eslint fix
* fix(webpack-exodus): prevent confusion with build systems
* fix(webpack-exodus): Add proper groups module
* fix(webpack-exodus): Fix order queries
* fix(webpack-exodus): Bad export name
* feat(webpack-exodus): Re-injection, No more selectors, Pairing Code auth
* fix(webpack-exodus): Eslint and better login/logout handling
* fix(webpack-exodus): 2.24 compatibility
* revert testing options
* chore(webpack-exodus): ESLint
* chore(webpack-exodus): final eslint tweak (did not commit with last commit for some reason)
* style: fix broken link in readme file
* fix(webpack-exodus): Fix forwarding messages
* fix(webpack-exodus): finish forwarding function
* Making the ESLint god happy
* Fix window.Store.ProfilePic.profilePicFind is not a function error (#3001)
* Change window.Store.ProfilePic.profilePicFind to window.Store.ProfilePic.requestProfilePicFromServer
* Prevent breaking v2.2x
* refactor: make it more readable
---------
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
* Sanitize, improves and fixes
* make ESList god happy
* fix getInviteCode for group (#3007) (#3029)
* fix getInviteCode for group (#3007)
* move changes to proper getInviteCode method.
* style fix
* refactor: add try-catch in a case the user is not a group admin
* refactor: handle promise properly
---------
Co-authored-by: Sven Neumann <s.neumann@websix.de>
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
* fixes
* Update LocalWebCache.js
* fix delete on 2.3000 (#3048)
* fix delete on 2.3000
* fix compareWwebVersions
* fix: use proper comparison operator
---------
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
* Implement bot invoking capabilities (#3009)
* Implement bot invoking capabilities
* Update index.d.ts
* Eslint
* Webpack exodus fix message_reaction event (#3099)
* exposed WAWebAddonReactionTableMode
* capture reaction using WAWebAddonReactionTableMode
* move compareWwebVersions and check version before trying to expose new store
* message_reaction on example.js (#3102)
* handle message_reaction event on example.js
* log wweb version on ready
* fix reactions on pvt chats (#3104)
* New group function
* new group settings
* Update Client.js
---------
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>
Co-authored-by: Seow Zhen Jun <56989187+seowzhenjun0126@users.noreply.github.com>
Co-authored-by: Sven <sven2neumann@gmail.com>
Co-authored-by: Sven Neumann <s.neumann@websix.de>
Co-authored-by: Jorge Rocha Gualtieri <jorge@jrg.com.br>
Co-authored-by: Mateus Mercer <accounts@matbm.net>
* Merge branch 'add-polls' into polls-ext
* added listener to poll votes
* added isUnvote property
* added option for custom message secret
* usage example updated
* added logic for catching removed votes
* usage example updated
* fixed logic for poll vote events
* temp usage example
* No more `isCurrentState`
* messageSecret converted to array
Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>
* docs updated
* we already have messageSecret in vote.parentMessage
* PollVote.selectedOptions changed to be similar to pollOptions
* docs fixed
* window.injectToFunction clarifications
* minor clarifications
* fix: typo
* style: fix broken link in readme file
---------
Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>