@wppconnect-team/wppconnect 2.3.6 → 2.4.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 +38 -0
- package/README.md +87 -69
- package/README.pt-BR.md +119 -0
- package/dist/api/layers/catalog.layer.d.ts +3 -3
- package/dist/api/layers/catalog.layer.js +2 -2
- package/dist/api/layers/group.layer.js +1 -1
- package/dist/api/layers/host.layer.d.ts +2 -1
- package/dist/api/layers/host.layer.js +17 -5
- package/dist/api/layers/labels.layer.d.ts +34 -12
- package/dist/api/layers/labels.layer.js +36 -18
- package/dist/api/layers/profile.layer.d.ts +1 -1
- package/dist/api/layers/profile.layer.js +1 -3
- package/dist/api/layers/sender.layer.d.ts +4 -6
- package/dist/api/layers/sender.layer.js +6 -7
- package/dist/api/layers/status.layer.d.ts +13 -4
- package/dist/api/layers/status.layer.js +10 -9
- package/dist/api/model/index.d.ts +1 -0
- package/dist/api/model/index.js +1 -0
- package/dist/api/model/label.d.ts +16 -0
- package/dist/config/create-config.d.ts +2 -0
- package/dist/controllers/browser.d.ts +3 -2
- package/dist/controllers/browser.js +60 -13
- package/dist/controllers/initializer.js +29 -17
- package/dist/lib/wapi/wapi.js +1 -1
- package/documentation/readme-reference.md +118 -0
- package/package.json +15 -15
- package/scripts/docs-redirects.mjs +70 -0
- package/scripts/typedoc-canonical.mjs +49 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
## 2.4.0 (2026-11-13)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- **browser:** poll readiness in hidden pages ([712e504](https://github.com/wppconnect-team/wppconnect/commit/712e504))
|
|
6
|
+
- **browser:** respect ownership during automatic cleanup ([c774248](https://github.com/wppconnect-team/wppconnect/commit/c774248))
|
|
7
|
+
- bump wa-js version to 4.8.0 (#2964) ([7e0dace](https://github.com/wppconnect-team/wppconnect/commit/7e0dace)), closes [#2964](https://github.com/wppconnect-team/wppconnect/issues/2964)
|
|
8
|
+
- **labels:** await promises, fix method signatures and export label models (#2951) ([94937ce](https://github.com/wppconnect-team/wppconnect/commit/94937ce)), closes [#2951](https://github.com/wppconnect-team/wppconnect/issues/2951)
|
|
9
|
+
- normalize forwarding input and run the complete test suite ([b28c1d6](https://github.com/wppconnect-team/wppconnect/commit/b28c1d6))
|
|
10
|
+
- **wapi:** remove unbounded new messages buffer ([9532a1a](https://github.com/wppconnect-team/wppconnect/commit/9532a1a))
|
|
11
|
+
- **wapi:** serialize existing message models without extra copies ([7992ab3](https://github.com/wppconnect-team/wppconnect/commit/7992ab3))
|
|
12
|
+
|
|
13
|
+
### Documentation
|
|
14
|
+
|
|
15
|
+
- adopt official WPPConnect branding and API favicon (#2946) ([4d8dda6](https://github.com/wppconnect-team/wppconnect/commit/4d8dda6)), closes [#2946](https://github.com/wppconnect-team/wppconnect/issues/2946)
|
|
16
|
+
- publish canonical SDK URLs and preserve renamed references (#2959) ([7ab758a](https://github.com/wppconnect-team/wppconnect/commit/7ab758a)), closes [#2959](https://github.com/wppconnect-team/wppconnect/issues/2959)
|
|
17
|
+
- refresh API reference visual design (#2950) ([fd0f11b](https://github.com/wppconnect-team/wppconnect/commit/fd0f11b)), closes [#2950](https://github.com/wppconnect-team/wppconnect/issues/2950)
|
|
18
|
+
- standardize bilingual READMEs and support guidance ([672e8cc](https://github.com/wppconnect-team/wppconnect/commit/672e8cc))
|
|
19
|
+
- update official WPPConnect logo and API favicon (#2949) ([17f73ca](https://github.com/wppconnect-team/wppconnect/commit/17f73ca)), closes [#2949](https://github.com/wppconnect-team/wppconnect/issues/2949)
|
|
20
|
+
|
|
21
|
+
### Build System
|
|
22
|
+
|
|
23
|
+
- **deps-dev:** bump fast-uri from 3.1.7 to 3.1.9 ([94f5b44](https://github.com/wppconnect-team/wppconnect/commit/94f5b44))
|
|
24
|
+
- **deps-dev:** update babel monorepo to ^7.29.13 (#2955) ([77c3fb2](https://github.com/wppconnect-team/wppconnect/commit/77c3fb2)), closes [#2955](https://github.com/wppconnect-team/wppconnect/issues/2955)
|
|
25
|
+
- **deps-dev:** update dependency concurrently to ^10.0.7 (#2957) ([a43806e](https://github.com/wppconnect-team/wppconnect/commit/a43806e)), closes [#2957](https://github.com/wppconnect-team/wppconnect/issues/2957)
|
|
26
|
+
- **deps-dev:** update dependency eslint to v10.14.0 (#2953) ([bfe7d57](https://github.com/wppconnect-team/wppconnect/commit/bfe7d57)), closes [#2953](https://github.com/wppconnect-team/wppconnect/issues/2953)
|
|
27
|
+
- **deps-dev:** update dependency globals to ^17.14.0 (#2954) ([1c34452](https://github.com/wppconnect-team/wppconnect/commit/1c34452)), closes [#2954](https://github.com/wppconnect-team/wppconnect/issues/2954)
|
|
28
|
+
- **deps-dev:** update dependency release-it to ^21.1.2 (#2952) ([df15904](https://github.com/wppconnect-team/wppconnect/commit/df15904)), closes [#2952](https://github.com/wppconnect-team/wppconnect/issues/2952)
|
|
29
|
+
- **deps-dev:** update dependency typescript-eslint to ^8.72.1 (#2943) ([b912ee1](https://github.com/wppconnect-team/wppconnect/commit/b912ee1)), closes [#2943](https://github.com/wppconnect-team/wppconnect/issues/2943)
|
|
30
|
+
- **deps-dev:** update dependency typescript-eslint to ^8.72.2 (#2960) ([775e5ee](https://github.com/wppconnect-team/wppconnect/commit/775e5ee)), closes [#2960](https://github.com/wppconnect-team/wppconnect/issues/2960)
|
|
31
|
+
- **deps-dev:** update dependency webpack to ^5.112.2 (#2942) ([8bf6381](https://github.com/wppconnect-team/wppconnect/commit/8bf6381)), closes [#2942](https://github.com/wppconnect-team/wppconnect/issues/2942)
|
|
32
|
+
- **deps:** bump follow-redirects from 1.16.1 to 1.16.2 (#2947) ([7bff268](https://github.com/wppconnect-team/wppconnect/commit/7bff268)), closes [#2947](https://github.com/wppconnect-team/wppconnect/issues/2947)
|
|
33
|
+
- **deps:** bump undici and release-it (#2948) ([7db9899](https://github.com/wppconnect-team/wppconnect/commit/7db9899)), closes [#2948](https://github.com/wppconnect-team/wppconnect/issues/2948)
|
|
34
|
+
- **deps:** bump zod, puppeteer and puppeteer-core (#2939) ([349fcdc](https://github.com/wppconnect-team/wppconnect/commit/349fcdc)), closes [#2939](https://github.com/wppconnect-team/wppconnect/issues/2939)
|
|
35
|
+
- **deps:** update dependency axios to ^1.21.0 (#2944) ([d8576d2](https://github.com/wppconnect-team/wppconnect/commit/d8576d2)), closes [#2944](https://github.com/wppconnect-team/wppconnect/issues/2944)
|
|
36
|
+
- **deps:** update dependency node to v24.22.2 (#2945) ([8d2ad2b](https://github.com/wppconnect-team/wppconnect/commit/8d2ad2b)), closes [#2945](https://github.com/wppconnect-team/wppconnect/issues/2945)
|
|
37
|
+
- **deps:** update dependency serialize-javascript to v7.1.4 (#2940) ([1b44483](https://github.com/wppconnect-team/wppconnect/commit/1b44483)), closes [#2940](https://github.com/wppconnect-team/wppconnect/issues/2940)
|
|
38
|
+
|
|
1
39
|
## <small>2.3.6 (2026-10-23)</small>
|
|
2
40
|
|
|
3
41
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -1,101 +1,119 @@
|
|
|
1
|
-
|
|
1
|
+
**English** | [Português (Brasil)](./README.pt-BR.md)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://wppconnect.io/">
|
|
5
|
+
<picture>
|
|
6
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://wppconnect-team.github.io/brand/v2/wppconnect-dark.png" />
|
|
7
|
+
<img src="https://wppconnect-team.github.io/brand/v2/wppconnect-light.png" alt="WPPConnect" width="220" height="121" />
|
|
8
|
+
</picture>
|
|
9
|
+
</a>
|
|
10
|
+
</p>
|
|
4
11
|
|
|
5
|
-
|
|
6
|
-
[](https://www.npmjs.com/package/@wppconnect-team/wppconnect)
|
|
7
|
-
[](https://isitmaintained.com/project/wppconnect-team/wppconnect 'Average time to resolve an issue')
|
|
8
|
-
[](https://isitmaintained.com/project/wppconnect-team/wppconnect 'Percentage of issues still open')
|
|
9
|
-
[](https://github.com/wppconnect-team/wppconnect/actions)
|
|
10
|
-
[](https://github.com/wppconnect-team/wppconnect/actions)
|
|
11
|
-
[](https://github.com/release-it/release-it)
|
|
12
|
+
# WPPConnect
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
Control WhatsApp Web from Node.js applications.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
<a target="_blank" href="https://wppconnect.io/docs/tutorial/basics/installation">Getting Started</a> •
|
|
17
|
-
<a target="_blank" href="https://wppconnect.io/docs/tutorial/basics/basic-functions">Basic Function</a> •
|
|
18
|
-
<a target="_blank" href="https://wppconnect.io/wppconnect">Documentation</a>
|
|
19
|
-
</p>
|
|
16
|
+
A project in the WPPConnect ecosystem, maintained by WPPConnect Team.
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
[Getting started](#getting-started) | [Documentation](#documentation) | [Contributing](#contributing) | [Support WPPConnect](#support-the-project)
|
|
22
19
|
|
|
23
|
-
[](https://t.me/wppconnect)
|
|
25
|
-
[](https://chat.whatsapp.com/LJaQu6ZyNvnBPNAVRbX00K)
|
|
26
|
-
[](https://www.youtube.com/c/wppconnect)
|
|
20
|
+
[](./LICENSE.md) [](https://www.npmjs.com/package/@wppconnect-team/wppconnect) [](https://github.com/wppconnect-team/wppconnect/actions/workflows/build.yml) [](https://opencollective.com/wppconnect)
|
|
27
21
|
|
|
28
|
-
##
|
|
22
|
+
## Overview
|
|
29
23
|
|
|
30
|
-
|
|
31
|
-
| ---------------------------------------------------------- | --- |
|
|
32
|
-
| Automatic QR Refresh | ✔ |
|
|
33
|
-
| Send **text, image, video, audio and docs** | ✔ |
|
|
34
|
-
| Get **contacts, chats, groups, group members, Block List** | ✔ |
|
|
35
|
-
| Send contacts | ✔ |
|
|
36
|
-
| Send stickers | ✔ |
|
|
37
|
-
| Send stickers GIF | ✔ |
|
|
38
|
-
| Multiple Sessions | ✔ |
|
|
39
|
-
| Forward Messages | ✔ |
|
|
40
|
-
| Receive message | ✔ |
|
|
41
|
-
| insert user section | ✔ |
|
|
42
|
-
| Send _location_ | ✔ |
|
|
43
|
-
| **and much more** | ✔ |
|
|
24
|
+
For developers building bots and integrations who want to manage the browser and session lifecycle in their own application. WPPConnect combines Puppeteer with the browser automation layer used by the ecosystem.
|
|
44
25
|
|
|
45
|
-
|
|
26
|
+
## Features
|
|
46
27
|
|
|
47
|
-
|
|
28
|
+
- Send and receive text, images, video, audio, documents, contacts, locations and stickers.
|
|
29
|
+
- Manage multiple sessions, QR pairing, chats, contacts and groups.
|
|
30
|
+
- Handle incoming messages and session events through the JavaScript/TypeScript API.
|
|
48
31
|
|
|
49
|
-
|
|
32
|
+
## Getting started
|
|
50
33
|
|
|
51
|
-
|
|
52
|
-
npm i --save @wppconnect-team/wppconnect
|
|
53
|
-
```
|
|
34
|
+
Use Node.js and npm, plus Chrome/Chromium and its operating-system dependencies. CI builds with Node.js 24.22.2; the package does not declare a minimum Node version.
|
|
54
35
|
|
|
55
|
-
|
|
36
|
+
```sh
|
|
37
|
+
npm install @wppconnect-team/wppconnect
|
|
38
|
+
```
|
|
56
39
|
|
|
57
|
-
|
|
40
|
+
Save this as `index.cjs`, run `node index.cjs`, and scan the QR code with WhatsApp Linked devices. Send `ping` from an authorized test contact to receive `pong`.
|
|
58
41
|
|
|
59
|
-
|
|
42
|
+
```javascript
|
|
43
|
+
const wppconnect = require("@wppconnect-team/wppconnect");
|
|
60
44
|
|
|
61
|
-
|
|
62
|
-
|
|
45
|
+
wppconnect.create({ session: "readme-demo" })
|
|
46
|
+
.then((client) => {
|
|
47
|
+
client.onMessage(async (message) => {
|
|
48
|
+
if (!message.isGroupMsg && message.body === "ping") {
|
|
49
|
+
await client.sendText(message.from, "pong");
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
})
|
|
53
|
+
.catch(console.error);
|
|
63
54
|
```
|
|
64
55
|
|
|
65
|
-
|
|
56
|
+
## Configuration
|
|
57
|
+
|
|
58
|
+
Pass session and browser options to `create(...)`; see [client creation](docs/getting-started/creating-client.md). Store session credentials privately. WhatsApp Web changes can require package updates; review release notes and deprecations when upgrading.
|
|
59
|
+
|
|
60
|
+
## Documentation
|
|
61
|
+
|
|
62
|
+
- [Installation guide](https://wppconnect.io/docs/tutorial/basics/installation)
|
|
63
|
+
- [API reference](https://wppconnect.io/wppconnect/)
|
|
64
|
+
- [Runnable examples](./examples/)
|
|
65
|
+
- [Retained technical details and acknowledgments](documentation/readme-reference.md)
|
|
66
|
+
|
|
67
|
+
## WPPConnect ecosystem
|
|
68
|
+
|
|
69
|
+
| Project | Purpose | When to use it |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| [WPPConnect/WA-JS](https://github.com/wppconnect-team/wa-js) | Expose WhatsApp Web functions through the browser-side `WPP` API. | Run browser-side code in WhatsApp Web. |
|
|
72
|
+
| [WPPConnect Server](https://github.com/wppconnect-team/wppconnect-server) | Run a REST API for WhatsApp sessions, messages and webhooks. | Expose session and messaging operations over HTTP. |
|
|
73
|
+
| [WPPConnect Manager](https://github.com/wppconnect-team/wppconnect-manager) | Manage WPPConnect Server sessions and conversations in a self-hosted web workspace. | Operate compatible Server sessions and chats through a UI. |
|
|
66
74
|
|
|
67
|
-
|
|
75
|
+
## Support the project
|
|
68
76
|
|
|
69
|
-
|
|
70
|
-
They will remain the same forever but might experience deprecation.
|
|
77
|
+
WPPConnect is maintained by an open-source community. Your support helps fund maintenance, infrastructure, documentation, and the people working on the ecosystem.
|
|
71
78
|
|
|
72
|
-
|
|
79
|
+
If WPPConnect helps your project or business, consider making a one-time contribution or becoming a recurring supporter.
|
|
73
80
|
|
|
74
|
-
|
|
75
|
-
|
|
81
|
+
**[Support WPPConnect on Open Collective](https://opencollective.com/wppconnect)**
|
|
82
|
+
|
|
83
|
+
Contributions are voluntary. See the official page for current financial information. You can also help with code, tests, documentation, translations and well-described issue reports.
|
|
84
|
+
|
|
85
|
+
Additional official beneficiaries in [.github/FUNDING.yml](.github/FUNDING.yml): [joaosouz4dev](https://github.com/sponsors/joaosouz4dev), [manfe](https://github.com/sponsors/manfe).
|
|
76
86
|
|
|
77
87
|
## Contributing
|
|
78
88
|
|
|
79
|
-
|
|
80
|
-
discuss what you would like to change.
|
|
89
|
+
Contributions of code, tests, examples, documentation and translations are welcome. For larger changes, discuss the approach in an issue first. Include the project/runtime versions, a minimal reproduction and sanitized logs when reporting a problem. Update both `README.md` and `README.pt-BR.md` in the same change when installation, configuration, features, examples, licensing or funding changes.
|
|
81
90
|
|
|
82
|
-
|
|
91
|
+
Read [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
83
92
|
|
|
84
|
-
|
|
93
|
+
After installing the development dependencies, use the repository checks relevant to your change:
|
|
85
94
|
|
|
86
|
-
|
|
95
|
+
```sh
|
|
96
|
+
npm run build
|
|
97
|
+
npm run lint
|
|
98
|
+
npm test
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Account-dependent examples and tests require separate validation with an authorized test account. Never attach credentials or session files to an issue.
|
|
87
102
|
|
|
88
|
-
|
|
103
|
+
## Community and support
|
|
104
|
+
|
|
105
|
+
Use [repository issues](https://github.com/wppconnect-team/wppconnect/issues) for reproducible bugs and feature proposals. For usage questions, join the community through the official channels:
|
|
106
|
+
|
|
107
|
+
- [Discord](https://discord.gg/JU5JGGKGNG)
|
|
108
|
+
- [Telegram](https://t.me/wppconnect)
|
|
109
|
+
- [YouTube](https://www.youtube.com/c/wppconnect)
|
|
110
|
+
|
|
111
|
+
This project is independent and is not affiliated with or endorsed by WhatsApp or Meta. Follow applicable terms and obtain authorization for account and messaging operations.
|
|
112
|
+
|
|
113
|
+
## License
|
|
89
114
|
|
|
90
|
-
|
|
91
|
-
it under the terms of the GNU Lesser General Public License as published by
|
|
92
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
93
|
-
(at your option) any later version.
|
|
115
|
+
[GNU Lesser General Public License v3.0 or later (LGPL-3.0-or-later)](./LICENSE.md).
|
|
94
116
|
|
|
95
|
-
WPPConnect
|
|
96
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
97
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
98
|
-
GNU Lesser General Public License for more details.
|
|
117
|
+
WPPConnect Team and contributors.
|
|
99
118
|
|
|
100
|
-
|
|
101
|
-
along with WPPConnect. If not, see <https://www.gnu.org/licenses/>.
|
|
119
|
+
The original legal document and existing copyright notices are preserved. Third-party components retain their own terms.
|
package/README.pt-BR.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
[English](./README.md) | **Português (Brasil)**
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://wppconnect.io/">
|
|
5
|
+
<picture>
|
|
6
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://wppconnect-team.github.io/brand/v2/wppconnect-dark.png" />
|
|
7
|
+
<img src="https://wppconnect-team.github.io/brand/v2/wppconnect-light.png" alt="WPPConnect" width="220" height="121" />
|
|
8
|
+
</picture>
|
|
9
|
+
</a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
# WPPConnect
|
|
13
|
+
|
|
14
|
+
Controle o WhatsApp Web em aplicações Node.js.
|
|
15
|
+
|
|
16
|
+
Um projeto do ecossistema WPPConnect, mantido pela WPPConnect Team.
|
|
17
|
+
|
|
18
|
+
[Primeiros passos](#primeiros-passos) | [Documentação](#documentação) | [Como contribuir](#como-contribuir) | [Apoie a WPPConnect](#apoie-o-projeto)
|
|
19
|
+
|
|
20
|
+
[](./LICENSE.md) [](https://www.npmjs.com/package/@wppconnect-team/wppconnect) [](https://github.com/wppconnect-team/wppconnect/actions/workflows/build.yml) [](https://opencollective.com/wppconnect)
|
|
21
|
+
|
|
22
|
+
## Visão geral
|
|
23
|
+
|
|
24
|
+
Para desenvolvedores de bots e integrações que querem gerenciar o navegador e o ciclo de vida das sessões na própria aplicação. A WPPConnect combina Puppeteer com a camada de automação no navegador usada pelo ecossistema.
|
|
25
|
+
|
|
26
|
+
## Funcionalidades
|
|
27
|
+
|
|
28
|
+
- Envie e receba texto, imagens, vídeo, áudio, documentos, contatos, localizações e stickers.
|
|
29
|
+
- Gerencie múltiplas sessões, pareamento por QR, conversas, contatos e grupos.
|
|
30
|
+
- Trate mensagens recebidas e eventos de sessão pela API JavaScript/TypeScript.
|
|
31
|
+
|
|
32
|
+
## Primeiros passos
|
|
33
|
+
|
|
34
|
+
Use Node.js e npm, além de Chrome/Chromium e suas dependências do sistema operacional. O CI compila com Node.js 24.22.2; o pacote não declara uma versão mínima do Node.
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
npm install @wppconnect-team/wppconnect
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Salve como `index.cjs`, execute `node index.cjs` e leia o QR code em Aparelhos conectados do WhatsApp. Envie `ping` de um contato de teste autorizado para receber `pong`.
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
const wppconnect = require("@wppconnect-team/wppconnect");
|
|
44
|
+
|
|
45
|
+
wppconnect.create({ session: "readme-demo" })
|
|
46
|
+
.then((client) => {
|
|
47
|
+
client.onMessage(async (message) => {
|
|
48
|
+
if (!message.isGroupMsg && message.body === "ping") {
|
|
49
|
+
await client.sendText(message.from, "pong");
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
})
|
|
53
|
+
.catch(console.error);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Configuração
|
|
57
|
+
|
|
58
|
+
Passe as opções de sessão e navegador para `create(...)`; consulte a [criação do cliente](docs/getting-started/creating-client.md). Guarde as credenciais de sessão em local privado. Mudanças no WhatsApp Web podem exigir atualizações do pacote; confira as notas de versão e depreciações ao atualizar.
|
|
59
|
+
|
|
60
|
+
## Documentação
|
|
61
|
+
|
|
62
|
+
- [Guia de instalação](https://wppconnect.io/docs/tutorial/basics/installation)
|
|
63
|
+
- [Referência da API](https://wppconnect.io/wppconnect/)
|
|
64
|
+
- [Exemplos executáveis](./examples/)
|
|
65
|
+
- [Detalhes técnicos e agradecimentos preservados](documentation/readme-reference.md)
|
|
66
|
+
|
|
67
|
+
## Ecossistema WPPConnect
|
|
68
|
+
|
|
69
|
+
| Projeto | Finalidade | Quando usar |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| [WPPConnect/WA-JS](https://github.com/wppconnect-team/wa-js) | Exponha funções do WhatsApp Web pela API `WPP` no navegador. | Executar código no navegador dentro do WhatsApp Web. |
|
|
72
|
+
| [WPPConnect Server](https://github.com/wppconnect-team/wppconnect-server) | Execute uma API REST para sessões, mensagens e webhooks do WhatsApp. | Expor operações de sessão e mensagens por HTTP. |
|
|
73
|
+
| [WPPConnect Manager](https://github.com/wppconnect-team/wppconnect-manager) | Gerencie sessões e conversas do WPPConnect Server em uma aplicação web auto-hospedada. | Operar sessões e conversas de um Server compatível pela interface. |
|
|
74
|
+
|
|
75
|
+
## Apoie o projeto
|
|
76
|
+
|
|
77
|
+
A WPPConnect é mantida por uma comunidade de código aberto. Seu apoio ajuda a financiar a manutenção, a infraestrutura, a documentação e o trabalho das pessoas que desenvolvem o ecossistema.
|
|
78
|
+
|
|
79
|
+
Se a WPPConnect ajuda seu projeto ou sua empresa, considere fazer uma contribuição pontual ou apoiar de forma recorrente.
|
|
80
|
+
|
|
81
|
+
**[Apoie a WPPConnect no Open Collective](https://opencollective.com/wppconnect)**
|
|
82
|
+
|
|
83
|
+
As contribuições são voluntárias. Consulte a página oficial para acompanhar as informações financeiras atuais. Você também pode ajudar com código, testes, documentação, traduções e relatos de problemas bem descritos.
|
|
84
|
+
|
|
85
|
+
Beneficiários oficiais adicionais em [.github/FUNDING.yml](.github/FUNDING.yml): [joaosouz4dev](https://github.com/sponsors/joaosouz4dev), [manfe](https://github.com/sponsors/manfe).
|
|
86
|
+
|
|
87
|
+
## Como contribuir
|
|
88
|
+
|
|
89
|
+
Contribuições de código, testes, exemplos, documentação e traduções são bem-vindas. Para mudanças maiores, discuta a proposta em uma issue primeiro. Ao relatar um problema, informe as versões do projeto/runtime, uma reprodução mínima e logs sem dados sensíveis. Atualize `README.md` e `README.pt-BR.md` na mesma alteração quando mudar instalação, configuração, funcionalidades, exemplos, licença ou arrecadação.
|
|
90
|
+
|
|
91
|
+
Leia [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
92
|
+
|
|
93
|
+
Após instalar as dependências de desenvolvimento, use as verificações pertinentes à sua alteração:
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
npm run build
|
|
97
|
+
npm run lint
|
|
98
|
+
npm test
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Exemplos e testes que dependem de conta exigem validação separada com uma conta de teste autorizada. Nunca anexe credenciais ou arquivos de sessão a uma issue.
|
|
102
|
+
|
|
103
|
+
## Comunidade e suporte
|
|
104
|
+
|
|
105
|
+
Use as [issues do repositório](https://github.com/wppconnect-team/wppconnect/issues) para bugs reproduzíveis e propostas de funcionalidades. Para dúvidas de uso, participe pelos canais oficiais:
|
|
106
|
+
|
|
107
|
+
- [Discord](https://discord.gg/JU5JGGKGNG)
|
|
108
|
+
- [Telegram](https://t.me/wppconnect)
|
|
109
|
+
- [YouTube](https://www.youtube.com/c/wppconnect)
|
|
110
|
+
|
|
111
|
+
Este projeto é independente e não é afiliado nem endossado pelo WhatsApp ou pela Meta. Siga os termos aplicáveis e obtenha autorização para operações de conta e mensagens.
|
|
112
|
+
|
|
113
|
+
## Licença
|
|
114
|
+
|
|
115
|
+
[GNU Lesser General Public License v3.0 or later (LGPL-3.0-or-later)](./LICENSE.md).
|
|
116
|
+
|
|
117
|
+
WPPConnect Team and contributors.
|
|
118
|
+
|
|
119
|
+
O documento jurídico original e os avisos de autoria existentes são preservados. Componentes de terceiros mantêm seus próprios termos.
|
|
@@ -69,17 +69,17 @@ export declare class CatalogLayer extends CommunityLayer {
|
|
|
69
69
|
* @param options Object with options
|
|
70
70
|
* @example
|
|
71
71
|
* ```javascript
|
|
72
|
-
* client.editProduct('56989897878' {
|
|
72
|
+
* client.editProduct('56989897878', {
|
|
73
73
|
* name: 'Product name',
|
|
74
74
|
* description: 'product description',
|
|
75
|
-
* price:
|
|
75
|
+
* price: 89.90,
|
|
76
76
|
* isHidden: true,
|
|
77
77
|
* url: 'https://wppconnect.io',
|
|
78
78
|
* retailerId: 'AKA001',
|
|
79
79
|
* });
|
|
80
80
|
* ```
|
|
81
81
|
*/
|
|
82
|
-
editProduct(productId: string, options:
|
|
82
|
+
editProduct(productId: string, options: any): Promise<import("@wppconnect/wa-js/dist/whatsapp").ProductModel>;
|
|
83
83
|
/**
|
|
84
84
|
* Delete product(s) on catalog
|
|
85
85
|
* @param productsId Products ID
|
|
@@ -82,10 +82,10 @@ class CatalogLayer extends community_layer_1.CommunityLayer {
|
|
|
82
82
|
* @param options Object with options
|
|
83
83
|
* @example
|
|
84
84
|
* ```javascript
|
|
85
|
-
* client.editProduct('56989897878' {
|
|
85
|
+
* client.editProduct('56989897878', {
|
|
86
86
|
* name: 'Product name',
|
|
87
87
|
* description: 'product description',
|
|
88
|
-
* price:
|
|
88
|
+
* price: 89.90,
|
|
89
89
|
* isHidden: true,
|
|
90
90
|
* url: 'https://wppconnect.io',
|
|
91
91
|
* retailerId: 'AKA001',
|
|
@@ -121,7 +121,7 @@ class GroupLayer extends retriever_layer_1.RetrieverLayer {
|
|
|
121
121
|
* @param participantId Participant id'000000000000@c.us'
|
|
122
122
|
*/
|
|
123
123
|
async promoteParticipant(groupId, participantId) {
|
|
124
|
-
await (0, helpers_1.evaluateAndReturn)(this.page, ({ groupId, participantId }) => WPP.group.promoteParticipants(groupId, participantId), { groupId, participantId });
|
|
124
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ groupId, participantId }) => WPP.group.promoteParticipants(groupId, participantId), { groupId, participantId });
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
127
|
* Demotes admin privileges of participant
|
|
@@ -29,6 +29,7 @@ export declare class HostLayer {
|
|
|
29
29
|
statusFind?: StatusFindCallback;
|
|
30
30
|
onLoadingScreen?: LoadingScreenCallback;
|
|
31
31
|
catchLinkCode?: LinkByCodeCallback;
|
|
32
|
+
protected readonly browserAcquiredHere: boolean;
|
|
32
33
|
constructor(page: Page, session?: string, options?: CreateConfig);
|
|
33
34
|
protected log(level: LogLevel, message: string, meta?: object): void;
|
|
34
35
|
protected initialize(): Promise<void>;
|
|
@@ -65,7 +66,7 @@ export declare class HostLayer {
|
|
|
65
66
|
protected startAutoClose(time?: number | null): void;
|
|
66
67
|
protected cancelAutoClose(): void;
|
|
67
68
|
getQrCode(): Promise<ScrapQrcode>;
|
|
68
|
-
waitForQrCodeScan(): Promise<void>;
|
|
69
|
+
waitForQrCodeScan(catchQR?: CatchQRCallback): Promise<void>;
|
|
69
70
|
waitForInChat(): Promise<boolean>;
|
|
70
71
|
waitForPageLoad(): Promise<void>;
|
|
71
72
|
waitForLogin(): Promise<boolean>;
|
|
@@ -47,9 +47,11 @@ class HostLayer {
|
|
|
47
47
|
statusFind = null;
|
|
48
48
|
onLoadingScreen = null;
|
|
49
49
|
catchLinkCode = null;
|
|
50
|
+
browserAcquiredHere;
|
|
50
51
|
constructor(page, session, options) {
|
|
51
52
|
this.page = page;
|
|
52
53
|
this.session = session;
|
|
54
|
+
this.browserAcquiredHere = options?.__browserAcquiredHere === true;
|
|
53
55
|
this.options = { ...create_config_1.defaultOptions, ...options };
|
|
54
56
|
this.logger = this.options.logger || logger_1.defaultLogger;
|
|
55
57
|
this.log('info', 'Initializing...');
|
|
@@ -329,10 +331,17 @@ class HostLayer {
|
|
|
329
331
|
this.log('info', 'Closing the page');
|
|
330
332
|
this.autoCloseCalled = true;
|
|
331
333
|
this.statusFind && this.statusFind('autocloseCalled', this.session);
|
|
332
|
-
|
|
333
|
-
this.page.close()
|
|
334
|
-
|
|
335
|
-
|
|
334
|
+
void Promise.resolve()
|
|
335
|
+
.then(() => this.page.close())
|
|
336
|
+
.catch(async (error) => {
|
|
337
|
+
this.log('error', error);
|
|
338
|
+
if (this.browserAcquiredHere) {
|
|
339
|
+
await (0, browser_1.closeBrowser)(this.page.browser());
|
|
340
|
+
}
|
|
341
|
+
})
|
|
342
|
+
.catch((error) => {
|
|
343
|
+
this.log('error', error);
|
|
344
|
+
});
|
|
336
345
|
}
|
|
337
346
|
}
|
|
338
347
|
startAutoClose(time = null) {
|
|
@@ -367,7 +376,10 @@ class HostLayer {
|
|
|
367
376
|
qrResult = await (0, helpers_1.scrapeImg)(this.page).catch(() => undefined);
|
|
368
377
|
return qrResult;
|
|
369
378
|
}
|
|
370
|
-
async waitForQrCodeScan() {
|
|
379
|
+
async waitForQrCodeScan(catchQR) {
|
|
380
|
+
if (catchQR) {
|
|
381
|
+
this.catchQR = catchQR;
|
|
382
|
+
}
|
|
371
383
|
if (!this.isStarted) {
|
|
372
384
|
throw new Error('waitForQrCodeScan error: Session not started');
|
|
373
385
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Page } from 'puppeteer';
|
|
2
2
|
import { CreateConfig } from '../../config/create-config';
|
|
3
|
+
import { AddOrRemoveLabelsOptions, DeleteLabelReturn, EditLabelOptions, Label, NewLabelOptions } from '../model';
|
|
3
4
|
import { ListsLayer } from './lists.layer';
|
|
4
5
|
export declare class LabelsLayer extends ListsLayer {
|
|
5
6
|
page: Page;
|
|
@@ -19,7 +20,21 @@ export declare class LabelsLayer extends ListsLayer {
|
|
|
19
20
|
* @param name Name of label
|
|
20
21
|
* @param options options of label
|
|
21
22
|
*/
|
|
22
|
-
addNewLabel(name: string, options?: string): Promise<
|
|
23
|
+
addNewLabel(name: string, options?: NewLabelOptions | string): Promise<Label>;
|
|
24
|
+
/**
|
|
25
|
+
* Edit an existing Label
|
|
26
|
+
* @category Labels
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```javascript
|
|
30
|
+
* client.editLabel('1', { name: 'New label name' });
|
|
31
|
+
* //or
|
|
32
|
+
* client.editLabel('1', { labelColor: '#dfaef0' });
|
|
33
|
+
* ```
|
|
34
|
+
* @param id Id of label
|
|
35
|
+
* @param options options of label
|
|
36
|
+
*/
|
|
37
|
+
editLabel(id: string, options?: EditLabelOptions): Promise<Label>;
|
|
23
38
|
/**
|
|
24
39
|
* Add or delete label of chatId
|
|
25
40
|
* @category Labels
|
|
@@ -36,10 +51,7 @@ export declare class LabelsLayer extends ListsLayer {
|
|
|
36
51
|
* @param chatIds ChatIds
|
|
37
52
|
* @param options options to remove or add
|
|
38
53
|
*/
|
|
39
|
-
addOrRemoveLabels(chatIds: string, options:
|
|
40
|
-
labelId: string;
|
|
41
|
-
type: 'add' | 'remove';
|
|
42
|
-
}[]): Promise<void>;
|
|
54
|
+
addOrRemoveLabels(chatIds: string | string[], options: AddOrRemoveLabelsOptions | AddOrRemoveLabelsOptions[]): Promise<any>;
|
|
43
55
|
/**
|
|
44
56
|
* Get all Labels
|
|
45
57
|
*
|
|
@@ -48,7 +60,7 @@ export declare class LabelsLayer extends ListsLayer {
|
|
|
48
60
|
* client.getAllLabels();
|
|
49
61
|
* ```
|
|
50
62
|
*/
|
|
51
|
-
getAllLabels(): Promise<
|
|
63
|
+
getAllLabels(): Promise<Label[]>;
|
|
52
64
|
/**
|
|
53
65
|
* Get Label by id
|
|
54
66
|
* @category Labels
|
|
@@ -59,7 +71,17 @@ export declare class LabelsLayer extends ListsLayer {
|
|
|
59
71
|
* client.getLabelById('1');
|
|
60
72
|
* ```
|
|
61
73
|
*/
|
|
62
|
-
getLabelById(id: string): Promise<
|
|
74
|
+
getLabelById(id: string): Promise<Label>;
|
|
75
|
+
/**
|
|
76
|
+
* Get color palette for labels
|
|
77
|
+
* @category Labels
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```javascript
|
|
81
|
+
* client.getLabelColorPalette();
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
getLabelColorPalette(): Promise<string[]>;
|
|
63
85
|
/**
|
|
64
86
|
* Delete all Labels
|
|
65
87
|
* @category Labels
|
|
@@ -69,16 +91,16 @@ export declare class LabelsLayer extends ListsLayer {
|
|
|
69
91
|
* client.deleteAllLabels();
|
|
70
92
|
* ```
|
|
71
93
|
*/
|
|
72
|
-
deleteAllLabels(): Promise<
|
|
94
|
+
deleteAllLabels(): Promise<DeleteLabelReturn[]>;
|
|
73
95
|
/**
|
|
74
|
-
*
|
|
96
|
+
* Delete label(s) by id
|
|
75
97
|
* @category Labels
|
|
76
98
|
*
|
|
77
99
|
* @example
|
|
78
100
|
* ```javascript
|
|
79
|
-
* client.deleteLabel();
|
|
101
|
+
* client.deleteLabel('1');
|
|
80
102
|
* ```
|
|
81
|
-
* @param id Id or string
|
|
103
|
+
* @param id Id or string array of labels to delete
|
|
82
104
|
*/
|
|
83
|
-
deleteLabel(id: string | string[]): Promise<
|
|
105
|
+
deleteLabel(id: string | string[]): Promise<DeleteLabelReturn | DeleteLabelReturn[]>;
|
|
84
106
|
}
|
|
@@ -41,9 +41,23 @@ class LabelsLayer extends lists_layer_1.ListsLayer {
|
|
|
41
41
|
* @param options options of label
|
|
42
42
|
*/
|
|
43
43
|
async addNewLabel(name, options) {
|
|
44
|
-
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ name, options }) => {
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ name, options }) => WPP.labels.addNewLabel(name, options), { name, options });
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Edit an existing Label
|
|
48
|
+
* @category Labels
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```javascript
|
|
52
|
+
* client.editLabel('1', { name: 'New label name' });
|
|
53
|
+
* //or
|
|
54
|
+
* client.editLabel('1', { labelColor: '#dfaef0' });
|
|
55
|
+
* ```
|
|
56
|
+
* @param id Id of label
|
|
57
|
+
* @param options options of label
|
|
58
|
+
*/
|
|
59
|
+
async editLabel(id, options) {
|
|
60
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ id, options }) => WPP.labels.editLabel(id, options), { id, options });
|
|
47
61
|
}
|
|
48
62
|
/**
|
|
49
63
|
* Add or delete label of chatId
|
|
@@ -62,9 +76,7 @@ class LabelsLayer extends lists_layer_1.ListsLayer {
|
|
|
62
76
|
* @param options options to remove or add
|
|
63
77
|
*/
|
|
64
78
|
async addOrRemoveLabels(chatIds, options) {
|
|
65
|
-
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ chatIds, options }) => {
|
|
66
|
-
WPP.labels.addOrRemoveLabels(chatIds, options);
|
|
67
|
-
}, { chatIds, options });
|
|
79
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ chatIds, options }) => WPP.labels.addOrRemoveLabels(chatIds, options), { chatIds, options });
|
|
68
80
|
}
|
|
69
81
|
/**
|
|
70
82
|
* Get all Labels
|
|
@@ -88,9 +100,19 @@ class LabelsLayer extends lists_layer_1.ListsLayer {
|
|
|
88
100
|
* ```
|
|
89
101
|
*/
|
|
90
102
|
async getLabelById(id) {
|
|
91
|
-
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ id }) => {
|
|
92
|
-
|
|
93
|
-
|
|
103
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ id }) => WPP.labels.getLabelById(id), { id });
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get color palette for labels
|
|
107
|
+
* @category Labels
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```javascript
|
|
111
|
+
* client.getLabelColorPalette();
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
async getLabelColorPalette() {
|
|
115
|
+
return (0, helpers_1.evaluateAndReturn)(this.page, () => WPP.labels.getLabelColorPalette());
|
|
94
116
|
}
|
|
95
117
|
/**
|
|
96
118
|
* Delete all Labels
|
|
@@ -102,24 +124,20 @@ class LabelsLayer extends lists_layer_1.ListsLayer {
|
|
|
102
124
|
* ```
|
|
103
125
|
*/
|
|
104
126
|
async deleteAllLabels() {
|
|
105
|
-
return await (0, helpers_1.evaluateAndReturn)(this.page, () =>
|
|
106
|
-
WPP.labels.deleteAllLabels();
|
|
107
|
-
});
|
|
127
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, () => WPP.labels.deleteAllLabels());
|
|
108
128
|
}
|
|
109
129
|
/**
|
|
110
|
-
*
|
|
130
|
+
* Delete label(s) by id
|
|
111
131
|
* @category Labels
|
|
112
132
|
*
|
|
113
133
|
* @example
|
|
114
134
|
* ```javascript
|
|
115
|
-
* client.deleteLabel();
|
|
135
|
+
* client.deleteLabel('1');
|
|
116
136
|
* ```
|
|
117
|
-
* @param id Id or string
|
|
137
|
+
* @param id Id or string array of labels to delete
|
|
118
138
|
*/
|
|
119
139
|
async deleteLabel(id) {
|
|
120
|
-
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ id }) => {
|
|
121
|
-
WPP.labels.deleteLabel(id);
|
|
122
|
-
}, { id });
|
|
140
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ id }) => WPP.labels.deleteLabel(id), { id });
|
|
123
141
|
}
|
|
124
142
|
}
|
|
125
143
|
exports.LabelsLayer = LabelsLayer;
|