@another-trial/whatsapp-web.js 1.34.1 → 1.35.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +2 -2
- package/CODE_OF_CONDUCT.md +133 -133
- package/LICENSE +201 -201
- package/README.md +155 -185
- package/example.js +699 -690
- package/index.d.ts +2248 -2202
- package/index.js +35 -35
- package/package.json +59 -59
- package/shell.js +36 -36
- package/src/Client.js +2447 -2361
- package/src/authStrategies/BaseAuthStrategy.js +26 -26
- package/src/authStrategies/LocalAuth.js +58 -58
- package/src/authStrategies/NoAuth.js +11 -11
- package/src/authStrategies/RemoteAuth.js +210 -210
- package/src/factories/ChatFactory.js +21 -21
- package/src/factories/ContactFactory.js +15 -15
- package/src/structures/Base.js +21 -21
- package/src/structures/Broadcast.js +69 -69
- package/src/structures/BusinessContact.js +20 -20
- package/src/structures/Buttons.js +81 -81
- package/src/structures/Call.js +75 -75
- package/src/structures/Channel.js +382 -382
- package/src/structures/Chat.js +329 -299
- package/src/structures/ClientInfo.js +70 -70
- package/src/structures/Contact.js +208 -208
- package/src/structures/GroupChat.js +485 -485
- package/src/structures/GroupNotification.js +104 -104
- package/src/structures/Label.js +49 -49
- package/src/structures/List.js +79 -79
- package/src/structures/Location.js +61 -61
- package/src/structures/Message.js +780 -747
- package/src/structures/MessageMedia.js +111 -111
- package/src/structures/Order.js +51 -51
- package/src/structures/Payment.js +79 -79
- package/src/structures/Poll.js +44 -44
- package/src/structures/PollVote.js +75 -75
- package/src/structures/PrivateChat.js +12 -12
- package/src/structures/PrivateContact.js +12 -12
- package/src/structures/Product.js +67 -67
- package/src/structures/ProductMetadata.js +24 -24
- package/src/structures/Reaction.js +68 -68
- package/src/structures/ScheduledEvent.js +71 -71
- package/src/structures/index.js +27 -27
- package/src/util/Constants.js +186 -183
- package/src/util/Injected/AuthStore/AuthStore.js +16 -16
- package/src/util/Injected/AuthStore/LegacyAuthStore.js +21 -21
- package/src/util/Injected/LegacyStore.js +145 -145
- package/src/util/Injected/Store.js +257 -233
- package/src/util/Injected/Utils.js +1168 -1169
- package/src/util/InterfaceController.js +126 -126
- package/src/util/Puppeteer.js +23 -23
- package/src/util/Util.js +186 -186
- package/src/webCache/LocalWebCache.js +40 -40
- package/src/webCache/RemoteWebCache.js +39 -39
- package/src/webCache/WebCache.js +13 -13
- package/src/webCache/WebCacheFactory.js +19 -19
package/README.md
CHANGED
|
@@ -1,185 +1,155 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<br />
|
|
3
|
-
<p>
|
|
4
|
-
<a href="https://wwebjs.dev"><img src="https://github.com/wwebjs/
|
|
5
|
-
</p>
|
|
6
|
-
<br />
|
|
7
|
-
<p>
|
|
8
|
-
<a href="https://www.npmjs.com/package/whatsapp-web.js"><img src="https://img.shields.io/npm/v/whatsapp-web.js.svg" alt="npm" /></a>
|
|
9
|
-
<a href="https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765"><img src="https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg" alt="Depfu" /></a>
|
|
10
|
-
<img src="https://img.shields.io/badge/WhatsApp_Web-2.3000.1017054665-brightgreen.svg" alt="WhatsApp_Web 2.2346.52" />
|
|
11
|
-
<a href="https://discord.gg/H7DqQs4"><img src="https://img.shields.io/discord/698610475432411196.svg?logo=discord" alt="Discord server" /></a>
|
|
12
|
-
</p>
|
|
13
|
-
<br />
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
## About
|
|
17
|
-
**A WhatsApp API client that
|
|
18
|
-
|
|
19
|
-
The library
|
|
20
|
-
|
|
21
|
-
> [!IMPORTANT]
|
|
22
|
-
> **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.**
|
|
23
|
-
|
|
24
|
-
## Links
|
|
25
|
-
|
|
26
|
-
* [
|
|
27
|
-
* [Guide][guide] ([source][guide-source])
|
|
28
|
-
* [Documentation][documentation] ([source][documentation-source])
|
|
29
|
-
* [
|
|
30
|
-
* [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
>
|
|
38
|
-
>
|
|
39
|
-
|
|
40
|
-
##
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
##
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
|
101
|
-
|
|
|
102
|
-
|
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
158
|
-
you may not use this project except in compliance with the License.
|
|
159
|
-
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
160
|
-
|
|
161
|
-
Unless required by applicable law or agreed to in writing, software
|
|
162
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
163
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
164
|
-
See the License for the specific language governing permissions and
|
|
165
|
-
limitations under the License.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
[website]: https://wwebjs.dev
|
|
169
|
-
[guide]: https://guide.wwebjs.dev/guide
|
|
170
|
-
[guide-source]: https://github.com/wwebjs/wwebjs.dev/tree/main
|
|
171
|
-
[documentation]: https://docs.wwebjs.dev/
|
|
172
|
-
[documentation-source]: https://github.com/pedroslopez/whatsapp-web.js/tree/main/docs
|
|
173
|
-
[discord]: https://discord.gg/H7DqQs4
|
|
174
|
-
[gitHub]: https://github.com/pedroslopez/whatsapp-web.js
|
|
175
|
-
[npm]: https://npmjs.org/package/whatsapp-web.js
|
|
176
|
-
[nodejs]: https://nodejs.org/en/download/
|
|
177
|
-
[examples]: https://github.com/pedroslopez/whatsapp-web.js/blob/master/example.js
|
|
178
|
-
[auth-strategies]: https://wwebjs.dev/guide/creating-your-bot/authentication.html
|
|
179
|
-
[google-chrome]: https://wwebjs.dev/guide/creating-your-bot/handling-attachments.html#caveat-for-sending-videos-and-gifs
|
|
180
|
-
[deprecated-video]: https://www.youtube.com/watch?v=hv1R1rLeVVE
|
|
181
|
-
[gitHub-sponsors]: https://github.com/sponsors/pedroslopez
|
|
182
|
-
[support-payPal]: https://www.paypal.me/psla/
|
|
183
|
-
[digitalocean]: https://m.do.co/c/73f906a36ed4
|
|
184
|
-
[contributing]: https://github.com/pedroslopez/whatsapp-web.js/blob/main/CODE_OF_CONDUCT.md
|
|
185
|
-
[whatsapp]: https://whatsapp.com
|
|
1
|
+
<div align="center">
|
|
2
|
+
<br />
|
|
3
|
+
<p>
|
|
4
|
+
<a href="https://wwebjs.dev"><img src="https://github.com/wwebjs/assets/blob/main/Collection/GitHub/wwebjs.png?raw=true" title="whatsapp-web.js" alt="WWebJS Website" width="500" /></a>
|
|
5
|
+
</p>
|
|
6
|
+
<br />
|
|
7
|
+
<p>
|
|
8
|
+
<a href="https://www.npmjs.com/package/whatsapp-web.js"><img src="https://img.shields.io/npm/v/whatsapp-web.js.svg" alt="npm" /></a>
|
|
9
|
+
<a href="https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765"><img src="https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg" alt="Depfu" /></a>
|
|
10
|
+
<img src="https://img.shields.io/badge/WhatsApp_Web-2.3000.1017054665-brightgreen.svg" alt="WhatsApp_Web 2.2346.52" />
|
|
11
|
+
<a href="https://discord.gg/H7DqQs4"><img src="https://img.shields.io/discord/698610475432411196.svg?logo=discord" alt="Discord server" /></a>
|
|
12
|
+
</p>
|
|
13
|
+
<br />
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
## About
|
|
17
|
+
**A WhatsApp API client that operates via the WhatsApp Web browser.**
|
|
18
|
+
|
|
19
|
+
The library launches the WhatsApp Web browser app via Puppeteer, accessing its internal functions and creating a managed instance to reduce the risk of being blocked. This gives the API client nearly all WhatsApp Web features for dynamic use in a Node.js application.
|
|
20
|
+
|
|
21
|
+
> [!IMPORTANT]
|
|
22
|
+
> **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.**
|
|
23
|
+
|
|
24
|
+
## Links
|
|
25
|
+
|
|
26
|
+
* [GitHub][gitHub]
|
|
27
|
+
* [Guide][guide] ([source][guide-source])
|
|
28
|
+
* [Documentation][documentation] ([source][documentation-source])
|
|
29
|
+
* [Discord Server][discord]
|
|
30
|
+
* [npm][npm]
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
The module is available on [npm][npm] via `npm i whatsapp-web.js`!
|
|
35
|
+
|
|
36
|
+
> [!NOTE]
|
|
37
|
+
> **Node ``v18`` or higher, is required.**
|
|
38
|
+
> See the [Guide][guide] for quick upgrade instructions.
|
|
39
|
+
|
|
40
|
+
## Example usage
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
const { Client } = require('whatsapp-web.js');
|
|
44
|
+
|
|
45
|
+
const client = new Client();
|
|
46
|
+
|
|
47
|
+
client.on('qr', (qr) => {
|
|
48
|
+
// Generate and scan this code with your phone
|
|
49
|
+
console.log('QR RECEIVED', qr);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
client.on('ready', () => {
|
|
53
|
+
console.log('Client is ready!');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
client.on('message', msg => {
|
|
57
|
+
if (msg.body == '!ping') {
|
|
58
|
+
msg.reply('pong');
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
client.initialize();
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Take a look at [example.js][examples] for another examples with additional use cases.
|
|
66
|
+
For further details on saving and restoring sessions, explore the provided [Authentication Strategies][auth-strategies].
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## Supported features
|
|
70
|
+
|
|
71
|
+
| Feature | Status |
|
|
72
|
+
| ------------- | ------------- |
|
|
73
|
+
| Multi Device | ✅ |
|
|
74
|
+
| Send messages | ✅ |
|
|
75
|
+
| Receive messages | ✅ |
|
|
76
|
+
| Send media (images/audio/documents) | ✅ |
|
|
77
|
+
| Send media (video) | ✅ [(requires Google Chrome)][google-chrome] |
|
|
78
|
+
| Send stickers | ✅ |
|
|
79
|
+
| Receive media (images/audio/video/documents) | ✅ |
|
|
80
|
+
| Send contact cards | ✅ |
|
|
81
|
+
| Send location | ✅ |
|
|
82
|
+
| Send buttons | ❌ [(DEPRECATED)][deprecated-video] |
|
|
83
|
+
| Send lists | ❌ [(DEPRECATED)][deprecated-video] |
|
|
84
|
+
| Receive location | ✅ |
|
|
85
|
+
| Message replies | ✅ |
|
|
86
|
+
| Join groups by invite | ✅ |
|
|
87
|
+
| Get invite for group | ✅ |
|
|
88
|
+
| Modify group info (subject, description) | ✅ |
|
|
89
|
+
| Modify group settings (send messages, edit info) | ✅ |
|
|
90
|
+
| Add group participants | ✅ |
|
|
91
|
+
| Kick group participants | ✅ |
|
|
92
|
+
| Promote/demote group participants | ✅ |
|
|
93
|
+
| Mention users | ✅ |
|
|
94
|
+
| Mention groups | ✅ |
|
|
95
|
+
| Mute/unmute chats | ✅ |
|
|
96
|
+
| Block/unblock contacts | ✅ |
|
|
97
|
+
| Get contact info | ✅ |
|
|
98
|
+
| Get profile pictures | ✅ |
|
|
99
|
+
| Set user status message | ✅ |
|
|
100
|
+
| React to messages | ✅ |
|
|
101
|
+
| Create polls | ✅ |
|
|
102
|
+
| Channels | ✅ |
|
|
103
|
+
| Vote in polls | 🔜 |
|
|
104
|
+
| Communities | 🔜 |
|
|
105
|
+
|
|
106
|
+
Something missing? Make an issue and let us know!
|
|
107
|
+
|
|
108
|
+
## Contributing
|
|
109
|
+
|
|
110
|
+
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][contributing] before creating a pull request. Before creating your own issue or pull request, always check to see if one already exists!
|
|
111
|
+
|
|
112
|
+
## Supporting the project
|
|
113
|
+
|
|
114
|
+
You can support the maintainer of this project through the links below
|
|
115
|
+
|
|
116
|
+
- [Support via GitHub Sponsors][gitHub-sponsors]
|
|
117
|
+
- [Support via PayPal][support-payPal]
|
|
118
|
+
- [Sign up for DigitalOcean][digitalocean] and get $200 in credit when you sign up (Referral)
|
|
119
|
+
|
|
120
|
+
## Disclaimer
|
|
121
|
+
|
|
122
|
+
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]. "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.
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
Copyright 2019 Pedro S Lopez
|
|
127
|
+
|
|
128
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
129
|
+
you may not use this project except in compliance with the License.
|
|
130
|
+
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
131
|
+
|
|
132
|
+
Unless required by applicable law or agreed to in writing, software
|
|
133
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
134
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
135
|
+
See the License for the specific language governing permissions and
|
|
136
|
+
limitations under the License.
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
[guide]: https://guide.wwebjs.dev/guide
|
|
140
|
+
[guide-source]: https://github.com/wwebjs/wwebjs.dev/tree/main
|
|
141
|
+
[documentation]: https://docs.wwebjs.dev/
|
|
142
|
+
[documentation-source]: https://github.com/pedroslopez/whatsapp-web.js/tree/main/docs
|
|
143
|
+
[discord]: https://discord.gg/H7DqQs4
|
|
144
|
+
[gitHub]: https://github.com/pedroslopez/whatsapp-web.js
|
|
145
|
+
[npm]: https://npmjs.org/package/whatsapp-web.js
|
|
146
|
+
[nodejs]: https://nodejs.org/en/download/
|
|
147
|
+
[examples]: https://github.com/pedroslopez/whatsapp-web.js/blob/master/example.js
|
|
148
|
+
[auth-strategies]: https://wwebjs.dev/guide/creating-your-bot/authentication.html
|
|
149
|
+
[google-chrome]: https://wwebjs.dev/guide/creating-your-bot/handling-attachments.html#caveat-for-sending-videos-and-gifs
|
|
150
|
+
[deprecated-video]: https://www.youtube.com/watch?v=hv1R1rLeVVE
|
|
151
|
+
[gitHub-sponsors]: https://github.com/sponsors/pedroslopez
|
|
152
|
+
[support-payPal]: https://www.paypal.me/psla/
|
|
153
|
+
[digitalocean]: https://m.do.co/c/73f906a36ed4
|
|
154
|
+
[contributing]: https://github.com/pedroslopez/whatsapp-web.js/blob/main/CODE_OF_CONDUCT.md
|
|
155
|
+
[whatsapp]: https://whatsapp.com
|