@wppconnect/wa-js 4.1.3-alpha.0 → 4.3.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.
- package/CHANGELOG.md +2 -2
- package/CLAUDE.md +124 -0
- package/README.md +246 -0
- package/dist/index.d.ts +1 -0
- package/dist/lists/functions/addChats.d.ts +27 -0
- package/dist/lists/functions/create.d.ts +29 -0
- package/dist/lists/functions/index.d.ts +21 -0
- package/dist/lists/functions/list.d.ts +34 -0
- package/dist/{whatsapp/functions/getErrorCodeFromLogoutReason.d.ts → lists/functions/remove.d.ts} +10 -4
- package/dist/lists/functions/removeChats.d.ts +27 -0
- package/dist/lists/functions/rename.d.ts +26 -0
- package/dist/lists/index.d.ts +16 -0
- package/dist/whatsapp/collections/ButtonCollection.d.ts +3 -1
- package/dist/whatsapp/enums/LogoutReason.d.ts +16 -2
- package/dist/whatsapp/functions/callGetSearchContext.d.ts +19 -0
- package/dist/whatsapp/functions/getSearchContext.d.ts +11 -0
- package/dist/whatsapp/functions/index.d.ts +1 -1
- package/dist/whatsapp/functions/logoutReason.d.ts +24 -0
- package/dist/whatsapp/functions/subscribePresence.d.ts +14 -0
- package/dist/whatsapp/models/CallModel.d.ts +4 -2
- package/dist/whatsapp/models/LabelModel.d.ts +2 -0
- package/dist/wppconnect-wa.js +1 -1
- package/dist/wppconnect-wa.js.LICENSE.txt +3 -3
- package/package.json +22 -21
- package/tests/smoke.spec.ts +171 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
##
|
|
1
|
+
## 4.3.0 (2026-05-19)
|
|
2
2
|
|
|
3
|
-
*
|
|
3
|
+
* build(deps-dev): update dependency @wppconnect/wa-version to ^1.5.3967 (#3459) ([399fa1478d6037c83ef4f6baadeea49e7944f1c8](https://github.com/wppconnect-team/wa-js/commit/399fa1478d6037c83ef4f6baadeea49e7944f1c8)), closes [#3459](https://github.com/wppconnect-team/wa-js/issues/3459)
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
WA-JS (`@wppconnect/wa-js`) is a browser injection library that extracts and wraps WhatsApp Web's internal functions, exposing them as a stable public API (`window.WPP`). It is bundled as a UMD library and injected into the WhatsApp Web page at runtime.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Build
|
|
13
|
+
npm run build:prd # Production build (minified) → dist/wppconnect-wa.js
|
|
14
|
+
npm run build:dev # Development build (inline source maps)
|
|
15
|
+
npm run build:watch # Watch mode
|
|
16
|
+
|
|
17
|
+
# Lint
|
|
18
|
+
npm run lint # ESLint + Prettier check
|
|
19
|
+
|
|
20
|
+
# Docs
|
|
21
|
+
npm run docs:build # Generate TypeDoc API docs
|
|
22
|
+
|
|
23
|
+
# Local development
|
|
24
|
+
npm run build:dev && WA_VERSION=latest npm run launch:local
|
|
25
|
+
npm run build:dev && WA_VERSION=<version> npm run launch:local
|
|
26
|
+
# Available versions listed in node_modules/@wppconnect/wa-version/html/
|
|
27
|
+
|
|
28
|
+
# WA source — download bundles (alpha included)
|
|
29
|
+
npm run wa-source:populate # latest 20 versions (default)
|
|
30
|
+
npm run wa-source:populate -- --all # all versions
|
|
31
|
+
npm run wa-source:populate -- --version <version> # single version
|
|
32
|
+
npm run wa-source:populate -- --force # re-download existing
|
|
33
|
+
|
|
34
|
+
# WA source — format before debugging internals (see Debugging section)
|
|
35
|
+
npm run wa-source:format <version>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Available versions (alpha included) are listed in `node_modules/@wppconnect/wa-version/html/`.
|
|
39
|
+
|
|
40
|
+
## Architecture
|
|
41
|
+
|
|
42
|
+
### Loader System
|
|
43
|
+
|
|
44
|
+
The most critical piece. `src/loader/` detects which WhatsApp module system is active and exposes WhatsApp's internal modules to the rest of WA-JS:
|
|
45
|
+
|
|
46
|
+
- **Meta loader** (WA >= 2.3000.0): Uses `global.require()` with `ErrorGuard.skipGuardGlobal()`
|
|
47
|
+
- **Webpack loader** (legacy): Intercepts webpack chunk callbacks at startup
|
|
48
|
+
|
|
49
|
+
All `src/whatsapp/` imports resolve through this loader system at runtime.
|
|
50
|
+
|
|
51
|
+
### Module Layout
|
|
52
|
+
|
|
53
|
+
`src/index.ts` is the entry point and re-exports all feature modules. Each feature module (e.g. `src/chat/`, `src/group/`) follows this internal pattern:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
<feature>/
|
|
57
|
+
├── index.ts # Re-exports functions and registers patches/events
|
|
58
|
+
├── types.ts # TypeScript types for the feature
|
|
59
|
+
├── patch.ts # Monkey-patches WhatsApp internals (if needed)
|
|
60
|
+
├── functions/ # One file per exported function
|
|
61
|
+
└── events/ # Event registration and re-emission
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### `src/whatsapp/`
|
|
65
|
+
|
|
66
|
+
Low-level bindings to WhatsApp Web's internals, organized by type:
|
|
67
|
+
- `models/` — WhatsApp data model classes (Chat, Message, Contact, etc.)
|
|
68
|
+
- `collections/` — Backbone-style collections of models
|
|
69
|
+
- `stores/` — Singleton global collection instances
|
|
70
|
+
- `functions/` — Raw WhatsApp functions extracted from the bundle
|
|
71
|
+
- `enums/` — WhatsApp enumerations
|
|
72
|
+
- `multidevice/` — Multi-device protocol
|
|
73
|
+
- `websocket/` — WebSocket layer
|
|
74
|
+
|
|
75
|
+
These are **not part of the public API**. Feature modules in `src/<feature>/` wrap them.
|
|
76
|
+
|
|
77
|
+
### Build Output
|
|
78
|
+
|
|
79
|
+
Webpack bundles everything into a single UMD file (`dist/wppconnect-wa.js`) exposing the global `WPP`. The `src/tools/` directory contains development utilities (not included in the bundle).
|
|
80
|
+
|
|
81
|
+
## Debugging WhatsApp Internals
|
|
82
|
+
|
|
83
|
+
When a WA-JS function breaks after a WhatsApp Web update, the root cause is almost always one of:
|
|
84
|
+
|
|
85
|
+
- A function was **moved to a different internal module**
|
|
86
|
+
- A function was **renamed**
|
|
87
|
+
- Arguments changed from **positional to named params** (or vice versa)
|
|
88
|
+
|
|
89
|
+
### Workflow
|
|
90
|
+
|
|
91
|
+
**Before inspecting any WhatsApp source**, the bundles must be downloaded and formatted:
|
|
92
|
+
|
|
93
|
+
1. Download bundles for the target version (if not already done). The default run fetches the latest 20 versions; for an older one pass `--version`:
|
|
94
|
+
```bash
|
|
95
|
+
npm run wa-source:populate # latest 20 (usually sufficient)
|
|
96
|
+
npm run wa-source:populate -- --version <version> # specific older version
|
|
97
|
+
```
|
|
98
|
+
2. Format so identifiers and structure are readable:
|
|
99
|
+
```bash
|
|
100
|
+
npm run wa-source:format <version>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
> **Fresh debug session:** If you haven't worked on this WA version before, confirm with the user that they have run both commands above for that version before proceeding. Do not attempt to read `wa-source/<version>/` without the formatted source in place.
|
|
104
|
+
|
|
105
|
+
Once formatted, search the WA source for the function or module in question, compare old vs. new signatures, and update the corresponding binding in `src/whatsapp/`.
|
|
106
|
+
|
|
107
|
+
## Version Compatibility
|
|
108
|
+
|
|
109
|
+
Fixes must support both the new WhatsApp Web version and older versions still listed in `node_modules/@wppconnect/wa-version/html/`.
|
|
110
|
+
|
|
111
|
+
If a workaround is only needed for older versions, mark it with a TODO so it gets cleaned up once those versions are no longer available:
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
// TODO: remove when <version> is no longer available in wa-version/html
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Code Conventions
|
|
118
|
+
|
|
119
|
+
- Node version: 24 (see `.nvmrc`)
|
|
120
|
+
- TypeScript strict mode enabled; decorators enabled
|
|
121
|
+
- ESLint enforces import ordering (`simple-import-sort`) and file headers
|
|
122
|
+
- Prettier: single quotes, trailing commas (ES5)
|
|
123
|
+
- Commit messages follow Conventional Commits (enforced by commitlint)
|
|
124
|
+
- Pre-commit: lint-staged runs ESLint on staged files
|
package/README.md
CHANGED
|
@@ -132,6 +132,225 @@ For the most up-to-date list of available functions, launch the project locally
|
|
|
132
132
|
|
|
133
133
|
`Object.keys(WPP.group).sort()`
|
|
134
134
|
|
|
135
|
+
### Newsletter (Channels) Functions
|
|
136
|
+
|
|
137
|
+
`WPP.newsletter.create` - Create a new newsletter (WhatsApp Channel)
|
|
138
|
+
|
|
139
|
+
`WPP.newsletter.edit` - Edit an existing newsletter (name, description, picture)
|
|
140
|
+
|
|
141
|
+
`WPP.newsletter.destroy` - Delete a newsletter you own
|
|
142
|
+
|
|
143
|
+
`WPP.newsletter.follow` / `WPP.newsletter.unfollow` - Follow or unfollow a newsletter
|
|
144
|
+
|
|
145
|
+
`WPP.newsletter.mute` - Mute notifications from a newsletter
|
|
146
|
+
|
|
147
|
+
`WPP.newsletter.search` - Search newsletters by name or country
|
|
148
|
+
|
|
149
|
+
`WPP.newsletter.getSubscribers` - Get the subscriber list of a newsletter you own
|
|
150
|
+
|
|
151
|
+
For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
|
|
152
|
+
|
|
153
|
+
`Object.keys(WPP.newsletter).sort()`
|
|
154
|
+
|
|
155
|
+
### Community Functions
|
|
156
|
+
|
|
157
|
+
`WPP.community.create` - Create a new community
|
|
158
|
+
|
|
159
|
+
`WPP.community.deactivate` - Deactivate (delete) a community
|
|
160
|
+
|
|
161
|
+
`WPP.community.addSubgroups` - Add existing groups as subgroups of a community
|
|
162
|
+
|
|
163
|
+
`WPP.community.removeSubgroups` - Remove subgroups from a community
|
|
164
|
+
|
|
165
|
+
`WPP.community.getSubgroups` - Get all subgroups of a community
|
|
166
|
+
|
|
167
|
+
`WPP.community.getParticipants` - Get all participants across the community
|
|
168
|
+
|
|
169
|
+
`WPP.community.getAnnouncementGroup` - Get the announcement group of a community
|
|
170
|
+
|
|
171
|
+
`WPP.community.promoteParticipants` / `WPP.community.demoteParticipants` - Promote or demote community admins
|
|
172
|
+
|
|
173
|
+
For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
|
|
174
|
+
|
|
175
|
+
`Object.keys(WPP.community).sort()`
|
|
176
|
+
|
|
177
|
+
### Catalog Functions
|
|
178
|
+
|
|
179
|
+
`WPP.catalog.getMyCatalog` - Get the catalog of the connected business account
|
|
180
|
+
|
|
181
|
+
`WPP.catalog.getProducts` - Get products of any business contact
|
|
182
|
+
|
|
183
|
+
`WPP.catalog.getProductById` - Get a single product by id
|
|
184
|
+
|
|
185
|
+
`WPP.catalog.createProduct` - Create a new product in your catalog
|
|
186
|
+
|
|
187
|
+
`WPP.catalog.editProduct` - Edit an existing product
|
|
188
|
+
|
|
189
|
+
`WPP.catalog.delProducts` - Delete one or more products
|
|
190
|
+
|
|
191
|
+
`WPP.catalog.addProductImage` / `WPP.catalog.changeProductImage` / `WPP.catalog.removeProductImage` - Manage product images
|
|
192
|
+
|
|
193
|
+
`WPP.catalog.setProductVisibility` - Show or hide a product
|
|
194
|
+
|
|
195
|
+
`WPP.catalog.createCollection` / `WPP.catalog.editCollection` / `WPP.catalog.deleteCollection` / `WPP.catalog.getCollections` - Manage product collections
|
|
196
|
+
|
|
197
|
+
`WPP.catalog.updateCartEnabled` - Enable or disable cart for the catalog
|
|
198
|
+
|
|
199
|
+
For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
|
|
200
|
+
|
|
201
|
+
`Object.keys(WPP.catalog).sort()`
|
|
202
|
+
|
|
203
|
+
### Cart Functions
|
|
204
|
+
|
|
205
|
+
`WPP.cart.add` - Add a product to the cart of a business chat
|
|
206
|
+
|
|
207
|
+
`WPP.cart.update` - Update the quantity of an item in the cart
|
|
208
|
+
|
|
209
|
+
`WPP.cart.remove` - Remove an item from the cart
|
|
210
|
+
|
|
211
|
+
`WPP.cart.get` - Get the current cart for a business chat
|
|
212
|
+
|
|
213
|
+
`WPP.cart.clear` - Empty the cart
|
|
214
|
+
|
|
215
|
+
`WPP.cart.submit` - Submit the cart and send the order
|
|
216
|
+
|
|
217
|
+
`WPP.cart.getThumbFromCart` - Get the cart thumbnail preview
|
|
218
|
+
|
|
219
|
+
For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
|
|
220
|
+
|
|
221
|
+
`Object.keys(WPP.cart).sort()`
|
|
222
|
+
|
|
223
|
+
### Order Functions
|
|
224
|
+
|
|
225
|
+
`WPP.order.get` - Get the details of an order received in a chat
|
|
226
|
+
|
|
227
|
+
`WPP.order.accept` - Accept an order
|
|
228
|
+
|
|
229
|
+
`WPP.order.decline` - Decline an order
|
|
230
|
+
|
|
231
|
+
`WPP.order.update` - Update an order (e.g. change status)
|
|
232
|
+
|
|
233
|
+
For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
|
|
234
|
+
|
|
235
|
+
`Object.keys(WPP.order).sort()`
|
|
236
|
+
|
|
237
|
+
### Status Functions
|
|
238
|
+
|
|
239
|
+
`WPP.status.sendTextStatus` - Post a text status
|
|
240
|
+
|
|
241
|
+
`WPP.status.sendImageStatus` - Post an image status
|
|
242
|
+
|
|
243
|
+
`WPP.status.sendVideoStatus` - Post a video status
|
|
244
|
+
|
|
245
|
+
`WPP.status.sendReadStatus` - Mark a status as seen
|
|
246
|
+
|
|
247
|
+
`WPP.status.get` - Get the status feed of a contact
|
|
248
|
+
|
|
249
|
+
`WPP.status.getMyStatus` - Get your own status feed
|
|
250
|
+
|
|
251
|
+
`WPP.status.remove` - Remove one of your statuses
|
|
252
|
+
|
|
253
|
+
`WPP.status.updateParticipants` - Update who can see your statuses
|
|
254
|
+
|
|
255
|
+
For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
|
|
256
|
+
|
|
257
|
+
`Object.keys(WPP.status).sort()`
|
|
258
|
+
|
|
259
|
+
### Labels Functions
|
|
260
|
+
|
|
261
|
+
`WPP.labels.getAllLabels` - Get every label defined in the account
|
|
262
|
+
|
|
263
|
+
`WPP.labels.getLabelById` - Get a label by id
|
|
264
|
+
|
|
265
|
+
`WPP.labels.addNewLabel` - Create a new label
|
|
266
|
+
|
|
267
|
+
`WPP.labels.editLabel` - Rename or recolor a label
|
|
268
|
+
|
|
269
|
+
`WPP.labels.deleteLabel` - Delete a single label
|
|
270
|
+
|
|
271
|
+
`WPP.labels.deleteAllLabels` - Delete every label in the account
|
|
272
|
+
|
|
273
|
+
`WPP.labels.addOrRemoveLabels` - Apply or remove labels on chats / messages in bulk
|
|
274
|
+
|
|
275
|
+
`WPP.labels.getLabelColorPalette` / `WPP.labels.getNewLabelColor` - Helpers for label colors
|
|
276
|
+
|
|
277
|
+
For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
|
|
278
|
+
|
|
279
|
+
`Object.keys(WPP.labels).sort()`
|
|
280
|
+
|
|
281
|
+
### Profile Functions
|
|
282
|
+
|
|
283
|
+
`WPP.profile.getMyProfileName` / `WPP.profile.setMyProfileName` - Read or change your profile name
|
|
284
|
+
|
|
285
|
+
`WPP.profile.getMyStatus` / `WPP.profile.setMyStatus` - Read or change your "about" text
|
|
286
|
+
|
|
287
|
+
`WPP.profile.getMyProfilePicture` - Get your current profile picture
|
|
288
|
+
|
|
289
|
+
`WPP.profile.setMyProfilePicture` / `WPP.profile.removeMyProfilePicture` - Set or remove your profile picture
|
|
290
|
+
|
|
291
|
+
`WPP.profile.isBusiness` - Check whether the connected account is a Business account
|
|
292
|
+
|
|
293
|
+
`WPP.profile.editBusinessProfile` - Edit business profile fields (description, address, etc.)
|
|
294
|
+
|
|
295
|
+
For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
|
|
296
|
+
|
|
297
|
+
`Object.keys(WPP.profile).sort()`
|
|
298
|
+
|
|
299
|
+
### Privacy Functions
|
|
300
|
+
|
|
301
|
+
`WPP.privacy.get` - Get the current privacy settings as an object
|
|
302
|
+
|
|
303
|
+
`WPP.privacy.setLastSeen` - Configure who can see your "last seen"
|
|
304
|
+
|
|
305
|
+
`WPP.privacy.setOnline` - Configure who can see when you are online
|
|
306
|
+
|
|
307
|
+
`WPP.privacy.setProfilePic` - Configure who can see your profile picture
|
|
308
|
+
|
|
309
|
+
`WPP.privacy.setReadReceipts` - Enable or disable read receipts
|
|
310
|
+
|
|
311
|
+
`WPP.privacy.setStatus` - Configure who can see your status updates
|
|
312
|
+
|
|
313
|
+
`WPP.privacy.setAbout` - Configure who can see your "about" text
|
|
314
|
+
|
|
315
|
+
`WPP.privacy.setAddGroup` - Configure who can add you to groups
|
|
316
|
+
|
|
317
|
+
`WPP.privacy.getDisallowedList` - Get the disallowed list (used together with `setAddGroup` / `setStatus` when set to `contact_blacklist`)
|
|
318
|
+
|
|
319
|
+
For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
|
|
320
|
+
|
|
321
|
+
`Object.keys(WPP.privacy).sort()`
|
|
322
|
+
|
|
323
|
+
### Labels vs Lists
|
|
324
|
+
|
|
325
|
+
WhatsApp has two separate chat-organization features that share the same internal infrastructure but serve different purposes:
|
|
326
|
+
|
|
327
|
+
| | `WPP.labels` | `WPP.lists` |
|
|
328
|
+
|---|---|---|
|
|
329
|
+
| **Account** | Business only | Personal + Business |
|
|
330
|
+
| **Purpose** | Tag chats for CRM workflows (e.g. "New lead", "Pending") | Group chats into named tabs (e.g. "Family", "Work") |
|
|
331
|
+
| **Visible as** | Colored label chips on chats | Tabs at the top of the chat list |
|
|
332
|
+
| **API guard** | `assertIsBusiness()` — throws on personal accounts | No business check |
|
|
333
|
+
|
|
334
|
+
Use `WPP.labels` for business label management. Use `WPP.lists` to create and manage chat grouping lists on any account type.
|
|
335
|
+
|
|
336
|
+
#### Lists Functions
|
|
337
|
+
|
|
338
|
+
`WPP.lists.create` - Create a new list
|
|
339
|
+
|
|
340
|
+
`WPP.lists.list` - Get all custom lists
|
|
341
|
+
|
|
342
|
+
`WPP.lists.addChats` - Add chats to a list
|
|
343
|
+
|
|
344
|
+
`WPP.lists.removeChats` - Remove chats from a list
|
|
345
|
+
|
|
346
|
+
`WPP.lists.rename` - Rename a list
|
|
347
|
+
|
|
348
|
+
`WPP.lists.remove` - Delete a list
|
|
349
|
+
|
|
350
|
+
For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
|
|
351
|
+
|
|
352
|
+
`Object.keys(WPP.lists).sort()`
|
|
353
|
+
|
|
135
354
|
### Events
|
|
136
355
|
|
|
137
356
|
#### Connection Events
|
|
@@ -215,6 +434,33 @@ To debug or inspect `wa-source` folder, format the files to be easier to underst
|
|
|
215
434
|
npm run wa-source:format
|
|
216
435
|
```
|
|
217
436
|
|
|
437
|
+
### Testing
|
|
438
|
+
|
|
439
|
+
The project ships a Playwright suite under `tests/`. Two flavours are available:
|
|
440
|
+
|
|
441
|
+
```bash
|
|
442
|
+
# Smoke tests — no QR scan needed.
|
|
443
|
+
# Loads the live wppconnect-wa.js bundle on web.whatsapp.com and verifies
|
|
444
|
+
# every public WPP module still exposes the functions documented above.
|
|
445
|
+
# Useful as an early-warning when WhatsApp Web ships an update that breaks
|
|
446
|
+
# our patches.
|
|
447
|
+
npm test -- tests/smoke.spec.ts
|
|
448
|
+
|
|
449
|
+
# Full test project (smoke + any other *.spec.ts)
|
|
450
|
+
npm test
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
Tests that need an authenticated session use the `loggedPage` fixture from
|
|
454
|
+
`tests/wpp-test.ts`. To bootstrap that session once (this opens a real
|
|
455
|
+
browser so you can scan the QR), run:
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
npm run test:prepare
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
The session is cached under your OS temp dir (`wa-js-test-<browser>`) and
|
|
462
|
+
reused by subsequent runs.
|
|
463
|
+
|
|
218
464
|
### Comparing WhatsApp Web Versions
|
|
219
465
|
|
|
220
466
|
To compare changes between two WhatsApp Web versions, use the helper script:
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { isFullReady, isInjected, isReady } from './loader';
|
|
|
21
21
|
export { loader };
|
|
22
22
|
export { config, Config } from './config';
|
|
23
23
|
export * as blocklist from './blocklist';
|
|
24
|
+
export * as lists from './lists';
|
|
24
25
|
export * as call from './call';
|
|
25
26
|
export * as cart from './cart';
|
|
26
27
|
export * as catalog from './catalog';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2026 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Wid } from '../../whatsapp';
|
|
17
|
+
/**
|
|
18
|
+
* Add chats to an existing list
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```javascript
|
|
22
|
+
* await WPP.lists.addChats('42', ['number@c.us', 'number2@c.us']);
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @category Lists
|
|
26
|
+
*/
|
|
27
|
+
export declare function addChats(listId: string, chatIds: (string | Wid)[]): Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2026 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Wid } from '../../whatsapp';
|
|
17
|
+
/**
|
|
18
|
+
* Create a new list and optionally add chats to it.
|
|
19
|
+
* Works for both personal and business accounts.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```javascript
|
|
23
|
+
* const id = await WPP.lists.create('Family', ['number@c.us', 'number2@c.us']);
|
|
24
|
+
* console.log(id); // '42'
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @category Lists
|
|
28
|
+
*/
|
|
29
|
+
export declare function create(name: string, chatIds?: (string | Wid)[], colorIndex?: number): Promise<string>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2026 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { addChats } from './addChats';
|
|
17
|
+
export { create } from './create';
|
|
18
|
+
export { list, ListInfo } from './list';
|
|
19
|
+
export { remove } from './remove';
|
|
20
|
+
export { removeChats } from './removeChats';
|
|
21
|
+
export { rename } from './rename';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2026 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export interface ListInfo {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
colorIndex: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Return all custom lists (personal account lists)
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```javascript
|
|
26
|
+
* const lists = WPP.lists.list();
|
|
27
|
+
* for (const l of lists) {
|
|
28
|
+
* console.log(l.id, l.name);
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @category Lists
|
|
33
|
+
*/
|
|
34
|
+
export declare function list(): ListInfo[];
|
package/dist/{whatsapp/functions/getErrorCodeFromLogoutReason.d.ts → lists/functions/remove.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2026 WPPConnect Team
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -13,8 +13,14 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { LOGOUT_REASON_CODE, LogoutReason } from '../enums';
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
17
|
+
* Delete a list by ID
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```javascript
|
|
21
|
+
* await WPP.lists.remove('42');
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @category Lists
|
|
19
25
|
*/
|
|
20
|
-
export declare function
|
|
26
|
+
export declare function remove(listId: string): Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2026 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Wid } from '../../whatsapp';
|
|
17
|
+
/**
|
|
18
|
+
* Remove chats from a list
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```javascript
|
|
22
|
+
* await WPP.lists.removeChats('42', ['number@c.us']);
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @category Lists
|
|
26
|
+
*/
|
|
27
|
+
export declare function removeChats(listId: string, chatIds: (string | Wid)[]): Promise<void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2026 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Rename a list
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```javascript
|
|
21
|
+
* await WPP.lists.rename('42', 'New Name');
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @category Lists
|
|
25
|
+
*/
|
|
26
|
+
export declare function rename(listId: string, newName: string): Promise<void>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2026 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export * from './functions';
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { ReplyButtonModel } from '../models';
|
|
17
17
|
import { BaseCollection } from './BaseCollection';
|
|
18
|
-
/** @whatsapp 47688
|
|
18
|
+
/** @whatsapp 47688
|
|
19
|
+
* @whatsapp WAWebButtonCollection >= 2.3000.1039447205
|
|
20
|
+
*/
|
|
19
21
|
export declare class ButtonCollection extends BaseCollection<ReplyButtonModel> {
|
|
20
22
|
static model: ReplyButtonModel;
|
|
21
23
|
static comparator(): any;
|
|
@@ -31,13 +31,27 @@ export declare enum LogoutReason {
|
|
|
31
31
|
ClientVersionOutdated = "client_version_outdated",
|
|
32
32
|
SyncdErrorDuringBootstrap = "syncd_error_during_bootstrap",
|
|
33
33
|
AccountSyncError = "account_sync_error",
|
|
34
|
-
ClientFatalError = "client_fatal_error",
|
|
35
34
|
StorageQuotaExceeded = "storage_quota_exceeded",
|
|
36
35
|
PrimaryIdentityKeyChange = "primary_identity_key_change",
|
|
37
36
|
MissingEncSalt = "missing_enc_salt",
|
|
38
37
|
MissingScreenLockSalt = "missing_screen_lock_salt",
|
|
39
38
|
AccountLocked = "account_locked",
|
|
40
|
-
|
|
39
|
+
LidMigrationSplitThreadMismatch = "lid_migration_split_thread_mismatch",
|
|
40
|
+
LidMigrationNoLidAvailiable = "lid_migration_no_lid_available",
|
|
41
|
+
LidMigrationPrimaryMappingsObsolete = "lid_migration_primary_mappings_obsolete",
|
|
42
|
+
LidMigrationPeerMappingsNotReceived = "lid_migration_peer_mapping_not_received",
|
|
43
|
+
LidMigrationStateDiscrepancy = "lid_migration_state_discrepancy",
|
|
44
|
+
LidMigrationPeerMappingsMalformed = "lid_migration_peer_mapping_malformed",
|
|
45
|
+
LidMigrationFailedToParseMapping = "lid_migration_failed_to_parse_mapping",
|
|
46
|
+
LidMigrationCompanionIncompatibleKillswitch = "lid_migration_companion_incompatible_killswitch",
|
|
47
|
+
LidMigrationOneOnOneThreadMigrationInternalError = "lid_migration_one_on_one_thread_migration_internal_error",
|
|
48
|
+
LidBlocklistPnWhenMigrated = "lid_blocklist_pn_when_migrated",
|
|
49
|
+
LidBlocklistChatDbUnmigrated = "lid_blocklist_chat_db_unmigrated",
|
|
50
|
+
WebFailAddChat = "web_fail_add_chat",
|
|
51
|
+
WebFailOfflineResume = "web_fail_offline_resume",
|
|
52
|
+
WebFailStorageInitialization = "web_fail_storage_initialization",
|
|
53
|
+
WebFailEncSalt = "web_fail_enc_salt",
|
|
54
|
+
CacheStorageOpenFailed = "cache_storage_open_failed"
|
|
41
55
|
}
|
|
42
56
|
export declare enum LOGOUT_REASON_CODE {
|
|
43
57
|
CLIENT_FATAL = "0",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { MsgKey } from '../misc';
|
|
17
|
+
import { ChatModel, MsgModel } from '../models';
|
|
18
|
+
import { getSearchContext } from './getSearchContext';
|
|
19
|
+
export declare function callGetSearchContext(chat: ChatModel | string, msgKey: MsgModel | MsgKey | string): ReturnType<typeof getSearchContext>;
|