whatsapp-web.js
-A WhatsApp API client that connects through the WhatsApp Web browser app
-It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocked.
-NOTE: I can't guarantee you will not be blocked by using this method, although it has worked for me. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.
-Quick Links
+About
+A WhatsApp API client that connects through the WhatsApp Web browser app
+The library works by launching the WhatsApp Web browser application and managing it using Puppeteer to create an instance of WhatsApp Web, thereby mitigating the risk of being blocked. The WhatsApp API client connects through the WhatsApp Web browser app, accessing its internal functions. This grants you access to nearly all the features available on WhatsApp Web, enabling dynamic handling similar to any other Node.js application.
+++[!IMPORTANT] +It is not guaranteed you will not be blocked by using this method. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.
+
Links
-
-
- Guide / Getting Started (work in progress) -
- Reference documentation +
- Website +
- Guide (source) (work in progress) +
- Documentation (source) +
- WWebJS Discord
- GitHub
- npm
Installation
The module is now available on npm! npm i whatsapp-web.js
Please note that Node v12+ is required.
+++[!NOTE] +Node
+v18+
is required.
QUICK STEPS TO UPGRADE NODE
+Windows
+Manual
+Just get the latest LTS from the official node website.
+npm
+sudo npm install -g n
+sudo n stable
+
+Choco
+choco install nodejs-lts
+
+Winget
+winget install OpenJS.NodeJS.LTS
+
+Ubuntu / Debian
+curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - &&\
+sudo apt-get install -y nodejs
+
Example usage
const { Client } = require('whatsapp-web.js');
@@ -67,8 +106,8 @@ Example usage
client.initialize();
-Take a look at example.js for another example with more use cases.
-For more information on saving and restoring sessions, check out the available Authentication Strategies.
+Take a look at example.js for another examples with additional use cases.
+For further details on saving and restoring sessions, explore the provided Authentication Strategies.
Supported features
Send media (video) | -✅ (requires google chrome) | +✅ (requires Google Chrome) |
Send stickers | @@ -116,11 +155,11 @@||
Send buttons | -✅ | +❌ (DEPRECATED) |
Send lists | -✅ (business accounts not supported) | +❌ (DEPRECATED) |
Receive location | @@ -163,6 +202,10 @@✅ | |
Mention groups | +✅ | +|
Mute/unmute chats | ✅ | React to messages | ✅ | +
Create polls | +✅ | +|
Vote in polls | +🔜 | +|
Communities | +🔜 | +|
Channels | +🔜 | +
Something missing? Make an issue and let us know!
Contributing
-Pull requests are welcome! If you see something you'd like to add, please do. For drastic changes, please open an issue first.
+Feel free to open pull requests; we welcome contributions! However, for significant changes, it's best to open an issue beforehand. Make sure to review our contribution guidelines before creating a pull request. Before creating your own issue or pull request, always check to see if one already exists!
Supporting the project
You can support the maintainer of this project through the links below
-
@@ -199,16 +258,16 @@
- Sign up for DigitalOcean and get $200 in credit when you sign up (Referral)
Supporting the project
Disclaimer
-This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.
+This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners. Also it is not guaranteed you will not be blocked by using this method. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.
License
Copyright 2019 Pedro S Lopez
-Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this project except in compliance with the License. +
Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this project except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and +
Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
limitations under the License.
Client
Client
-
Client#
event:message
@@ -882,6 +941,16 @@ - +
-
+ Client#
event:message_ciphertext +
+ - + +
Client
-
Client#
event:message_create
@@ -917,6 +986,11 @@ - +
-
+ Client#
event:vote_update +
+ - +
-
Client#
getBlockedContacts()
@@ -952,6 +1026,11 @@ - +
-
+ Client#
getContactDeviceCount(contactId) +
+ - +
-
Client#
getContacts()
@@ -992,11 +1071,6 @@ - -
Client
Client
Client
-
Client#
getProfilePicUrl(contactId)
@@ -1017,11 +1091,21 @@ - +
Client
-
Client#
initialize() - +
-
+ Client#
inject() +
+ - +
-
Client#
isRegisteredUser(id)
@@ -1047,11 +1131,26 @@ - +
-
+ Client#
pupBrowser +
+ - + +
-
+ Client#
pupPage +
+ - +
-
Client#
rejectGroupMembershipRequests(groupId, options) - +
-
+ Client#
requestPairingCode(phoneNumber, showNotification) +
+ - +
-
Client#
resetState()
@@ -1082,6 +1181,26 @@ - +
-
+ Client#
setAutoDownloadAudio(flag) +
+ - + +
-
+ Client#
setAutoDownloadDocuments(flag) +
+ - + +
-
+ Client#
setAutoDownloadPhotos(flag) +
+ - + +
-
+ Client#
setAutoDownloadVideos(flag) +
+ - +
-
Client#
setDisplayName(displayName)
@@ -1358,16 +1477,16 @@ - -
Client
Client
Events
-
Events.
GROUP_MEMBERSHIP_REQUEST
@@ -1398,6 +1517,11 @@ - +
-
+ Events.
MESSAGE_CIPHERTEXT +
+ - +
-
Events.
MESSAGE_CREATE
@@ -1408,16 +1532,16 @@ - -
Events
Events
-
Events.
MESSAGE_RECEIVED
@@ -1458,6 +1582,11 @@ - +
-
+ Events.
VOTE_UPDATE +
+ - +