- JavaScript 99.5%
- Shell 0.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
* 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 |
||
| .github | ||
| docs | ||
| src | ||
| tests | ||
| tools | ||
| .editorconfig | ||
| .env.example | ||
| .eslintrc.json | ||
| .gitignore | ||
| .jsdoc.json | ||
| .npmignore | ||
| CODE_OF_CONDUCT.md | ||
| example.js | ||
| index.d.ts | ||
| index.js | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
| shell.js | ||
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
- Guide / Getting Started (work in progress)
- Reference documentation
- GitHub
- npm
Installation
The module is now available on npm! npm i whatsapp-web.js
Please note that Node v12+ is required.
Example usage
const { Client } = require('whatsapp-web.js');
const client = new Client();
client.on('qr', (qr) => {
// Generate and scan this code with your phone
console.log('QR RECEIVED', qr);
});
client.on('ready', () => {
console.log('Client is ready!');
});
client.on('message', msg => {
if (msg.body == '!ping') {
msg.reply('pong');
}
});
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.
Supported features
| Feature | Status |
|---|---|
| Multi Device | ✅ |
| Send messages | ✅ |
| Receive messages | ✅ |
| Send media (images/audio/documents) | ✅ |
| Send media (video) | ✅ (requires google chrome) |
| Send stickers | ✅ |
| Receive media (images/audio/video/documents) | ✅ |
| Send contact cards | ✅ |
| Send location | ✅ |
| Send buttons | ✅ |
| Send lists | ✅ (business accounts not supported) |
| Receive location | ✅ |
| Message replies | ✅ |
| Join groups by invite | ✅ |
| Get invite for group | ✅ |
| Modify group info (subject, description) | ✅ |
| Modify group settings (send messages, edit info) | ✅ |
| Add group participants | ✅ |
| Kick group participants | ✅ |
| Promote/demote group participants | ✅ |
| Mention users | ✅ |
| Mute/unmute chats | ✅ |
| Block/unblock contacts | ✅ |
| Get contact info | ✅ |
| Get profile pictures | ✅ |
| Set user status message | ✅ |
| React to messages | ✅ |
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.
Supporting the project
You can support the maintainer of this project through the links below
- Support via GitHub Sponsors
- Support via PayPal
- Sign up for DigitalOcean and get $200 in credit when you sign up (Referral)
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.
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. 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 limitations under the License.