@iproute/n8n-nodes-wppapi 0.1.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 ADDED
@@ -0,0 +1,34 @@
1
+ # n8n-nodes-wppapi
2
+
3
+ Community node do [n8n](https://n8n.io) para a [WPPAPI](https://wpp-api.com?utm_source=github&utm_medium=n8n) — API WhatsApp gerenciada, com webhooks HMAC e integração nativa com Chatwoot.
4
+
5
+ **Operações:** enviar texto, enviar imagem, enviar arquivo, verificar número, status da sessão.
6
+
7
+ ## Instalação
8
+
9
+ No n8n: **Settings → Community Nodes → Install** e informe `@iproute/n8n-nodes-wppapi`.
10
+
11
+ ## Credenciais
12
+
13
+ Crie uma conta na [WPPAPI](https://app.wpp-api.com/signup?utm_source=github&utm_medium=n8n) (trial de 3 dias, sem cartão), conecte um número via QR Code e copie do painel:
14
+
15
+ - **Base URL**: `https://api.wpp-api.com`
16
+ - **Instance ID**: ID público da instância
17
+ - **Token**: token da instância
18
+
19
+ O node autentica via header `Client-Token` — o token não aparece em URLs nem logs.
20
+
21
+ ## Receber mensagens
22
+
23
+ Use o **Webhook node** nativo do n8n: cadastre a URL de produção no painel da WPPAPI (evento de mensagem recebida). Guia completo: [WhatsApp no n8n](https://wpp-api.com/guias/whatsapp-n8n?utm_source=github&utm_medium=n8n).
24
+
25
+ ## Desenvolvimento
26
+
27
+ ```bash
28
+ npm install
29
+ npm run build
30
+ ```
31
+
32
+ ## Licença
33
+
34
+ MIT © IPRoute Tecnologia
@@ -0,0 +1,9 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class WppApiApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
9
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WppApiApi = void 0;
4
+ class WppApiApi {
5
+ name = 'wppApiApi';
6
+ displayName = 'WPPAPI API';
7
+ documentationUrl = 'https://wpp-api.com/docs?utm_source=n8n&utm_medium=node';
8
+ properties = [
9
+ {
10
+ displayName: 'Base URL',
11
+ name: 'baseUrl',
12
+ type: 'string',
13
+ default: 'https://api.wpp-api.com',
14
+ required: true,
15
+ },
16
+ {
17
+ displayName: 'Instance ID',
18
+ name: 'instanceId',
19
+ type: 'string',
20
+ default: '',
21
+ required: true,
22
+ description: 'ID público da instância (painel WPPAPI)',
23
+ },
24
+ {
25
+ displayName: 'Token',
26
+ name: 'token',
27
+ type: 'string',
28
+ typeOptions: { password: true },
29
+ default: '',
30
+ required: true,
31
+ description: 'Token da instância (painel WPPAPI)',
32
+ },
33
+ ];
34
+ // Token vai no header Client-Token; o path usa "_" no lugar do token.
35
+ authenticate = {
36
+ type: 'generic',
37
+ properties: {
38
+ headers: {
39
+ 'Client-Token': '={{$credentials.token}}',
40
+ },
41
+ },
42
+ };
43
+ test = {
44
+ request: {
45
+ baseURL: '={{$credentials.baseUrl}}',
46
+ url: '=/instances/{{$credentials.instanceId}}/token/_/status',
47
+ },
48
+ };
49
+ }
50
+ exports.WppApiApi = WppApiApi;
@@ -0,0 +1,4 @@
1
+ import type { INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class WppApi implements INodeType {
3
+ description: INodeTypeDescription;
4
+ }
@@ -0,0 +1,212 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WppApi = void 0;
4
+ const BASE_PATH = '=/instances/{{$credentials.instanceId}}/token/_';
5
+ class WppApi {
6
+ description = {
7
+ displayName: 'WPPAPI (WhatsApp)',
8
+ name: 'wppApi',
9
+ icon: 'fa:comments',
10
+ group: ['output'],
11
+ version: 1,
12
+ subtitle: '={{$parameter["operation"]}}',
13
+ description: 'Envia mensagens de WhatsApp pela WPPAPI (wpp-api.com)',
14
+ defaults: {
15
+ name: 'WPPAPI',
16
+ },
17
+ inputs: ['main'],
18
+ outputs: ['main'],
19
+ credentials: [
20
+ {
21
+ name: 'wppApiApi',
22
+ required: true,
23
+ },
24
+ ],
25
+ requestDefaults: {
26
+ baseURL: '={{$credentials.baseUrl}}',
27
+ headers: {
28
+ 'Content-Type': 'application/json',
29
+ },
30
+ },
31
+ properties: [
32
+ {
33
+ displayName: 'Operation',
34
+ name: 'operation',
35
+ type: 'options',
36
+ noDataExpression: true,
37
+ default: 'sendText',
38
+ options: [
39
+ {
40
+ name: 'Enviar Texto',
41
+ value: 'sendText',
42
+ action: 'Enviar mensagem de texto',
43
+ routing: {
44
+ request: {
45
+ method: 'POST',
46
+ url: `${BASE_PATH}/send-text`,
47
+ },
48
+ },
49
+ },
50
+ {
51
+ name: 'Enviar Imagem',
52
+ value: 'sendImage',
53
+ action: 'Enviar imagem',
54
+ routing: {
55
+ request: {
56
+ method: 'POST',
57
+ url: `${BASE_PATH}/send-image`,
58
+ },
59
+ },
60
+ },
61
+ {
62
+ name: 'Enviar Arquivo',
63
+ value: 'sendFile',
64
+ action: 'Enviar arquivo documento',
65
+ routing: {
66
+ request: {
67
+ method: 'POST',
68
+ url: `${BASE_PATH}/send-file`,
69
+ },
70
+ },
71
+ },
72
+ {
73
+ name: 'Verificar Número',
74
+ value: 'checkNumber',
75
+ action: 'Verificar se o número tem whats app',
76
+ routing: {
77
+ request: {
78
+ method: 'GET',
79
+ url: `${BASE_PATH}/check-number`,
80
+ },
81
+ },
82
+ },
83
+ {
84
+ name: 'Status Da Sessão',
85
+ value: 'status',
86
+ action: 'Consultar status da sessão',
87
+ routing: {
88
+ request: {
89
+ method: 'GET',
90
+ url: `${BASE_PATH}/status`,
91
+ },
92
+ },
93
+ },
94
+ ],
95
+ },
96
+ {
97
+ displayName: 'Telefone',
98
+ name: 'phone',
99
+ type: 'string',
100
+ default: '',
101
+ required: true,
102
+ placeholder: '5511999999999',
103
+ description: 'Número no formato DDI + DDD + número, só dígitos',
104
+ displayOptions: {
105
+ show: {
106
+ operation: ['sendText', 'sendImage', 'sendFile'],
107
+ },
108
+ },
109
+ routing: {
110
+ send: {
111
+ type: 'body',
112
+ property: 'phone',
113
+ },
114
+ },
115
+ },
116
+ {
117
+ displayName: 'Telefone',
118
+ name: 'phoneQuery',
119
+ type: 'string',
120
+ default: '',
121
+ required: true,
122
+ placeholder: '5511999999999',
123
+ displayOptions: {
124
+ show: {
125
+ operation: ['checkNumber'],
126
+ },
127
+ },
128
+ routing: {
129
+ send: {
130
+ type: 'query',
131
+ property: 'phone',
132
+ },
133
+ },
134
+ },
135
+ {
136
+ displayName: 'Mensagem',
137
+ name: 'message',
138
+ type: 'string',
139
+ typeOptions: { rows: 3 },
140
+ default: '',
141
+ required: true,
142
+ displayOptions: {
143
+ show: {
144
+ operation: ['sendText'],
145
+ },
146
+ },
147
+ routing: {
148
+ send: {
149
+ type: 'body',
150
+ property: 'message',
151
+ },
152
+ },
153
+ },
154
+ {
155
+ displayName: 'URL Da Imagem',
156
+ name: 'image',
157
+ type: 'string',
158
+ default: '',
159
+ required: true,
160
+ placeholder: 'https://exemplo.com/foto.jpg',
161
+ displayOptions: {
162
+ show: {
163
+ operation: ['sendImage'],
164
+ },
165
+ },
166
+ routing: {
167
+ send: {
168
+ type: 'body',
169
+ property: 'image',
170
+ },
171
+ },
172
+ },
173
+ {
174
+ displayName: 'URL Do Arquivo',
175
+ name: 'document',
176
+ type: 'string',
177
+ default: '',
178
+ required: true,
179
+ placeholder: 'https://exemplo.com/proposta.pdf',
180
+ displayOptions: {
181
+ show: {
182
+ operation: ['sendFile'],
183
+ },
184
+ },
185
+ routing: {
186
+ send: {
187
+ type: 'body',
188
+ property: 'document',
189
+ },
190
+ },
191
+ },
192
+ {
193
+ displayName: 'Legenda',
194
+ name: 'caption',
195
+ type: 'string',
196
+ default: '',
197
+ displayOptions: {
198
+ show: {
199
+ operation: ['sendImage', 'sendFile'],
200
+ },
201
+ },
202
+ routing: {
203
+ send: {
204
+ type: 'body',
205
+ property: 'caption',
206
+ },
207
+ },
208
+ },
209
+ ],
210
+ };
211
+ }
212
+ exports.WppApi = WppApi;
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@iproute/n8n-nodes-wppapi",
3
+ "version": "0.1.0",
4
+ "description": "n8n community node para a WPPAPI — envie WhatsApp (texto, imagem, arquivo) e valide números em fluxos n8n. API gerenciada, trial grátis em wpp-api.com",
5
+ "keywords": [
6
+ "n8n-community-node-package",
7
+ "whatsapp",
8
+ "whatsapp-api",
9
+ "wppapi",
10
+ "automacao",
11
+ "chatbot"
12
+ ],
13
+ "license": "MIT",
14
+ "homepage": "https://wpp-api.com?utm_source=npm&utm_medium=n8n",
15
+ "author": "IPRoute Tecnologia <contato@wpp-api.com>",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/iproute-tecnologia/n8n-nodes-wppapi.git"
19
+ },
20
+ "engines": {
21
+ "node": ">=18.10"
22
+ },
23
+ "main": "index.js",
24
+ "scripts": {
25
+ "build": "tsc",
26
+ "dev": "tsc --watch"
27
+ },
28
+ "files": [
29
+ "dist"
30
+ ],
31
+ "n8n": {
32
+ "n8nNodesApiVersion": 1,
33
+ "credentials": [
34
+ "dist/credentials/WppApiApi.credentials.js"
35
+ ],
36
+ "nodes": [
37
+ "dist/nodes/WppApi/WppApi.node.js"
38
+ ]
39
+ },
40
+ "devDependencies": {
41
+ "n8n-workflow": "^1.82.0",
42
+ "typescript": "^5.6.3"
43
+ },
44
+ "peerDependencies": {
45
+ "n8n-workflow": "*"
46
+ }
47
+ }