Commit graph whatsapp-web.js/src/Client.js
Author SHA1 Message Date
Mob Code 100
b5adf47664
feat: Switch between QR or phone number pairing method (#3180)
* 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>
2025-08-09 00:37:25 +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
18b1d32825
feat: get pinned messages (#3004)
* feat: add getPinnedMessage method

* docs: add docs for the method

* chore: fix eslint

* refactor: change logic of getting pinned messages

* refactor: combine all PinnedMsgUtils

* chore: remove comments and mark as ready for review

* style: fix typo

Co-authored-by: crazynds <36674096+crazynds@users.noreply.github.com>

---------

Co-authored-by: crazynds <36674096+crazynds@users.noreply.github.com>
2025-08-09 00:34:52 +03:00
alechkos
ca30ac4b18
feat: customise linked device name (#3325)
* feat: add functionality for setting device and browser names

* feat: add usage example

* feat: add usage example

* docs: add docs for new functionality

* docs: add missing property

* docs: supplement the implementation documentation
2025-08-06 15:50:42 +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
BenyFilho
81fb154a9f
feat: getContactLidAndPhone (#3673)
* Add method getContactLidOrPhone

* Add method getContactLidOrPhone

* Add method getContactLidOrPhone

* Add method getContactLidOrPhone

* Add method getContactLidOrPhone

* Add method getContactLidOrPhone

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

* Add method getContactLidOrPhone

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

* Add method getContactLidOrPhone

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

* Add method getContactLidOrPhone

* Delete docs/index.html

* Delete docs/Client.html

* Create Client.html

* Create index.html

* Update to return the object

* Update to return an object

* Update Client.js to return both objects lid and phone

* Update Client.js to return both objects lid and phone

* Update src/Client.js

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

* Update src/Client.js

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

* Update index.d.ts

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

* refactor: rename function name for more clarity

* Change accept and return Array

* Change accept and return Array

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2025-07-29 17:39:39 +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
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
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
alechkos
d29eaf7def
feat: save contact to addressbook (#3533)
* feat: add respectfull modules

* feat: add saveOrEditAddressbookContact function

* feat: add deleteAddressbookContact function

* refactor: import necessary type for return value

* style: fix typo

* docs: add ocs

* style: fix typo
2025-05-30 16:39:32 +03:00
alechkos
385e3cc59b
fix: chat instance retrieving in syncHistory (#3342) 2025-05-30 15:53:36 +03:00
Luiz Braga
c6b6fb149b
fix: puppeteer connection with browser url (#3518)
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2025-05-30 14:39:11 +03:00
tofers
c0ba5e545b
feat: Setting background synchronization (#3331)
* Changing the background synchronization setting

* add  example

* return function

* style: add clarification note

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
2025-05-30 11:06:08 +03:00
Gusfahmi Alghazali Caniago
cefc403791
fix: change resetState evaluate function (#3358)
Co-authored-by: gusfahmi <gus@entertrim.com>
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
2025-05-30 10:33:47 +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
devlikeapro
e470c82237
Use idempotent exposeFunctionIfAbsent (no reinject flag) (#3233)
* Add exposeFunctionIfAbsent function

* use exposeFunctionIfAbsent function instead of original exposeFunction

* Remove "reinject" flag

* exposeFunctionIfAbsent - onQRChangedEvent

* exposeFunctionIfAbsent - onLogoutEvent
2024-09-25 18:31:35 +03:00
Bernardo Peña
796a0a2367
Update Client.js (#3286)
fix: resolved issue with 'onPollVoteEvent' binding after logout

- Fixed error: 'Failed to add page binding with name onPollVoteEvent: window["onPollVoteEvent"] already exists!'
- The error occurred after logging out and attempting to reconnect.
- Connection would get stuck in 'authenticated' state and never reach 'ready'.

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2024-09-23 17:14:41 +03:00
alechkos
5b0e0612de
fix: make function getContactDeviceCount work (#3284)
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
2024-09-23 17:12:17 +03:00
Kang
0fa6ebb66d
Sync history conversation of the Chat (#3281)
* Sync historical message

* Add documentation

* Code simplify

* feat: add syncHistory method in Chat class

* docs: update docs

* chore: update examples

* fix: handle asynchronous function properly

* refactor: include await

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2024-09-20 11:29:08 +03:00
tuyuribr
d2597bba72
Count user connected devices (#3223)
* Update Store.js

* All

* Make Eslist god happy

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
2024-09-18 10:33:23 +03:00
Alwin Lubbers
8fdf2b840e
fix: getMessageById false error with group chat message id (#3265)
Messages from Group Chats will have 4 elements in the `params` variable, instead of the 3 for private messages. That's because the `params` variable splits the string by `_`. Group chat messages will have 3 `_` characters instead of 2 for private chat messages.

This updates the check to account for group chat messages (which have 4 parameters instead of 3).

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
2024-09-15 13:09:15 +03:00
Shir Serlui
f203523b75
Allow access to the original error object (#3252)
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2024-09-15 01:46:09 +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
Ayush Mourya
22af9df3d0
Handling client.logout() Exception gracefully with optional chaining (#2447)
* Added Optional Chaining to Avoid Breaking The Code

* Added Optional Chaining to Avoid Breaking Code

* Updated code to handle all node version

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
2024-09-14 20:43:21 +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
alechkos
01714fe599
feat: vote_update event (#2596)
* 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>
2024-04-30 20:23:17 +03:00
Bauguelson
aa26876a4b
Update Client.js (#2813)
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2024-04-28 15:10:54 +03:00
Rajeh Taher
a339199610
Fix isOfficialClient (#2794)
* fix(isOfficialClient): initial commit

* fix(isOfficial): eslint my dear

* chore: eslint my dear x2

* fix(isOfficial): make code more transparent

* fix(isOfficial): missing await

* fix(isOfficial): Obfuscate set to custom seed so maintainers can verify

* feat(isOfficial): original code

* chore: eslint
2024-03-01 16:05:09 +02:00
alechkos
bd7cf9b463
fix: link retrieval from message (#2716)
* fix: fix links retrieving from message

* docs: fix Message.links property type

* refactor: revert bracking changes
2024-01-14 08:45:33 +02:00
alechkos
e0d955f130
feat: group mentions + improved user mentions (#2602)
* added logic to mention groups + fixed user mentions

* usage example updated

* docs fixed

* window.injectToFunction clarifications

* usage example clarifications

* fix: typo

* docs: added missed docs
2024-01-11 10:33:10 +02:00
tofers
1dd35be834
feat: event message_ciphertext (#2292)
* add option cipherMsg

* add event  message_ciphertext

* example

* remove option cipherMsg

* removing unlinked code

* Update Client.js

---------

Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2023-12-16 17:10:26 +01:00
alechkos
981fa822a0
fix: send docs without caption (#2660)
* fix: allow to send docs without a caption

* fix: typo

* fix: async function proper handling
2023-12-12 18:36:44 -03:00
tofers
3dab4a3f41
fix: message_edit event and edit caption in file (#2617)
* edit caption

* Update Client.js

* refactor: events combined into one line

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
2023-12-05 14:50:55 +02:00
tofers
04175063ce
feat: control auto-loading of files + fixed method setDisplayName (#2295)
* fixing the setPushname function

* Adding functions that change the media autoloading

* Checking against raw data

* fixed

* fixed merge

* ESLint

* Update src/util/Injected.js

Co-authored-by: alechkos <93551621+alechkos@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>
2023-10-22 14:07:55 +03:00
alechkos
67d305be78
feat: send polls (#2377)
* feat: added Poll class

* feat: logic for sending polls added

* updated poll properties on returned message instance

* docs updated

* usage example updated

* module fixed

* 'pollSendOptions' changed to 'options'

* window.compareWwebVersions fixed

* small update to improve the performance of findImpl fix

* added option for custom message secret

* usage example updated
2023-10-19 19:37:30 +03:00
alechkos
49feb3660c
fix: chat object creation within the event (#2506)
* fixed chat object creation

* window.compareWwebVersions fixed

* small update to improve the performance of findImpl fix
2023-10-18 17:22:32 +03:00
alechkos
c0705a2216
fix+feat: addParticipants + createGroup (#2344)
* added required modules

* added sendGroupV4Invite implementation

* docs updated accordingly

* bug fixed

* added usage example

* ESLint fix

* extended resulting object

* docs updated accordingly

* added required modules

* updated comments

* bug fixed

* added usage example

* fixed to catch unexpected errors

* removed unnecessary module

* updated usage example

* minor fixes

* changed to return a string if an error is occupied

* fixed usage example

* removed unneccessary module

* added getAddParticipantsRpcResult

* updated addParticipants

- added AddParticipnatsOptions to provide values for sleep, autoSendInviteV4, comment
- combined addParticipants with sendGroupInviteMessage

* removed unneccessary sendGroupV4Invite

* docs updated

* fixed statement fot autoSendInviteV4

* minor fixes

- the returned value of addParticipants is no longer wrapped in an array
- docs updated
- fixed bug with the returned code value when the code is '200'

* added logic of retrieving the group profile picture

this allows to send an invitation with a profile picture thumbnail of the group

* minor fixes

* added fix for the inviteV4 to be sent

* updated usage example

* minor fix

* ESLint fix

* fix for code 419

* function name getProfilePictureThumb changed to be more clear

* refactor: modules moved to window.Store.GroupParticipants

* refactor: edited link of usage examples

* refactor: LidManipulations changed to LidUtils

* refactor: modules regrouping

To keep the modules in order were made some changes:
- JoinInviteV4 renamed to GroupInviteV4 and grouped with module sendGroupInviteMessage
- GroupParticipants grouped with module sendAddParticipantsRPC

* fix: injectToFunction fixed to work properly

* revert docs changes for Chat

* Merge branch 'main' into fix-add-participants

* docs fixed

* minor fix in injectToFunction

* removed data stringifying/parsing

* added random sleep time logic

* code refactoring

* docs updated

* addParticipants method refactored

* createGroup method extended

- added functionality to send private invitations automatically to missing participants
- added ability to provide value for message timer
- added ability to link a group to the community parent group at the stage of creating a group
- extended the returned data after the method call

* docs updated + typo fixed

* added ability to create group with myself only

* example updated

* docs clarified

* small code refactoring

* window.Store.Invite and window.Store.InviteInfo grouped

* window.compareWwebVersions fixed

* small update to improve the performance of findImpl fix

* gid as wid structure

* docs + example updated

* parenthesis

* avoid sleep after the last iteration

* fixed compatibility issue for sendGroupInviteMessage

* fixed issue with stale groupmetadata

in some cases after the participant has left the group, that participant is still stored in groupmetadata

* fixed compatibility issue for sendAddParticipantsRPC

* minor fix

* jsdocs fixed

* fixed issue with group creation

* fixed createGroup method

- added check for unregistered phone number
- extended returning data from method call: added title
- code refactored
- jsdocs fixed

* fixed addParticipants method

- added check for unregistered number
- code refactored

* docs fixed

* usage example fixed

* removed unnecessary method call

* jsdocs fixed

* check for group admin fixed
2023-10-11 16:10:26 +03:00
alechkos
56320c88f8
feat: group membership requests (#2516)
* added event for group membership request

* small update to improve the performance of findImpl fix

* window.compareWwebVersions fixed

* added getGroupMembershipRequests method

* added approveGroupMembershipRequest method

* correct module for getGroupMembershipRequests

* membershipRequestAction separated to Injected.js

* docs clarification for approveGroupMembershipRequest

* added rejectGroupMembershipRequest method

* module fixed

* methods extension

* docs clarification

* force to update group membership requests

* docs fixed

* added usage example

* avoid sleep after the last iteration

* fix: added missing modules

* improve forcing to update group membership requests

* usage example clarification

* module refactored

* optional parameters

* usage example modified

* remove default values for membershipRequestAction

* added error description for memb req action

* usage example fixed

* return result even if ServerStatusCodeError

* default error message was missing

* removed line break
2023-10-09 18:17:02 +03:00
alechkos
ecf19eb9a5
fix: sending locations (#2339)
* added function to to modify module functions

* fix for locations to be sent

* changes for class Location

- description property was splited into name and address
- added url property
- added ability to pass name, address and url as options while creating an instance

* docs updated

* usage example updated

* added url checking

* fixed url

* updated location property in Message class

* fixed url when http prefix is provided

* injectToFunction updated to be more flexible

* docs clarification

* ESLint fix

* fix: injectToFunction fixed to work properly

* minor fix in injectToFunction

* refactor: added usage of url validator

* small change to improve performance for findImpl fix

* window.compareWwebVersions fixed
2023-09-20 23:11:52 +03:00
Humberto Zambrano
152f0a64cd
Update Client.js in order to detect login in new WhatsAppWeb (#2474)
* Update Client.js

New WhatsAppWeb selector for login sucess

* change to search

---------

Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>
2023-09-14 17:02:40 +03:00
Vinicius Tavares
abac063b77
Fix for #2433 (#2434)
* Fix #2433

* make ESLint happy
2023-08-23 10:11:28 -03:00
alechkos
df1b070d54
feat: send audio with waveform (#2309)
* added generateWaveform

* docs updated

* added usage example

* ESLint fix

* fixed: undefined returned on waveform generation failure

* fix: ESLint
2023-08-10 13:37:45 +02:00
alechkos
3be7566483
fix: CallCollection (#2385)
* fix: changed module for CallCollection

* code refactored

* compareWwebVersions fixed and moved to window.compareWwebVersions

* code refactoring
2023-08-09 19:27:24 +03:00
Christophe
776c1b152e
Improve logout() LocalAuth logic (#2175)
* Improve logout() LocalAuth logic
- Wait for browser to close to prevent Exception on Windows

* Update Client.js

* Update LocalAuth.js

---------

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
2023-08-07 23:51:31 +03:00
Shir Serlui
b4d82d8425
Feat: get message by id (#1634)
* feat: get message by id

Add the feature of getting messages by id.
It's loads messages that are not loaded in the Store.Msg, and add them into the Store.Msg.
I don't use the draft because this is already work

* Fix typo

* Fix for test

* Update index.d.ts

---------

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
Co-authored-by: Codeboss <131376628+codebossdev@users.noreply.github.com>
2023-08-07 14:10:11 -03:00
RendyCraft047
d959645bc3
fix: group invite v4 (#2321)
* Update Injected.js

* Update Client.js

* fix changes

* make it simple

* fix if undefined

---------

Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
2023-08-07 06:37:56 +02:00
alechkos
dce964d934
fix: group_join event (#2320)
* added linked_group_join subtype

* typo fixed from pr#2027

* fix: ESLint
2023-08-06 09:30:59 +03:00
alechkos
8ff5bceca0
feat: send photo/video as a view once message (#2317)
* added isViewOnce property

* docs updated

* added usage example

* fix: ESLint
2023-07-31 12:53:35 +03:00
tofers
8fc6e6098c
feat: add or remove labels (#1915)
* add or remove labels

* Strings use singlequote

* add event chat change labels

* Revert "add event chat change labels"
2023-06-25 16:25:49 -03:00