@wppconnect-team/wppconnect 2.1.0 → 2.2.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 CHANGED
@@ -1,3 +1,9 @@
1
+ # 2.2.0 (2026-05-19)
2
+
3
+ ### Features
4
+
5
+ - add ListsLayer for personal account chat grouping (WPP.lists) ([#2780](https://github.com/wppconnect-team/wppconnect/issues/2780)) ([dca5aa0](https://github.com/wppconnect-team/wppconnect/commit/dca5aa0c0dc6201b083a344c3c64a295eea77973))
6
+
1
7
  # 2.1.0 (2026-05-15)
2
8
 
3
9
  ### Features
@@ -1,7 +1,7 @@
1
1
  import { Page } from 'puppeteer';
2
2
  import { CreateConfig } from '../../config/create-config';
3
- import { CatalogLayer } from './catalog.layer';
4
- export declare class LabelsLayer extends CatalogLayer {
3
+ import { ListsLayer } from './lists.layer';
4
+ export declare class LabelsLayer extends ListsLayer {
5
5
  page: Page;
6
6
  constructor(page: Page, session?: string, options?: CreateConfig);
7
7
  /**
@@ -18,8 +18,8 @@
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.LabelsLayer = void 0;
20
20
  const helpers_1 = require("../helpers");
21
- const catalog_layer_1 = require("./catalog.layer");
22
- class LabelsLayer extends catalog_layer_1.CatalogLayer {
21
+ const lists_layer_1 = require("./lists.layer");
22
+ class LabelsLayer extends lists_layer_1.ListsLayer {
23
23
  page;
24
24
  constructor(page, session, options) {
25
25
  super(page, session, options);
@@ -0,0 +1,79 @@
1
+ import { Page } from 'puppeteer';
2
+ import { CreateConfig } from '../../config/create-config';
3
+ import { CatalogLayer } from './catalog.layer';
4
+ export declare class ListsLayer extends CatalogLayer {
5
+ page: Page;
6
+ constructor(page: Page, session?: string, options?: CreateConfig);
7
+ /**
8
+ * Create a new list and optionally add chats to it.
9
+ * Works for both personal and business accounts.
10
+ * @category Lists
11
+ *
12
+ * @example
13
+ * ```javascript
14
+ * const id = await client.createList('Family', ['number@c.us', 'number2@c.us']);
15
+ * console.log(id); // '42'
16
+ * ```
17
+ * @param name List name
18
+ * @param chatIds Chat IDs to add to the list
19
+ * @param colorIndex Optional color index
20
+ */
21
+ createList(name: string, chatIds?: string[], colorIndex?: number): Promise<string>;
22
+ /**
23
+ * Return all custom lists
24
+ * @category Lists
25
+ *
26
+ * @example
27
+ * ```javascript
28
+ * const lists = await client.getAllLists();
29
+ * ```
30
+ */
31
+ getAllLists(): Promise<import("@wppconnect/wa-js/dist/lists").ListInfo[]>;
32
+ /**
33
+ * Add chats to an existing list
34
+ * @category Lists
35
+ *
36
+ * @example
37
+ * ```javascript
38
+ * await client.addChatsToList('42', ['number@c.us', 'number2@c.us']);
39
+ * ```
40
+ * @param listId List ID
41
+ * @param chatIds Chat IDs to add
42
+ */
43
+ addChatsToList(listId: string, chatIds: string[]): Promise<void>;
44
+ /**
45
+ * Remove chats from a list
46
+ * @category Lists
47
+ *
48
+ * @example
49
+ * ```javascript
50
+ * await client.removeChatsFromList('42', ['number@c.us']);
51
+ * ```
52
+ * @param listId List ID
53
+ * @param chatIds Chat IDs to remove
54
+ */
55
+ removeChatsFromList(listId: string, chatIds: string[]): Promise<void>;
56
+ /**
57
+ * Rename a list
58
+ * @category Lists
59
+ *
60
+ * @example
61
+ * ```javascript
62
+ * await client.renameList('42', 'Close Friends');
63
+ * ```
64
+ * @param listId List ID
65
+ * @param newName New name
66
+ */
67
+ renameList(listId: string, newName: string): Promise<void>;
68
+ /**
69
+ * Delete a list
70
+ * @category Lists
71
+ *
72
+ * @example
73
+ * ```javascript
74
+ * await client.deleteList('42');
75
+ * ```
76
+ * @param listId List ID
77
+ */
78
+ deleteList(listId: string): Promise<void>;
79
+ }
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ /*
3
+ * This file is part of WPPConnect.
4
+ *
5
+ * WPPConnect is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU Lesser General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * WPPConnect is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public License
16
+ * along with WPPConnect. If not, see <https://www.gnu.org/licenses/>.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.ListsLayer = void 0;
20
+ const helpers_1 = require("../helpers");
21
+ const catalog_layer_1 = require("./catalog.layer");
22
+ class ListsLayer extends catalog_layer_1.CatalogLayer {
23
+ page;
24
+ constructor(page, session, options) {
25
+ super(page, session, options);
26
+ this.page = page;
27
+ }
28
+ /**
29
+ * Create a new list and optionally add chats to it.
30
+ * Works for both personal and business accounts.
31
+ * @category Lists
32
+ *
33
+ * @example
34
+ * ```javascript
35
+ * const id = await client.createList('Family', ['number@c.us', 'number2@c.us']);
36
+ * console.log(id); // '42'
37
+ * ```
38
+ * @param name List name
39
+ * @param chatIds Chat IDs to add to the list
40
+ * @param colorIndex Optional color index
41
+ */
42
+ async createList(name, chatIds = [], colorIndex) {
43
+ return await (0, helpers_1.evaluateAndReturn)(this.page, ({ name, chatIds, colorIndex }) => WPP.lists.create(name, chatIds, colorIndex), { name, chatIds, colorIndex });
44
+ }
45
+ /**
46
+ * Return all custom lists
47
+ * @category Lists
48
+ *
49
+ * @example
50
+ * ```javascript
51
+ * const lists = await client.getAllLists();
52
+ * ```
53
+ */
54
+ async getAllLists() {
55
+ return await (0, helpers_1.evaluateAndReturn)(this.page, () => WPP.lists.list());
56
+ }
57
+ /**
58
+ * Add chats to an existing list
59
+ * @category Lists
60
+ *
61
+ * @example
62
+ * ```javascript
63
+ * await client.addChatsToList('42', ['number@c.us', 'number2@c.us']);
64
+ * ```
65
+ * @param listId List ID
66
+ * @param chatIds Chat IDs to add
67
+ */
68
+ async addChatsToList(listId, chatIds) {
69
+ return await (0, helpers_1.evaluateAndReturn)(this.page, ({ listId, chatIds }) => WPP.lists.addChats(listId, chatIds), { listId, chatIds });
70
+ }
71
+ /**
72
+ * Remove chats from a list
73
+ * @category Lists
74
+ *
75
+ * @example
76
+ * ```javascript
77
+ * await client.removeChatsFromList('42', ['number@c.us']);
78
+ * ```
79
+ * @param listId List ID
80
+ * @param chatIds Chat IDs to remove
81
+ */
82
+ async removeChatsFromList(listId, chatIds) {
83
+ return await (0, helpers_1.evaluateAndReturn)(this.page, ({ listId, chatIds }) => WPP.lists.removeChats(listId, chatIds), { listId, chatIds });
84
+ }
85
+ /**
86
+ * Rename a list
87
+ * @category Lists
88
+ *
89
+ * @example
90
+ * ```javascript
91
+ * await client.renameList('42', 'Close Friends');
92
+ * ```
93
+ * @param listId List ID
94
+ * @param newName New name
95
+ */
96
+ async renameList(listId, newName) {
97
+ return await (0, helpers_1.evaluateAndReturn)(this.page, ({ listId, newName }) => WPP.lists.rename(listId, newName), { listId, newName });
98
+ }
99
+ /**
100
+ * Delete a list
101
+ * @category Lists
102
+ *
103
+ * @example
104
+ * ```javascript
105
+ * await client.deleteList('42');
106
+ * ```
107
+ * @param listId List ID
108
+ */
109
+ async deleteList(listId) {
110
+ return await (0, helpers_1.evaluateAndReturn)(this.page, ({ listId }) => WPP.lists.remove(listId), { listId });
111
+ }
112
+ }
113
+ exports.ListsLayer = ListsLayer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wppconnect-team/wppconnect",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "WPPConnect is an open source project developed by the JavaScript community with the aim of exporting functions from WhatsApp Web to the node, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination... 😀🤔💭",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -63,6 +63,7 @@
63
63
  "@commitlint/config-conventional": "^20.5.3",
64
64
  "@commitlint/cz-commitlint": "^20.5.3",
65
65
  "@eslint/js": "^10.0.1",
66
+ "@tony.ganchev/eslint-plugin-header": "^3.4.4",
66
67
  "@types/atob": "^2.1.4",
67
68
  "@types/mime-types": "^3.0.1",
68
69
  "@types/mocha": "^10.0.10",
@@ -74,9 +75,8 @@
74
75
  "commitizen": "^4.3.1",
75
76
  "concurrently": "^9.2.1",
76
77
  "conventional-changelog-cli": "^5.0.0",
77
- "eslint": "10.3.0",
78
+ "eslint": "10.4.0",
78
79
  "eslint-config-prettier": "^10.1.8",
79
- "@tony.ganchev/eslint-plugin-header": "^3.4.4",
80
80
  "eslint-plugin-prettier": "^5.5.5",
81
81
  "globals": "^17.6.0",
82
82
  "husky": "^9.1.7",
@@ -94,7 +94,7 @@
94
94
  "webpack-cli": "^6.0.1"
95
95
  },
96
96
  "dependencies": {
97
- "@wppconnect/wa-js": "^4.2.0",
97
+ "@wppconnect/wa-js": "^4.3.0",
98
98
  "@wppconnect/wa-version": "^1.5.3941",
99
99
  "atob": "^2.1.2",
100
100
  "axios": "^1.16.1",
@@ -109,7 +109,7 @@
109
109
  "logform": "^2.7.0",
110
110
  "lookpath": "^1.2.3",
111
111
  "mime-types": "^3.0.2",
112
- "puppeteer": "^24.37.5",
112
+ "puppeteer": "^24.43.1",
113
113
  "puppeteer-extra": "^3.3.6",
114
114
  "puppeteer-extra-plugin-stealth": "^2.11.2",
115
115
  "puppeteer-extra-plugin-user-data-dir": "^2.4.1",
@@ -122,7 +122,7 @@
122
122
  "tmp": "^0.2.5",
123
123
  "tree-kill": "^1.2.2",
124
124
  "winston": "^3.19.0",
125
- "ws": "^8.19.0"
125
+ "ws": "^8.20.1"
126
126
  },
127
127
  "optionalDependencies": {
128
128
  "@img/sharp-win32-x64": "^0.34.5",