Commit graph whatsapp-web.js/src/util/Injected/Utils.js
Author SHA1 Message Date
Rajeh Taher
883d7e4eda
Store: remove all mentions of window.Store (#127077)
* Store: remove all mentions of window.Store

* Apply suggestion from @BenyFilho

Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com>

---------

Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com>
2026-03-01 16:49:21 -03:00
A. Rifqi Yarzuq Arfani
e66d94efd9
Fix update channel module (#5791)
* Fix getChats (#5779)

* Fix: getChats -> getChatModel -> GroupMetadata and NewsletterMetadata

* Fix module change

* fix: change wrong update module of channel

* fix: correct reference to pupPage in deleteChannel method

---------

Co-authored-by: BenyFilho <168232825+BenyFilho@users.noreply.github.com>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2026-02-03 22:36:16 +02:00
BenyFilho
32e404292b
Fix Channels WhatsApp module change (#5787) 2026-01-30 15:31:07 +02:00
BenyFilho
207a5ad104
Fix getChats (#5779)
* Fix: getChats -> getChatModel -> GroupMetadata and NewsletterMetadata

* Fix module change
2026-01-30 10:50:19 +02:00
noelcarcasesLYN
b03680a70c
Fixes media upload to channels (#5697)
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>
2026-01-30 01:55:30 +00:00
Naor
c61a2ef189
fix: send sticker 2026-01-29 19:34:58 -03:00
Naor
fc2e97e5ab
Refactor sendSeen to include threadId parameter 2026-01-29 19:32:41 -03:00
Filipe
dd9df4083a
fix: use markSeen instead of sendSeen to fix markedUnread error (#5719)
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>
2026-01-19 15:54:31 +02:00
RendyCraft047
6aa1bd85ab
feat: whatsapp stories implementation (#3994)
* 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>
2025-12-13 06:34:55 +02:00
Jan Loewe
166dc73c73
feat(ScheduledEvent): add none option for callType (#3838) 2025-11-20 11:28:32 +00:00
Conan Yu
34b787a795
fix: send image rendering blured (#3775)
Co-authored-by: Yu <>
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2025-11-09 22:39:25 +00:00
RendyCraft047
0c36613cc7
feat+fix: send vote messages & vote update event (#3913)
* add send vote function

* Update index.d.ts

* fix and add required modules

* fix poll update in group chat

* adjustments to improvements

* add example usages

* fix eslint

---------

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2025-11-09 16:37:51 -03:00
BenyFilho
0cdfda238f
Fix Reject Calls (#3909) 2025-11-04 19:13:18 +00:00
BenyFilho
829dd7f6d0
Fix Message Forward (#3910) 2025-11-04 16:09:42 -03:00
BenyFilho
472234da53
Fix PushNotifications (#3801) 2025-10-07 19:27:36 +00:00
BenyFilho
90dc8c8ad4
Fix Mention in Large Groups (#3803)
* Fix Mentioning in Large Groups

* Update Utils.js

* Update Utils.js

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2025-10-07 19:25:48 +00:00
alechkos
d077716315
fix: enforce retrieval lid and phone for previously unknown contacts (#3702)
* fix: check existance if undefined

* fix: handle missing lid/phone in group participant resolution

* refactor: remove duplicated logic
2025-09-06 18:24:19 +03:00
BenyFilho
c9665438f6
Fix method participant on sendMessage (#3778)
* Fix method participant on sendMessage

* Update Utils.js

* Update Utils.js
2025-09-06 00:20:36 +03:00
Seow Zhen Jun
5276e30ac6
fix: Lid is missing in chat table (#3703)
* 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>
2025-09-05 22:19:15 +03:00
BenyFilho
4ac22c8c37
fix Event Ready Again and SendMessage (#3747)
* fix Event Ready Again

* Fixing SendMessage

* Fixing RejectCall
2025-09-02 03:56:56 +03:00
alechkos
2ac982ee1c
fix: return poll vote reactions (#3694)
* wip: return poll vote reactions

* wip: add module

* wip: return poll vote reactions

* wip: return poll vote reactions

* Update Client.js

* Update PollVote.js

* wip: use async getMessagesById

* Update Client.js

* style: clean shit

* style: reformat code

---------

Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>
2025-08-28 11:32:37 +03:00
Jie
6d3078fd77
fix: Correct method invocation (#3720) 2025-08-27 01:34:43 +03:00
alechkos
bd677a8a66
fix: send message properly (#3692)
* 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
2025-08-12 07:33:02 +03:00
Shir Serlui
ecb50450b7
Fix checking if sending to a group (#3592)
* 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>
2025-08-09 00:46:18 +03:00
alechkos
f9db14d185
feat: Event messages (#3345)
* 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
2025-08-09 00:36:27 +03:00
alechkos
ab321f3d7e
fix: Message.pin and Message.unpin (#3319)
* fix: update function to wweb version >2.3000.0

* feat: add foolproof check

* fix: override internal function correctly
2025-08-09 00:35:40 +03:00
BenyFilho
35133a72fc
Fix Message Forward (#3680)
* Fix Message Forward

* Fix Message Forward

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2025-08-06 15:51:36 +03:00
BenyFilho
81fd090e36
fix: Client.createGroup + GroupChat.addParticipants (#3670)
* Adjustment addParticipants

* createGroup fully refactored, fixed bugs, added creation options and updated docs

* fix: eslint fix

* refactor: GroupChat.addParticipants fully refactored

* fix: eslint fix

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2025-08-01 06:43:45 +03:00
devlikeapro
bd08b69c87
Fix send seen on chat - Stream markAvailable (#3663)
fix #3540
2025-07-20 11:07:15 +03:00
BenyFilho
90f2222df0
Fix .sendMessage return (#3612)
Fix sendMessage return
2025-06-26 21:16:20 +03:00
BenyFilho
daaa04445f
Fix Send Animated Sticker (#3591)
* 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>
2025-06-10 09:14:21 +03:00
alechkos
d2fe324e5b
fix: GroupChat.setPicture (#3593)
* fix: find collection if not in cache

* style: use camelcase
2025-06-05 20:21:38 +03:00
alechkos
755cb6ce73
fix: window.WWebJS.getChatModel (#3587)
* fix: skip objects that don't have id

* fix: check for defined contact prop
2025-06-04 11:01:22 -03:00
NickWang
bbc089a625
fix: 🐛 quote message obj (#3586)
✅ Closes: #3585
2025-06-03 20:02:21 +03:00
tofers
0ffb66fdb1
feat: send Media HD (#3535)
* 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>
2025-06-02 22:19:22 +03:00
CyrilLacroix
c142c3bf93
fix(vcard): parse vcard module (#1995)
* fix(vcard): parse vcard module

* fix(vcard): eslint

* refactor: merge internal modules into VCardUtils

* fix: use proper modules for parsing vcards

* feat: add usage example

* chore: eslint fix

* fix: send vcard with email

Co-authored-by: KH Soh <2169449+khsoh@users.noreply.github.com>

* feat: add additional context to usage example

* refactor: revert module rename

---------

Co-authored-by: Codeboss <131376628+codebossdev@users.noreply.github.com>
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
Co-authored-by: KH Soh <2169449+khsoh@users.noreply.github.com>
2025-06-02 22:08:45 +03:00
alechkos
f7d0456a49
hotfix: fix window.WWebJS.getChatModel (#3573) 2025-06-01 23:37:21 -03:00
alechkos
d0642b761c
feat: Channel (#2620)
* window.injectToFunction clarifications

* added createChannel method

* initial Channel class structure

* added getChannelById and getChannels methods

* added 4 methods to change channel metadata

* added deleteChannel method

* added subscribe to/unsubscribe from channel methods

* ecmaVersion updated to 2022

* added searchChannels method

* refactoring of: getChat, getChannel, getChatModel, getChannelModel

* removed Channel.canSend

* sendMessage updated to support channels [p1]

* createChannel: returns string if an error occupied

* added getSubscribers

* added mute/unmute methods

* searchChannels: minor update

* sendMessage updated to support channels [p2]

- added support to send image, sticker, gif and video

* [REFAC] refactored chat retrieving in getChatOrChannel

* [FEAT] added getChannelByInviteCode method

* [CHG] added check if channel creation enabled

* [FEAT] added sendChannelAdminInvitation method

* [WIP] preparations for sending polls [p1]

* [BUG] fixed some internal functions

* [BUG] fixed poll creation

* [COPY] renamed some internal functions

- window.WWebJS.getChatOrChannel renamed back to window.WWebJS.getChat
-window.WWebJS.getChatOrChannelModel renamed back to window.WWebJS.getChatModel

* fix: typo

* fix: send docs without caption

* fix: fixed some internal function

* fix: channel retrieving

* fix: fixed internal getChannelMetadata function

* fix: fixed channel admin can unsubscribe from channel

* feat: channel admin functionality

* feat: added fetchMessages method

Co-authored-by: tuke307 <58882912+tuke307@users.noreply.github.com>

* refactor: revert removing support for Buttons and Lists

Note: buttons and lists are deprecated

* refactor: revert parameter name from 'chatOrChannel' to 'chat'

* fix: support Node v12

* refactor: return 'undefined' in a case of falsy value

* refactor: use already created variable

* docs: fix 'countryCodes' property type

* fix: 'searchChannels' method fixed

* fix: add check in 'setReactionSetting' method

* sendNewsletterMessageJob requires a proper Msg Object in 2.24xx (#10)

Co-authored-by: Sven Neumann <s.neumann@websix.de>

* style: fix broken link in readme file

* fix: only directPath determines whether hasMedia or not

fixes #2952

* fix: get rid of unnecessary 'await'

* feat: add option to send polls in channels

* refactor: get channel instances with 'getChatById'

* chore: fix eslint

* fix: fatal error

* refactor: delete local models by default when unsubscribing

* fix: prevent TypeError if no channel models are returned

* fix: update 'searchChannels' function for WWeb > 2.3000.0

* fix: fix for 'getChannelByInviteCode' function

* fix: fix for 'sendChannelAdminInvite' function

* fix: update 'fetchMessages' for channels

* refactor: update 'setReactionSetting' function

* fix: update 'sendMessage' for channels

* feat: add 'transferChannelOwnership' function

* refactor: add 'deleteChannel' function to 'Client'

* style: fix project code style

* chore: eslint fix

* feat: add 'sendSeen' function

* fix: fix the function restoration after injection

* refactor: remove duplicate module

* fix: get isNewsletter properly

* fix: fix channels media - add mediaHandle

Co-authored-by: devlikepro <155617407+devlikepro@users.noreply.github.com>

---------

Co-authored-by: tuke307 <58882912+tuke307@users.noreply.github.com>
Co-authored-by: Sven <sven2neumann@gmail.com>
Co-authored-by: Sven Neumann <s.neumann@websix.de>
Co-authored-by: devlikepro <155617407+devlikepro@users.noreply.github.com>
2025-05-31 21:36:19 +03:00
alechkos
dd257b2039
feat: @­lid support (#3571)
* fix: convert lid to wid in window.WWebJS.getChatModel

* convert lid to wid in window.WWebJS.getContact
2025-05-31 21:24:44 +03:00
alechkos
91217f87ba
fix: Chat.isMuted (#2999)
* fix: isMuted returns true or false

* docs: add missing parts

* refactor: apply simplification

* fix: update chat instance after calling mute/unmute

* stylee: clarify and fix docs

* fix: fix convertation of Date to timestamp

* refactor: small code refactor
2025-05-30 16:41:31 +03:00
Shir Serlui
494a18ddb2
Support lid me user in message id (#3570)
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2025-05-30 16:38:48 +03:00
Kang
e62f15edf3
Able to forward with caption (#3463)
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
2025-05-30 15:56:35 +03:00
alechkos
0d040611e7
fix: remove serialization on already deserialized object (#3350) 2025-05-30 15:50:02 +03:00
BenyFilho
007ee59cea
Update Utils.js to fix chat.isReadOnly (#3515)
Fixing chat.isReadOnly attribute

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2025-05-30 10:20:43 +03:00
BenyFilho
0ad998d68d
Fix groupChat addParticipants (#3543)
* Fix addParticipants

* fix Approve and Reject Membership Requests
2025-05-12 11:50:42 -03:00
tuyuribr
ad11b5bfee
Send message without quote if quoteFails (#3475)
* 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>
2025-04-24 18:10:39 -03:00
BenyFilho
301c9af8b7
Fix isGroup (#3380)
* Update Utils.js getChatModel because Meta chat object affected Group Chats

* Ajust to set isGroup as false as default
2024-11-22 18:55:13 -03:00
tofers
5b0e139ad4
Get Stories (#3294)
* Get all broadcast

* fixed return msgs

* feat: add usage example

* Update src/structures/Broadcast.js

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2024-09-30 20:33:31 +03:00
Alwin Lubbers
951ff7bfca
fix: sendMessage with quoted message id (#3260)
* fix: sendMessage with quoted message id

Now using `window.Store.Msg.getMessagesById` instead of `window.Store.Msg.get`

* refactor: apply message retrievement to all appropriate places

* chore: ignore ide's dirs

* fix: set proper variable

---------

Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2024-09-15 01:44:07 +03:00
Rajeh Taher
13ce571c64
Farewell, Webpack! Re-injection, Pairing Code login, and 2.24x jumbofix (#2816)
* 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>
2024-07-23 22:19:22 -03:00
Renamed from src/util/Injected.js (Browse further)