Commit graph whatsapp-web.js/index.js
Author SHA1 Message Date
2^1
807efd502d
chore: cleanup, ci workflows and formatting (#127064)
* 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
2026-03-10 01:45:12 +02: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
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
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
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
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
༺ LᴇG̸ᴇɴD ༻
76f7a6e279
feat: RemoteAuth Strategy (#1450)
* index.js

* [authReady] - new BaseAuthStrategy function

* [RemoteAuth] - new Class RemoteAuth added

* Eslint Fixes

* Eslint Fixes

* Added types for RemoteAuth (mostly assumed types from PR message and src/authStrategies/RemoteAuth.js)

* [dependency updates] - added unzipper & archiver

* [Types] - Fixing typescript declarations

* Renaming Base Class Hook

* auth hook rename on client

* [Error Handling] - Delegate responsability to end users

* [Refactor] - deletemetadata code refactor

* [Refactor] - backupSyncIntervalMs renamed

* [Refactor] - Minor improvement on deleteMetadata

* [Refactor] - backupSyncIntervalMs rename on index.d.ts

* [Update] - Fix for Ubuntu crahsing on extractSession

* [Update] - Delegate responsability to stores of making sure the previous session is deleted strictly only after the new one is saved

* [Update] - Improve file paths handling & naming (reduce assumptions between RemoteAuth and stores)

* [Update] - Adding new event <REMOTE_SESSION_SAVED> on Constants.js

* [Update] - Adding new authHooks <destroy> & <disconnect>

* [Update] - Adding <destroy> & <disconnect> hooks on Client.js

* [Update] - Adding new features to index.d.ts

* [RemoteAuth] - New Features added to RemoteAuth Class

* [dependency updates] - added fs-extra

* [Cross Platform] - Windows is now compatible with RemoteAuth

* [optionalDependencies] - moved archiver, fs-extra & unzipper to optional dependencies on package.json

* [optionalDependencies] - adding validation for when optional dependencies are missing

* [Update] - Node Deprecation warining for rmdir changed for rm instead

Co-authored-by: h110m <nichtwitzig228@gmail.com>
2022-08-10 13:03:07 +02:00
Pedro S. Lopez
f6de161c7d
Auth Strategies (#1257)
* auth strategies

* default to no auth

* rename base auth strategy

* rename base strategy cont.

* refactor auth strategy methods and LocalAuth

* activate old session options even if is falsy value

* move restartOnAuthFail to LegacyAuthStrategy option

* add link to guide item

* update example/shell

* types
2022-02-27 22:02:49 -04:00
tuyuribr
b60029ed09
feat: Send buttons and Lists (#756) 2021-09-14 00:06:05 +03:00
renjop
5177a257cf
feat: Get Orders and Products (#612)
* - Get products and orders

* - Get products and orders

* - Eslint fixes

* - Eslint fixes

* allow downloading media for products

* products and orders work on normal accounts

Co-authored-by: Renato Jop <renato.jop@consystec-corp.com>
Co-authored-by: Pedro Lopez <pedroslopez@me.com>
Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
2021-05-31 20:46:43 -04:00
stefanfuchs
fbdfd2c4dd
fix: Constants export in index.js (#285)
* fix: add Constants export in index.js
* fix: add missing constants export in index.d.ts


Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
2020-08-03 02:58:15 -04:00
Pedro Lopez
7b229a39a4 feat: Send and receive location 2020-02-08 00:46:55 -04:00
Pedro Lopez
a098d61b03 feat: send messages with attachments
close #3
2020-02-04 21:11:20 -04:00
Pedro S. Lopez
ba8edc8d40
[+] Expose information about the logged in client (#19) 2020-02-01 21:16:03 -04:00
Pedro Lopez
1b7376885d Add group chat functions, slight refactoring 2019-02-20 02:42:19 -04:00