* fix: use WA's own LID resolution for block/unblock
block() was passing a Chat object to blockContact() which expects a
contact. unblock() was using synchronous Contact.get() which returns
undefined if the contact isn't cached.
with blocklist migration enabled, blocking a PN contact without a chat
fails because the internal S() function needs a LID or an existing chat
to resolve the accountLid. The old getChat() approach worked around this
by creating a chat via findOrCreateLatestChat, but that's a side effect
and passes the wrong type.
use WAWebBlockContactUtils.getContactToBlockOnlyUseIfNoAssociatedChat()
instead, which is WA's own utility for this exact case. It resolves the
contact's LID via getCurrentLidContact() without needing to create a
chat.
* fix: check alternate WID for blocked status in getContactModel
iscontactblocked on PN contacts returns false because the Blocklist
only contains LID entries. Use getAlternateUserWid() to resolve
the PN/LID mapping and check the Blocklist directly, matching WA
web's own $Contact$p_3 fallback logic.
---------
Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com>
* fix: prevent store mutation in getContact/getChatModel LID handling
getcontact() and getChatModel() overwrite .id directly on live Backbone
model references from WhatsApp Web's Contact/Participant store. This
permanently corrupts the store for the lifetime of the session, causing
all subsequent lookups for the same contact to crash with:
- "Cannot read properties of undefined (reading '_serialized')"
- "Data passed to getter must include an id property"
the fix resolves LID to phone on the serialized copy only, never
touching the live store model.
fixes#127054
* perf: use BusinessProfile.find() instead of fetchBizProfile()
businessprofile.find() checks the local cache first and only fetches
from the server when the profile is missing, while fetchBizProfile()
always makes a network call (~85-100ms per contact). This significantly
reduces latency when getContact is called repeatedly for the same
business contacts.
closes#201656
co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: remove unnecessary try/catch around BusinessProfile.find()
businessprofile.find() never throws for non-business contacts - it returns
a BusinessProfile model with profileOptions: null, not an error. The comment
was factually incorrect. The existing profileOptions guard handles the
non-business case correctly without any exception handling.
verified in WhatsApp Web DevTools: find() returns a valid object for regular,
business, LID, and even non-existent contacts. Only throws when called without
an id, which cannot happen here.
co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor: simplify contact/chat model utils via native WA functions
replace the O(n²) LID participant loop with WAWebLidMigrationUtils.toPn()
which resolves LID WIDs via LidPnCache in O(1). Remove the findContact
wrapper since Contact.find() accepts strings directly. Use
wawebwidfactory.createWidFromWidLike() for safe isLid() calls that handle
plain-object contact ids without WID prototype methods.
co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* perf: skip BusinessProfile.find() for non-business contacts
wa's own source guards this behind isBusiness || isEnterprise
(WAWebUseBusinessProfile.react). No point querying business profiles
for regular contacts - saves a wasted IQ roundtrip (~80ms) per call.
* revert: remove block/unblock changes from this PR
moved to a dedicated PR (#201671) with a proper fix using
wawebblockcontactutils.getContactToBlockOnlyUseIfNoAssociatedChat()
for correct LID resolution.
* fix: convert contactId to Wid before collection find() calls
contact.find() and BusinessProfile.find() reject plain strings when
the entry is not cached or stale, throwing "gadd called without an id
attr". Use createWid(contactId) to ensure a proper Wid object is passed.
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.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
Ensures correct media upload to channels by using the mimetype from mediaInfo, rather than the file, when creating OpaqueData.
Also, it replaces the call to the function getRandomFilehash with the value of the function to retrieve the correct token.
Co-authored-by: Noel Carcases <noel.david.carcases.gomez@ibm.com>
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com>
Fixes TypeError: Cannot read properties of undefined (reading 'markedUnread')
that occurs in newer WhatsApp Web versions.
The sendSeen method was removed/changed in recent WhatsApp Web updates.
Using markSeen resolves the issue.
Fixes#5718
Co-authored-by: cp1797 <cp1797@users.noreply.github.com>
Co-authored-by: eltonnicolau <eltonnicolau@users.noreply.github.com>
Co-authored-by: telmedola <telmedola@users.noreply.github.com>
Co-authored-by: qw271862028 <qw271862028@users.noreply.github.com>
Co-authored-by: duola8789 <duola8789@users.noreply.github.com>
* 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>
* Use window.Store.FindOrCreateChat.findOrCreateLatestChat to get chat
* refactor: change find to findOrCreateLatestChat
* refactor: update 'injectToFunction' to support nested props in modules
* fix: resolve 'Lid is missing in chat table' error
---------
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
* 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 checking if sending to a group
* chore: mark channels as done feature
* refactor: add safety check for chat.id.isGroup
---------
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
* 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
* Fix Send Animated Sitckers
* Update Utils.js
* Add a condition to ignore channels
Add a condition to ignore channels and keep compatibility.
* chore: mark channels as done feature
---------
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>