@open-wa/wa-automate 4.76.0 → 5.0.0-alpha.0

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.
Files changed (125) hide show
  1. package/README.md +14 -165
  2. package/dist/cli-runtime-B7_3MM0c.cjs +798 -0
  3. package/dist/cli-runtime-B7_3MM0c.cjs.map +1 -0
  4. package/dist/cli-runtime-CmpYxFCk.d.cts +31 -0
  5. package/dist/cli-runtime-CmpYxFCk.d.cts.map +1 -0
  6. package/dist/cli.cjs +17 -0
  7. package/dist/cli.cjs.map +1 -0
  8. package/dist/cli.d.cts +2 -0
  9. package/dist/index.cjs +224 -0
  10. package/dist/index.cjs.map +1 -0
  11. package/dist/index.d.cts +81 -0
  12. package/dist/index.d.cts.map +1 -0
  13. package/package.json +34 -177
  14. package/CNAME +0 -1
  15. package/_tsconfig.docs.json +0 -140
  16. package/bin/config-schema.json +0 -1
  17. package/bin/oas-type-schemas.json +0 -1
  18. package/bin/server.js +0 -45
  19. package/build/build-config-json-for-bin.ts +0 -56
  20. package/build/generate-oas-types.ts +0 -31
  21. package/dist/api/Client.d.ts +0 -2255
  22. package/dist/api/Client.js +0 -4358
  23. package/dist/api/functions/exposed.enum.d.ts +0 -7
  24. package/dist/api/functions/exposed.enum.js +0 -11
  25. package/dist/api/model/aliases.d.ts +0 -110
  26. package/dist/api/model/aliases.js +0 -3
  27. package/dist/api/model/button.d.ts +0 -24
  28. package/dist/api/model/button.js +0 -2
  29. package/dist/api/model/call.d.ts +0 -51
  30. package/dist/api/model/call.js +0 -18
  31. package/dist/api/model/chat.d.ts +0 -221
  32. package/dist/api/model/chat.js +0 -52
  33. package/dist/api/model/config.d.ts +0 -836
  34. package/dist/api/model/config.js +0 -111
  35. package/dist/api/model/contact.d.ts +0 -143
  36. package/dist/api/model/contact.js +0 -2
  37. package/dist/api/model/errors.d.ts +0 -90
  38. package/dist/api/model/errors.js +0 -117
  39. package/dist/api/model/events.d.ts +0 -120
  40. package/dist/api/model/events.js +0 -127
  41. package/dist/api/model/group-metadata.d.ts +0 -124
  42. package/dist/api/model/group-metadata.js +0 -25
  43. package/dist/api/model/id.d.ts +0 -5
  44. package/dist/api/model/id.js +0 -2
  45. package/dist/api/model/index.d.ts +0 -110
  46. package/dist/api/model/index.js +0 -128
  47. package/dist/api/model/label.d.ts +0 -24
  48. package/dist/api/model/label.js +0 -2
  49. package/dist/api/model/media.d.ts +0 -93
  50. package/dist/api/model/media.js +0 -12
  51. package/dist/api/model/message.d.ts +0 -422
  52. package/dist/api/model/message.js +0 -40
  53. package/dist/api/model/product.d.ts +0 -141
  54. package/dist/api/model/product.js +0 -2
  55. package/dist/api/model/reactions.d.ts +0 -76
  56. package/dist/api/model/reactions.js +0 -2
  57. package/dist/api/model/sessionInfo.d.ts +0 -77
  58. package/dist/api/model/sessionInfo.js +0 -2
  59. package/dist/build/build-postman.d.ts +0 -1
  60. package/dist/build/build-postman.js +0 -262
  61. package/dist/cli/cli-options.d.ts +0 -9
  62. package/dist/cli/cli-options.js +0 -289
  63. package/dist/cli/collections.d.ts +0 -2
  64. package/dist/cli/collections.js +0 -251
  65. package/dist/cli/file-utils.d.ts +0 -1
  66. package/dist/cli/file-utils.js +0 -71
  67. package/dist/cli/index.d.ts +0 -1
  68. package/dist/cli/index.js +0 -231
  69. package/dist/cli/integrations/chatwoot.d.ts +0 -49
  70. package/dist/cli/integrations/chatwoot.js +0 -672
  71. package/dist/cli/integrations/cloudflare.d.ts +0 -6
  72. package/dist/cli/integrations/cloudflare.js +0 -76
  73. package/dist/cli/logo.d.ts +0 -1
  74. package/dist/cli/logo.js +0 -49
  75. package/dist/cli/server.d.ts +0 -24
  76. package/dist/cli/server.js +0 -540
  77. package/dist/cli/setup.d.ts +0 -30
  78. package/dist/cli/setup.js +0 -308
  79. package/dist/config/puppeteer.config.d.ts +0 -11
  80. package/dist/config/puppeteer.config.js +0 -65
  81. package/dist/controllers/auth.d.ts +0 -36
  82. package/dist/controllers/auth.js +0 -322
  83. package/dist/controllers/browser.d.ts +0 -17
  84. package/dist/controllers/browser.js +0 -603
  85. package/dist/controllers/events.d.ts +0 -82
  86. package/dist/controllers/events.js +0 -173
  87. package/dist/controllers/init_patch.d.ts +0 -13
  88. package/dist/controllers/init_patch.js +0 -42
  89. package/dist/controllers/initializer.d.ts +0 -22
  90. package/dist/controllers/initializer.js +0 -511
  91. package/dist/controllers/launch_checks.d.ts +0 -8
  92. package/dist/controllers/launch_checks.js +0 -130
  93. package/dist/controllers/patch_manager.d.ts +0 -37
  94. package/dist/controllers/patch_manager.js +0 -231
  95. package/dist/controllers/popup/index.d.ts +0 -3
  96. package/dist/controllers/popup/index.html +0 -168
  97. package/dist/controllers/popup/index.js +0 -148
  98. package/dist/controllers/script_preloader.d.ts +0 -17
  99. package/dist/controllers/script_preloader.js +0 -88
  100. package/dist/index.d.ts +0 -13
  101. package/dist/index.js +0 -36
  102. package/dist/lib/README.md +0 -5
  103. package/dist/lib/base64.js +0 -1
  104. package/dist/lib/hash.js +0 -1
  105. package/dist/lib/jsSha.min.js +0 -1
  106. package/dist/lib/launch.js +0 -1
  107. package/dist/lib/qr.min.js +0 -1
  108. package/dist/lib/wapi.js +0 -2163
  109. package/dist/logging/custom_transport.d.ts +0 -9
  110. package/dist/logging/custom_transport.js +0 -35
  111. package/dist/logging/logging.d.ts +0 -50
  112. package/dist/logging/logging.js +0 -196
  113. package/dist/structures/Collector.d.ts +0 -202
  114. package/dist/structures/Collector.js +0 -391
  115. package/dist/structures/Dialog.d.ts +0 -55
  116. package/dist/structures/Dialog.js +0 -21
  117. package/dist/structures/MessageCollector.d.ts +0 -78
  118. package/dist/structures/MessageCollector.js +0 -145
  119. package/dist/structures/preProcessors.d.ts +0 -58
  120. package/dist/structures/preProcessors.js +0 -181
  121. package/dist/utils/pid_utils.d.ts +0 -1
  122. package/dist/utils/pid_utils.js +0 -26
  123. package/dist/utils/tools.d.ts +0 -152
  124. package/dist/utils/tools.js +0 -494
  125. package/tos.md +0 -77
package/README.md CHANGED
@@ -1,183 +1,32 @@
1
- > [!WARNING]
2
- > By visiting this page you [explicitly agree to the Terms of Service (read here)](https://github.com/open-wa/wa-automate-nodejs/blob/master/tos.md)
1
+ # @open-wa/wa-automate
3
2
 
4
- <div align="center">
5
- <img src="https://raw.githubusercontent.com/open-wa/wa-automate-nodejs/master/resources/hotfix-logo.png" width="128" height="128"/>
3
+ > The most reliable WhatsApp automation CLI and API server.
6
4
 
7
- # wa-automate-nodejs
5
+ Part of the [@open-wa v5 monorepo](https://github.com/open-wa/wa-automate-nodejs).
8
6
 
9
- > wa-automate-nodejs is the most advanced NodeJS library which provides a high-level API to control WA.
10
- >
11
- >
7
+ ## Features
12
8
 
13
- [![Ceasefire Now](https://badge.techforpalestine.org/ceasefire-now)](https://techforpalestine.org/learn-more)
9
+ - **Easy API**: Run a standalone server and interact via HTTP.
10
+ - **Multi-session**: Manage multiple WhatsApp accounts simultaneously.
11
+ - **Robustness**: Advanced retries and state management.
12
+ - **Drivers**: Support for Playwright, Puppeteer, and Lightpanda.
14
13
 
15
- [![npm version](https://img.shields.io/npm/v/@open-wa/wa-automate.svg?color=green)](https://www.npmjs.com/package/@open-wa/wa-automate)
16
- ![node](https://img.shields.io/node/v/@open-wa/wa-automate)
17
- [![Downloads](https://img.shields.io/npm/dm/@open-wa/wa-automate.svg)](https://www.npmjs.com/package/@open-wa/wa-automate)
18
- [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/open-wa/wa-automate-nodejs.svg)](http://isitmaintained.com/project/open-wa/wa-automate-nodejs "Average time to resolve an issue")
19
- [![Percentage of issues still open](http://isitmaintained.com/badge/open/open-wa/wa-automate-nodejs.svg)](http://isitmaintained.com/project/open-wa/wa-automate-nodejs "Percentage of issues still open")
20
-
21
- <a href="https://discord.gg/dnpp72a"><img src="https://img.shields.io/discord/661438166758195211?color=blueviolet&label=discord&style=flat" /></a> ![WhatsApp_Web 2.2147.16](https://img.shields.io/badge/WhatsApp_Web-2.2147.16-brightgreen.svg)<img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/openwadev?label=Follow%20%40openwadev%20for%20updates&logo=twitter&style=social"/>
22
-
23
- <a href="https://cloud.digitalocean.com/apps/new?repo=https%3A%2F%2Fgithub.com%2Fopen-wa%2Fwa-automate-docker%2Ftree%2Fmaster&refcode%3D4b093f6ecd3a&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge">
24
- <img style="max-height:200px" src="https://raw.githubusercontent.com/open-wa/wa-automate-deploy-heroku/main/assets/do_deploy.png" alt="Deploy to DO"/>
25
- </a>
26
-
27
-
28
- <p align="center">
29
- <a href="#functions-list">Key Features</a> •
30
- <a href="https://docs.openwa.dev/docs/get-started/installation">Getting Started</a> •
31
- <a href="https://docs.openwa.dev/docs/get-started/quick-run">Easy API</a> •
32
- <a href="https://docs.openwa.dev/docs/api/classes/api_Client.Client">Documentation</a> •
33
- <a href="https://openwa.page.link/key">Get a License Key</a> •
34
- <a href="#support">Support</a>
35
- </p>
36
-
37
- </div>
38
-
39
- ## Installation and Updating
40
-
41
- Use this command to install the library for the first time and to keep the library up to date.
14
+ ## Install
42
15
 
43
16
  ```bash
44
- > npm i --save @open-wa/wa-automate@latest
17
+ pnpm add @open-wa/wa-automate
45
18
  ```
46
19
 
47
20
  ## Usage
48
21
 
49
- ## CLI
50
-
51
- Want to convert your WA account to an API instantly? You can now with the CLI. For more details see [Easy API](https://docs.openwa.dev/pages/Getting%20Started/quick-run.html)
52
-
53
22
  ```bash
54
- > npx @open-wa/wa-automate --help
23
+ wa-automate --help
55
24
  ```
56
25
 
57
- ## Custom Setup
58
-
59
- Learn more about all possible configuration options here: [ConfigObject](https://docs.openwa.dev/interfaces/api_model_config.ConfigObject.html)
60
-
61
- ```javascript
62
- const wa = require('@open-wa/wa-automate');
63
-
64
- wa.create({
65
- sessionId: "COVID_HELPER",
66
- multiDevice: true, //required to enable multiDevice support
67
- authTimeout: 60, //wait only 60 seconds to get a connection with the host account device
68
- blockCrashLogs: true,
69
- disableSpins: true,
70
- headless: true,
71
- hostNotificationLang: 'PT_BR',
72
- logConsole: false,
73
- popup: true,
74
- qrTimeout: 0, //0 means it will wait forever for you to scan the qr code
75
- }).then(client => start(client));
76
-
77
- function start(client) {
78
- client.onMessage(async message => {
79
- if (message.body === 'Hi') {
80
- await client.sendText(message.from, '👋 Hello!');
81
- }
82
- });
83
- }
84
-
85
- ```
86
-
87
- ###### After executing `create()` function, **@open-wa/wa-automate** will create an instance of WA web. If you are not logged in, it will print a QR code in the [terminal](https://i.imgur.com/g8QvERI.png). Scan it with your phone and you are ready to go!
88
-
89
- ###### @open-wa/wa-automate will remember the session so there is no need to authenticate every time
90
-
91
-
92
- ## Multi Device Support
93
-
94
- We're currently in a weird transitionary period where some people are being forced to adopt Multi Device (MD). Once the transition is complete, the library default will be to turn on MD support. For now, you have to set it yourself explicitly either by using the `--multi-device` flag (with the [CLI](#CLI)) or setting `multiDevice: true` in your config (with your custom code)
95
-
96
- ### Latest Changes
26
+ ## Documentation
97
27
 
98
- With the constant updates from WA. It is advisable to always use the latest version of `@open-wa/wa-automate`.
99
-
100
- <div align="center">
101
- <img src="https://raw.githubusercontent.com/open-wa/wa-automate-nodejs/master/release.png"/>
102
- </div>
103
-
104
- ### Functions list
105
-
106
- | Function | Reference |
107
- | --------------------------------- | ----------- |
108
- | Receive message | [onMessage](https://docs.openwa.dev/classes/api_Client.Client.html#onMessage)
109
- | Automatic QR Refresh | [autoRefresh](https://docs.openwa.dev/classes/api_Client.Client.html#autoRefresh)
110
- | Send text | [sendText](https://docs.openwa.dev/classes/api_Client.Client.html#sendText)
111
- | Get contacts | [getContact](https://docs.openwa.dev/classes/api_Client.Client.html#getContact)
112
- | Get chats | [getAllChats](https://docs.openwa.dev/classes/api_Client.Client.html#getAllChats)
113
- | Get groups | [getAllGroups](https://docs.openwa.dev/classes/api_Client.Client.html#getAllGroups)
114
- | Get group members | [getGroupMembersId](https://docs.openwa.dev/classes/api_Client.Client.html#getGroupMembersId)
115
- | Send contact | [sendContact](https://docs.openwa.dev/classes/api_Client.Client.html#sendContact)
116
- | Send Images (image) | [sendImage](https://docs.openwa.dev/classes/api_Client.Client.html#sendImage)
117
- | Send media (audio, doc) | [sendFile](https://docs.openwa.dev/classes/api_Client.Client.html#sendFile)
118
- | Send media (video) | [Send Videos](https://docs.openwa.dev/pages/How%20to/send-files/send-videos.html)
119
- | Send stickers | [sendStickerfromUrl](https://docs.openwa.dev/classes/api_Client.Client.html#sendStickerFromuUrl)
120
- | Decrypt media (image, audio, doc) | [Decrypt Media](https://docs.openwa.dev/pages/How%20to/decrypt-media.html)
121
- | Capturing QR Code | [Capturing QR Code](https://docs.openwa.dev/pages/The%20Client/launch-events/capture-qr.html)
122
- | Multiple Sessions | [Multiple Sessions](https://docs.openwa.dev/pages/The%20Client/the-client/multiple-sessions.html)
123
- | Last seen | [getLastSeen](https://docs.openwa.dev/classes/api_Client.Client.html#getLastSeen)
124
- | isOnline | [isChatOnline](https://docs.openwa.dev/classes/api_Client.Client.html#isChatOnline)
125
- | 📍 Send Location | [sendLocation](https://docs.openwa.dev/classes/api_Client.Client.html#sendLocation)
126
- | Simulated '...typing' | [simulateTyping](https://docs.openwa.dev/classes/api_Client.Client.html#simulateTyping)
127
- | Send GIFs! | [sendVideoAsGif](https://docs.openwa.dev/classes/api_Client.Client.html#sendVideoAsGif)
128
- | Send Giphy! | [sendGiphy](https://docs.openwa.dev/classes/api_Client.Client.html#sendGiphy)
129
- | Forward Messages | [forwardMessages](https://docs.openwa.dev/classes/api_Client.Client.html#forwardMessages)
130
- | Listen to Read Receipts | [onAck](https://docs.openwa.dev/classes/api_Client.Client.html#onAck)
131
- | Listen to Live Locations | [onLiveLocation](https://docs.openwa.dev/classes/api_Client.Client.html#onLiveLocation)
132
- | Group participant changes | [onParticipantsChanged](https://docs.openwa.dev/classes/api_Client.Client.html#onParticipantsChanged)
133
- | Create Groups | [Create Group](https://docs.openwa.dev/pages/How%20to/groups.html#create-a-group)
134
- | add, remove, promote, demote participants | [Manage Participants](https://docs.openwa.dev/pages/How%20to/groups/manage-participants.html)
135
-
136
- [Checkout all the available functions here.](https://docs.openwa.dev/classes/api_Client.Client.html)
137
-
138
- ## Running the demo
139
-
140
- You can clone this repo and run the demo, but you will need to use typescript/ts-node:
141
-
142
- ```bash
143
- > git clone https://github.com/open-wa/wa-automate-nodejs.git
144
- > cd wa-automate-nodejs
145
- > npm i
146
- > npm i -g ts-node typescript
147
- > cd demo
148
- > ts-node index.ts
149
- ```
150
-
151
- ## Contributing
152
-
153
- Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
154
-
155
- ## Support
156
-
157
- If you need paid support, consulting, or just want support/sponsor the ongoing development of this project, you can in the following ways:
158
-
159
- |Description | Link |
160
- |- |:-:|
161
- | Get a License key | <a class="gumroad-button" href="https://gum.co/BTMt?wanted=true" target="_blank" data-gumroad-single-product="true" style='background-color: white !important;background-image: url(https://gumroad.com/button/button_bar.jpg) !important;background-repeat: repeat-x !important;border-radius: 4px !important;box-shadow: rgba(0, 0, 0, 0.4) 0 0 2px !important;color: #999 !important;display: inline-block !important;font-family: -apple-system, ".SFNSDisplay-Regular", "Helvetica Neue", Helvetica, Arial, sans-serif !important;font-size: 16px !important;font-style: normal !important;font-weight: 500 !important;line-height: 50px !important;padding: 0 15px !important;text-shadow: none !important;text-decoration: none !important;'><span class="gumroad-button-logo" style='background-image: url(https://gumroad.com/button/button_logo.png) !important;background-size: cover !important;height: 17px !important;width: 16px !important;display: inline-block !important;margin-bottom: -3px !important;margin-right: 15px !important;'></span>Get a License key</a>
162
- | Donate or Book 1 hour consult | [![Buy me a coffee][buymeacoffee-shield]][buymeacoffee]
163
- | Per-minute consulting | <a href="http://otechie.com/smashah"><img src="https://api.otechie.com/consultancy/smashah/badge.svg" alt="Consulting"/></a>
164
- | Hire me! | [![Consulting Request][consult-shield]][consult]
28
+ For full guides and API reference, visit the [docs site](https://docs.openwa.dev).
165
29
 
166
30
  ## License
167
31
 
168
- [Hippocratic + Do Not Harm Version 1.0](https://github.com/open-wa/wa-automate-nodejs/blob/master/LICENSE.md)
169
-
170
- ## Legal
171
-
172
- This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by WA or any of its affiliates or subsidiaries. This is an independent and unofficial software. Use at your own risk.
173
-
174
- ## Cryptography Notice
175
-
176
- This distribution includes cryptographic software. The country in which you currently reside may have restrictions on the import, possession, use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check your country's laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted. See [http://www.wassenaar.org/](http://www.wassenaar.org/) for more information.
177
-
178
- The U.S. Government Department of Commerce, Bureau of Industry and Security (BIS), has classified this software as Export Commodity Control Number (ECCN) 5D002.C.1, which includes information security software using or performing cryptographic functions with asymmetric algorithms. The form and manner of this distribution makes it eligible for export under the License Exception ENC Technology Software Unrestricted (TSU) exception (see the BIS Export Administration Regulations, Section 740.13) for both object code and source code.
179
-
180
- [buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg
181
- [buymeacoffee]: https://www.buymeacoffee.com/smashah
182
- [consult-shield]: https://img.shields.io/badge/Require%20Paid%20Support%20or%20Consulting%3F-Click%20Here-blue?style=for-the-badge&logo=paypal
183
- [consult]: mailto:shah@openwa.dev?subject=WhatsApp%20Consulting
32
+ [H-DNH V1.0](https://github.com/open-wa/wa-automate-nodejs/blob/main/LICENSE.md) — Hippocratic + Do Not Harm