@victorhalla/n8n-nodes-wwebjsapi 1.0.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/README.md +132 -0
- package/dist/credentials/WWebjsApiCredentials.credentials.d.ts +16 -0
- package/dist/credentials/WWebjsApiCredentials.credentials.d.ts.map +1 -0
- package/dist/credentials/WWebjsApiCredentials.credentials.js +37 -0
- package/dist/credentials/WWebjsApiCredentials.credentials.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/nodes/WWebjsApi/WWebjsApi.node.d.ts +16 -0
- package/dist/nodes/WWebjsApi/WWebjsApi.node.d.ts.map +1 -0
- package/dist/nodes/WWebjsApi/WWebjsApi.node.js +6578 -0
- package/dist/nodes/WWebjsApi/WWebjsApi.node.js.map +1 -0
- package/package.json +51 -0
package/README.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# n8n-nodes-wwebjsapi
|
|
2
|
+
|
|
3
|
+
Node n8n para integração completa com a [WWebJS API](https://github.com/avoylenko/wwebjs-api) — um wrapper REST para o WhatsApp Web JS.
|
|
4
|
+
|
|
5
|
+
## 🚀 Instalação
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# No diretório do n8n
|
|
9
|
+
npm install n8n-nodes-wwebjsapi
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Ou via interface do n8n: **Settings → Community Nodes → Install**
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## ⚙️ Configuração
|
|
17
|
+
|
|
18
|
+
1. No n8n, crie uma credencial do tipo **WWebJS API Credentials**
|
|
19
|
+
2. Preencha:
|
|
20
|
+
- **Base URL**: URL do seu servidor WWebJS (ex: `http://localhost:3000`)
|
|
21
|
+
- **API Key**: valor da variável `API_KEY` configurada no servidor
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 📋 Operações disponíveis
|
|
26
|
+
|
|
27
|
+
O node é gerado automaticamente a partir do `swagger.json` da API. As operações são organizadas por categoria:
|
|
28
|
+
|
|
29
|
+
### Session
|
|
30
|
+
| Operação | Descrição |
|
|
31
|
+
|---|---|
|
|
32
|
+
| Get all sessions | Lista todas as sessões ativas |
|
|
33
|
+
| Start session | Inicia uma nova sessão |
|
|
34
|
+
| Stop session | Para uma sessão |
|
|
35
|
+
| Get session status | Status atual da sessão |
|
|
36
|
+
| Get session QR code | Dados do QR code |
|
|
37
|
+
| Get QR code as image | QR code como imagem PNG |
|
|
38
|
+
| Request pairing code | Autenticar via código de pareamento |
|
|
39
|
+
| Restart session | Reinicia a sessão |
|
|
40
|
+
| Terminate session | Encerra a sessão |
|
|
41
|
+
| Terminate inactive sessions | Encerra todas sessões inativas |
|
|
42
|
+
| Terminate all sessions | Encerra todas as sessões |
|
|
43
|
+
| Get page screenshot | Screenshot do browser |
|
|
44
|
+
|
|
45
|
+
### Client
|
|
46
|
+
| Operação | Descrição |
|
|
47
|
+
|---|---|
|
|
48
|
+
| Get connection info | Informações da conexão atual |
|
|
49
|
+
| Accept group invite | Aceita convite de grupo |
|
|
50
|
+
| Archive chat | Arquiva um chat |
|
|
51
|
+
| Create group | Cria um grupo |
|
|
52
|
+
| Get all chats | Lista todos os chats |
|
|
53
|
+
| Get all contacts | Lista todos os contatos |
|
|
54
|
+
| Get number ID | Obtém WID de um número |
|
|
55
|
+
| Send message | Envia mensagem de texto |
|
|
56
|
+
| Send media from URL | Envia mídia por URL |
|
|
57
|
+
| Set status message | Define mensagem de status |
|
|
58
|
+
| Check if user is registered | Verifica se número está no WhatsApp |
|
|
59
|
+
| Get chat by ID | Detalhes de um chat |
|
|
60
|
+
| Get contact by ID | Detalhes de um contato |
|
|
61
|
+
|
|
62
|
+
### Message
|
|
63
|
+
| Operação | Descrição |
|
|
64
|
+
|---|---|
|
|
65
|
+
| Get messages from chat | Lista mensagens de um chat |
|
|
66
|
+
| Delete message | Deleta uma mensagem |
|
|
67
|
+
| React to message | Reage com emoji |
|
|
68
|
+
| Star message | Marca/desmarca mensagem como favorita |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 🔄 Atualizar para nova versão da API
|
|
73
|
+
|
|
74
|
+
O node é **gerado automaticamente** a partir do `swagger.json`. Para atualizar:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Opção 1: Script automático
|
|
78
|
+
bash scripts/update-swagger.sh
|
|
79
|
+
|
|
80
|
+
# Opção 2: Manual
|
|
81
|
+
curl -o swagger.json https://raw.githubusercontent.com/avoylenko/wwebjs-api/refs/heads/main/swagger.json
|
|
82
|
+
node scripts/generate-from-swagger.js
|
|
83
|
+
npm run build
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 🛠️ Desenvolvimento
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Clone e instale
|
|
92
|
+
git clone <repo>
|
|
93
|
+
cd n8n-nodes-wwebjsapi
|
|
94
|
+
npm install
|
|
95
|
+
|
|
96
|
+
# Gerar a partir do swagger atual
|
|
97
|
+
npm run generate
|
|
98
|
+
|
|
99
|
+
# Compilar
|
|
100
|
+
npm run build
|
|
101
|
+
|
|
102
|
+
# Desenvolver com watch
|
|
103
|
+
npm run dev
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 📁 Estrutura do projeto
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
n8n-nodes-wwebjsapi/
|
|
112
|
+
├── swagger.json # ← Atualize este arquivo para novas versões
|
|
113
|
+
├── scripts/
|
|
114
|
+
│ ├── generate-from-swagger.js # Gerador automático do node
|
|
115
|
+
│ └── update-swagger.sh # Script de atualização completa
|
|
116
|
+
├── nodes/
|
|
117
|
+
│ └── WWebjsApi/
|
|
118
|
+
│ ├── WWebjsApi.node.ts # ← GERADO AUTOMATICAMENTE
|
|
119
|
+
│ └── wwebjs.svg
|
|
120
|
+
├── credentials/
|
|
121
|
+
│ └── WWebjsApiCredentials.credentials.ts
|
|
122
|
+
├── package.json
|
|
123
|
+
└── tsconfig.json
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
> ⚠️ **Não edite** `WWebjsApi.node.ts` diretamente — ele é regerado a cada atualização.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 📄 Licença
|
|
131
|
+
|
|
132
|
+
MIT
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ICredentialType, INodeProperties } from "n8n-workflow";
|
|
2
|
+
export declare class WWebjsApiCredentials implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: {
|
|
8
|
+
type: "generic";
|
|
9
|
+
properties: {
|
|
10
|
+
headers: {
|
|
11
|
+
"x-api-key": string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=WWebjsApiCredentials.credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WWebjsApiCredentials.credentials.d.ts","sourceRoot":"","sources":["../../credentials/WWebjsApiCredentials.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEhE,qBAAa,oBAAqB,YAAW,eAAe;IAC1D,IAAI,SAA0B;IAC9B,WAAW,SAA4B;IACvC,gBAAgB,SAA6C;IAC7D,UAAU,EAAE,eAAe,EAAE,CAkB3B;IAEF,YAAY;;;;;;;MAKV;CACH"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WWebjsApiCredentials = void 0;
|
|
4
|
+
class WWebjsApiCredentials {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = "wWebjsApiCredentials";
|
|
7
|
+
this.displayName = "WWebJS API Credentials";
|
|
8
|
+
this.documentationUrl = "https://github.com/avoylenko/wwebjs-api";
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: "Base URL",
|
|
12
|
+
name: "baseUrl",
|
|
13
|
+
type: "string",
|
|
14
|
+
default: "http://localhost:3000",
|
|
15
|
+
required: true,
|
|
16
|
+
description: "URL base da API WWebJS (ex: http://localhost:3000)",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
displayName: "API Key",
|
|
20
|
+
name: "apiKey",
|
|
21
|
+
type: "string",
|
|
22
|
+
typeOptions: { password: true },
|
|
23
|
+
default: "",
|
|
24
|
+
required: true,
|
|
25
|
+
description: "Chave de API configurada no servidor WWebJS (variável API_KEY)",
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
this.authenticate = {
|
|
29
|
+
type: "generic",
|
|
30
|
+
properties: {
|
|
31
|
+
headers: { "x-api-key": "={{$credentials.apiKey}}" },
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.WWebjsApiCredentials = WWebjsApiCredentials;
|
|
37
|
+
//# sourceMappingURL=WWebjsApiCredentials.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WWebjsApiCredentials.credentials.js","sourceRoot":"","sources":["../../credentials/WWebjsApiCredentials.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,oBAAoB;IAAjC;QACE,SAAI,GAAG,sBAAsB,CAAC;QAC9B,gBAAW,GAAG,wBAAwB,CAAC;QACvC,qBAAgB,GAAG,yCAAyC,CAAC;QAC7D,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,uBAAuB;gBAChC,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,oDAAoD;aAClE;YACD;gBACE,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,gEAAgE;aAC9E;SACF,CAAC;QAEF,iBAAY,GAAG;YACb,IAAI,EAAE,SAAkB;YACxB,UAAU,EAAE;gBACV,OAAO,EAAE,EAAE,WAAW,EAAE,0BAA0B,EAAE;aACrD;SACF,CAAC;IACJ,CAAC;CAAA;AA9BD,oDA8BC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WWebjsApiCredentials = exports.default = void 0;
|
|
4
|
+
var WWebjsApi_node_1 = require("./nodes/WWebjsApi/WWebjsApi.node");
|
|
5
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return WWebjsApi_node_1.WWebjsApi; } });
|
|
6
|
+
var WWebjsApiCredentials_credentials_1 = require("./credentials/WWebjsApiCredentials.credentials");
|
|
7
|
+
Object.defineProperty(exports, "WWebjsApiCredentials", { enumerable: true, get: function () { return WWebjsApiCredentials_credentials_1.WWebjsApiCredentials; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,mEAAwE;AAA/D,yGAAA,SAAS,OAAW;AAC7B,mGAAsF;AAA7E,wIAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================
|
|
3
|
+
* WWebJS API - n8n Node
|
|
4
|
+
* GERADO AUTOMATICAMENTE — não edite diretamente!
|
|
5
|
+
*
|
|
6
|
+
* Para regenerar: node scripts/generate-from-swagger.js
|
|
7
|
+
* Swagger version: 1.0.0
|
|
8
|
+
* API: WWebJS API
|
|
9
|
+
* ============================================================
|
|
10
|
+
*/
|
|
11
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from "n8n-workflow";
|
|
12
|
+
export declare class WWebjsApi implements INodeType {
|
|
13
|
+
description: INodeTypeDescription;
|
|
14
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=WWebjsApi.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WWebjsApi.node.d.ts","sourceRoot":"","sources":["../../../nodes/WWebjsApi/WWebjsApi.node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,iBAAiB,EAEjB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EAErB,MAAM,cAAc,CAAC;AAEtB,qBAAa,SAAU,YAAW,SAAS;IACzC,WAAW,EAAE,oBAAoB,CAohI/B;IAEI,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;CAwkFxE"}
|