n8n-nodes-quepasa-api-yurisilva_pro 2.0.1

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.
Files changed (30) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +599 -0
  3. package/dist/QuePasa/quepasa.svg +4 -0
  4. package/dist/credentials/QuePasaApi.credentials.d.ts +9 -0
  5. package/dist/credentials/QuePasaApi.credentials.js +90 -0
  6. package/dist/nodes/QuePasa/QuePasa.node.d.ts +5 -0
  7. package/dist/nodes/QuePasa/QuePasa.node.js +501 -0
  8. package/dist/nodes/QuePasa/descriptions/ChatDescription.d.ts +3 -0
  9. package/dist/nodes/QuePasa/descriptions/ChatDescription.js +90 -0
  10. package/dist/nodes/QuePasa/descriptions/ContactDescription.d.ts +3 -0
  11. package/dist/nodes/QuePasa/descriptions/ContactDescription.js +103 -0
  12. package/dist/nodes/QuePasa/descriptions/GroupDescription.d.ts +3 -0
  13. package/dist/nodes/QuePasa/descriptions/GroupDescription.js +250 -0
  14. package/dist/nodes/QuePasa/descriptions/MediaDescription.d.ts +3 -0
  15. package/dist/nodes/QuePasa/descriptions/MediaDescription.js +60 -0
  16. package/dist/nodes/QuePasa/descriptions/MessageDescription.d.ts +3 -0
  17. package/dist/nodes/QuePasa/descriptions/MessageDescription.js +286 -0
  18. package/dist/nodes/QuePasa/descriptions/SessionDescription.d.ts +3 -0
  19. package/dist/nodes/QuePasa/descriptions/SessionDescription.js +103 -0
  20. package/dist/nodes/QuePasa/descriptions/StatusDescription.d.ts +3 -0
  21. package/dist/nodes/QuePasa/descriptions/StatusDescription.js +87 -0
  22. package/dist/nodes/QuePasa/descriptions/WebhookDescription.d.ts +3 -0
  23. package/dist/nodes/QuePasa/descriptions/WebhookDescription.js +89 -0
  24. package/dist/tests/GenericFunctions.spec.d.ts +1 -0
  25. package/dist/tests/GenericFunctions.spec.js +38 -0
  26. package/dist/utils/GenericFunctions.d.ts +21 -0
  27. package/dist/utils/GenericFunctions.js +77 -0
  28. package/dist/utils/Validators.d.ts +34 -0
  29. package/dist/utils/Validators.js +75 -0
  30. package/package.json +72 -0
@@ -0,0 +1,286 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.messageFields = exports.messageOperations = void 0;
4
+ exports.messageOperations = [
5
+ {
6
+ displayName: 'Operation',
7
+ name: 'operation',
8
+ type: 'options',
9
+ noDataExpression: true,
10
+ displayOptions: {
11
+ show: {
12
+ resource: ['message'],
13
+ },
14
+ },
15
+ options: [
16
+ {
17
+ name: 'Send Text',
18
+ value: 'sendText',
19
+ description: 'Send a text message',
20
+ action: 'Send text message',
21
+ },
22
+ {
23
+ name: 'Send Media',
24
+ value: 'sendMedia',
25
+ description: 'Send media (image, video, audio, document)',
26
+ action: 'Send media message',
27
+ },
28
+ {
29
+ name: 'Send From URL',
30
+ value: 'sendFromUrl',
31
+ description: 'Send media from URL',
32
+ action: 'Send media from URL',
33
+ },
34
+ {
35
+ name: 'Revoke Message',
36
+ value: 'revokeMessage',
37
+ description: 'Delete/revoke a sent message',
38
+ action: 'Revoke message',
39
+ },
40
+ {
41
+ name: 'React to Message',
42
+ value: 'reactToMessage',
43
+ description: 'React to a message with emoji',
44
+ action: 'React to message',
45
+ },
46
+ {
47
+ name: 'Forward Message',
48
+ value: 'forwardMessage',
49
+ description: 'Forward a message to another chat',
50
+ action: 'Forward message',
51
+ },
52
+ {
53
+ name: 'Get History',
54
+ value: 'getHistory',
55
+ description: 'Get message history from a chat',
56
+ action: 'Get message history',
57
+ },
58
+ ],
59
+ default: 'sendText',
60
+ },
61
+ ];
62
+ exports.messageFields = [
63
+ // Common fields
64
+ {
65
+ displayName: 'Chat ID',
66
+ name: 'chatId',
67
+ type: 'string',
68
+ required: true,
69
+ displayOptions: {
70
+ show: {
71
+ resource: ['message'],
72
+ operation: ['sendText', 'sendMedia', 'sendFromUrl'],
73
+ },
74
+ },
75
+ default: '',
76
+ placeholder: '5511999999999 or 5511999999999@s.whatsapp.net',
77
+ description: 'Phone number or chat ID',
78
+ },
79
+ // Send Text
80
+ {
81
+ displayName: 'Message',
82
+ name: 'text',
83
+ type: 'string',
84
+ required: true,
85
+ typeOptions: {
86
+ rows: 4,
87
+ },
88
+ displayOptions: {
89
+ show: {
90
+ resource: ['message'],
91
+ operation: ['sendText'],
92
+ },
93
+ },
94
+ default: '',
95
+ description: 'Text message to send',
96
+ },
97
+ // Send Media
98
+ {
99
+ displayName: 'Media Type',
100
+ name: 'mediaType',
101
+ type: 'options',
102
+ displayOptions: {
103
+ show: {
104
+ resource: ['message'],
105
+ operation: ['sendMedia'],
106
+ },
107
+ },
108
+ options: [
109
+ { name: 'Image', value: 'image' },
110
+ { name: 'Video', value: 'video' },
111
+ { name: 'Audio', value: 'audio' },
112
+ { name: 'Document', value: 'document' },
113
+ ],
114
+ default: 'image',
115
+ description: 'Type of media to send',
116
+ },
117
+ {
118
+ displayName: 'Binary Property',
119
+ name: 'binaryProperty',
120
+ type: 'string',
121
+ required: true,
122
+ displayOptions: {
123
+ show: {
124
+ resource: ['message'],
125
+ operation: ['sendMedia'],
126
+ },
127
+ },
128
+ default: 'data',
129
+ description: 'Name of the binary property containing the file',
130
+ },
131
+ {
132
+ displayName: 'Caption',
133
+ name: 'caption',
134
+ type: 'string',
135
+ displayOptions: {
136
+ show: {
137
+ resource: ['message'],
138
+ operation: ['sendMedia', 'sendFromUrl'],
139
+ },
140
+ },
141
+ default: '',
142
+ description: 'Optional caption for the media',
143
+ },
144
+ // Send from URL
145
+ {
146
+ displayName: 'Media URL',
147
+ name: 'url',
148
+ type: 'string',
149
+ required: true,
150
+ displayOptions: {
151
+ show: {
152
+ resource: ['message'],
153
+ operation: ['sendFromUrl'],
154
+ },
155
+ },
156
+ default: '',
157
+ placeholder: 'https://example.com/image.jpg',
158
+ description: 'Direct URL to the media file',
159
+ },
160
+ {
161
+ displayName: 'Filename',
162
+ name: 'filename',
163
+ type: 'string',
164
+ displayOptions: {
165
+ show: {
166
+ resource: ['message'],
167
+ operation: ['sendFromUrl'],
168
+ },
169
+ },
170
+ default: '',
171
+ description: 'Custom filename (optional)',
172
+ },
173
+ // Revoke Message
174
+ {
175
+ displayName: 'Message ID',
176
+ name: 'messageId',
177
+ type: 'string',
178
+ required: true,
179
+ displayOptions: {
180
+ show: {
181
+ resource: ['message'],
182
+ operation: ['revokeMessage'],
183
+ },
184
+ },
185
+ default: '',
186
+ description: 'ID of the message to revoke',
187
+ },
188
+ // React to Message
189
+ {
190
+ displayName: 'Message ID',
191
+ name: 'messageId',
192
+ type: 'string',
193
+ required: true,
194
+ displayOptions: {
195
+ show: {
196
+ resource: ['message'],
197
+ operation: ['reactToMessage', 'forwardMessage'],
198
+ },
199
+ },
200
+ default: '',
201
+ description: 'ID of the message',
202
+ },
203
+ {
204
+ displayName: 'Emoji',
205
+ name: 'emoji',
206
+ type: 'string',
207
+ required: true,
208
+ displayOptions: {
209
+ show: {
210
+ resource: ['message'],
211
+ operation: ['reactToMessage'],
212
+ },
213
+ },
214
+ default: '👍',
215
+ placeholder: '👍 or ❤️ or 😂',
216
+ description: 'Emoji to react with',
217
+ },
218
+ // Forward Message
219
+ {
220
+ displayName: 'To Chat ID',
221
+ name: 'toChatId',
222
+ type: 'string',
223
+ required: true,
224
+ displayOptions: {
225
+ show: {
226
+ resource: ['message'],
227
+ operation: ['forwardMessage'],
228
+ },
229
+ },
230
+ default: '',
231
+ placeholder: '5511999999999@s.whatsapp.net',
232
+ description: 'Chat ID to forward the message to',
233
+ },
234
+ // Get History
235
+ {
236
+ displayName: 'Chat ID',
237
+ name: 'chatId',
238
+ type: 'string',
239
+ required: true,
240
+ displayOptions: {
241
+ show: {
242
+ resource: ['message'],
243
+ operation: ['getHistory'],
244
+ },
245
+ },
246
+ default: '',
247
+ placeholder: '5511999999999@s.whatsapp.net',
248
+ description: 'Chat ID to get history from',
249
+ },
250
+ {
251
+ displayName: 'Limit',
252
+ name: 'limit',
253
+ type: 'number',
254
+ displayOptions: {
255
+ show: {
256
+ resource: ['message'],
257
+ operation: ['getHistory'],
258
+ },
259
+ },
260
+ default: 50,
261
+ description: 'Number of messages to retrieve (max 100)',
262
+ },
263
+ // Additional Options
264
+ {
265
+ displayName: 'Additional Options',
266
+ name: 'additionalOptions',
267
+ type: 'collection',
268
+ placeholder: 'Add Option',
269
+ default: {},
270
+ displayOptions: {
271
+ show: {
272
+ resource: ['message'],
273
+ operation: ['sendText', 'sendMedia', 'sendFromUrl'],
274
+ },
275
+ },
276
+ options: [
277
+ {
278
+ displayName: 'Track ID',
279
+ name: 'trackId',
280
+ type: 'string',
281
+ default: '',
282
+ description: 'Custom tracking ID',
283
+ },
284
+ ],
285
+ },
286
+ ];
@@ -0,0 +1,3 @@
1
+ import { INodeProperties } from 'n8n-workflow';
2
+ export declare const sessionOperations: INodeProperties[];
3
+ export declare const sessionFields: INodeProperties[];
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sessionFields = exports.sessionOperations = void 0;
4
+ exports.sessionOperations = [
5
+ {
6
+ displayName: 'Operation',
7
+ name: 'operation',
8
+ type: 'options',
9
+ noDataExpression: true,
10
+ displayOptions: {
11
+ show: {
12
+ resource: ['session'],
13
+ },
14
+ },
15
+ options: [
16
+ {
17
+ name: 'Get QR Code',
18
+ value: 'getQrCode',
19
+ description: 'Generate QR Code for WhatsApp authentication',
20
+ action: 'Get qr code',
21
+ },
22
+ {
23
+ name: 'Check Status',
24
+ value: 'checkStatus',
25
+ description: 'Check WhatsApp session status',
26
+ action: 'Check session status',
27
+ },
28
+ {
29
+ name: 'Get Info',
30
+ value: 'getInfo',
31
+ description: 'Get account information',
32
+ action: 'Get account info',
33
+ },
34
+ {
35
+ name: 'Disconnect',
36
+ value: 'disconnect',
37
+ description: 'Disconnect WhatsApp session',
38
+ action: 'Disconnect session',
39
+ },
40
+ ],
41
+ default: 'checkStatus',
42
+ },
43
+ ];
44
+ exports.sessionFields = [
45
+ // Get QR Code
46
+ {
47
+ displayName: 'User ID',
48
+ name: 'userId',
49
+ type: 'string',
50
+ required: true,
51
+ displayOptions: {
52
+ show: {
53
+ resource: ['session'],
54
+ operation: ['getQrCode'],
55
+ },
56
+ },
57
+ default: '',
58
+ placeholder: 'admin',
59
+ description: 'User ID to manage this connection',
60
+ },
61
+ {
62
+ displayName: 'Token',
63
+ name: 'token',
64
+ type: 'string',
65
+ typeOptions: { password: true },
66
+ displayOptions: {
67
+ show: {
68
+ resource: ['session'],
69
+ operation: ['getQrCode'],
70
+ },
71
+ },
72
+ default: '',
73
+ description: 'Leave empty to generate a new token',
74
+ },
75
+ {
76
+ displayName: 'Return QR as Image',
77
+ name: 'returnAsImage',
78
+ type: 'boolean',
79
+ displayOptions: {
80
+ show: {
81
+ resource: ['session'],
82
+ operation: ['getQrCode'],
83
+ },
84
+ },
85
+ default: true,
86
+ description: 'Whether to return QR Code as binary image data',
87
+ },
88
+ // Disconnect
89
+ {
90
+ displayName: 'Confirmation',
91
+ name: 'confirmation',
92
+ type: 'boolean',
93
+ required: true,
94
+ displayOptions: {
95
+ show: {
96
+ resource: ['session'],
97
+ operation: ['disconnect'],
98
+ },
99
+ },
100
+ default: false,
101
+ description: 'Whether you confirm disconnecting this session',
102
+ },
103
+ ];
@@ -0,0 +1,3 @@
1
+ import { INodeProperties } from 'n8n-workflow';
2
+ export declare const statusOperations: INodeProperties[];
3
+ export declare const statusFields: INodeProperties[];
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.statusFields = exports.statusOperations = void 0;
4
+ exports.statusOperations = [
5
+ {
6
+ displayName: 'Operation',
7
+ name: 'operation',
8
+ type: 'options',
9
+ noDataExpression: true,
10
+ displayOptions: {
11
+ show: {
12
+ resource: ['status'],
13
+ },
14
+ },
15
+ options: [
16
+ {
17
+ name: 'Update Presence',
18
+ value: 'updatePresence',
19
+ description: 'Update presence (online/offline)',
20
+ action: 'Update presence',
21
+ },
22
+ {
23
+ name: 'Update Status',
24
+ value: 'updateStatus',
25
+ description: 'Update WhatsApp status/about',
26
+ action: 'Update status',
27
+ },
28
+ {
29
+ name: 'Get Contact Status',
30
+ value: 'getContactStatus',
31
+ description: 'Get contact status/about',
32
+ action: 'Get contact status',
33
+ },
34
+ ],
35
+ default: 'updatePresence',
36
+ },
37
+ ];
38
+ exports.statusFields = [
39
+ {
40
+ displayName: 'Presence',
41
+ name: 'presence',
42
+ type: 'options',
43
+ required: true,
44
+ displayOptions: {
45
+ show: {
46
+ resource: ['status'],
47
+ operation: ['updatePresence'],
48
+ },
49
+ },
50
+ options: [
51
+ { name: 'Available (Online)', value: 'available' },
52
+ { name: 'Unavailable (Offline)', value: 'unavailable' },
53
+ ],
54
+ default: 'available',
55
+ description: 'Presence status to set',
56
+ },
57
+ {
58
+ displayName: 'Status Text',
59
+ name: 'statusText',
60
+ type: 'string',
61
+ required: true,
62
+ displayOptions: {
63
+ show: {
64
+ resource: ['status'],
65
+ operation: ['updateStatus'],
66
+ },
67
+ },
68
+ default: '',
69
+ placeholder: 'Available',
70
+ description: 'Status/about text to set',
71
+ },
72
+ {
73
+ displayName: 'Contact ID',
74
+ name: 'contactId',
75
+ type: 'string',
76
+ required: true,
77
+ displayOptions: {
78
+ show: {
79
+ resource: ['status'],
80
+ operation: ['getContactStatus'],
81
+ },
82
+ },
83
+ default: '',
84
+ placeholder: '5511999999999@s.whatsapp.net',
85
+ description: 'Contact ID to get status from',
86
+ },
87
+ ];
@@ -0,0 +1,3 @@
1
+ import { INodeProperties } from 'n8n-workflow';
2
+ export declare const webhookOperations: INodeProperties[];
3
+ export declare const webhookFields: INodeProperties[];
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webhookFields = exports.webhookOperations = void 0;
4
+ exports.webhookOperations = [
5
+ {
6
+ displayName: 'Operation',
7
+ name: 'operation',
8
+ type: 'options',
9
+ noDataExpression: true,
10
+ displayOptions: {
11
+ show: {
12
+ resource: ['webhook'],
13
+ },
14
+ },
15
+ options: [
16
+ {
17
+ name: 'Set Webhook',
18
+ value: 'setWebhook',
19
+ description: 'Configure webhook URL',
20
+ action: 'Set webhook',
21
+ },
22
+ {
23
+ name: 'Get Webhook',
24
+ value: 'getWebhook',
25
+ description: 'Get current webhook configuration',
26
+ action: 'Get webhook',
27
+ },
28
+ {
29
+ name: 'Delete Webhook',
30
+ value: 'deleteWebhook',
31
+ description: 'Remove webhook configuration',
32
+ action: 'Delete webhook',
33
+ },
34
+ {
35
+ name: 'Update Webhook',
36
+ value: 'updateWebhook',
37
+ description: 'Update webhook configuration',
38
+ action: 'Update webhook',
39
+ },
40
+ ],
41
+ default: 'setWebhook',
42
+ },
43
+ ];
44
+ exports.webhookFields = [
45
+ {
46
+ displayName: 'Webhook URL',
47
+ name: 'url',
48
+ type: 'string',
49
+ required: true,
50
+ displayOptions: {
51
+ show: {
52
+ resource: ['webhook'],
53
+ operation: ['setWebhook', 'updateWebhook'],
54
+ },
55
+ },
56
+ default: '',
57
+ placeholder: 'https://webhook.example.com/events',
58
+ description: 'URL to receive webhook events',
59
+ },
60
+ {
61
+ displayName: 'Additional Options',
62
+ name: 'additionalOptions',
63
+ type: 'collection',
64
+ placeholder: 'Add Option',
65
+ default: {},
66
+ displayOptions: {
67
+ show: {
68
+ resource: ['webhook'],
69
+ operation: ['setWebhook', 'updateWebhook'],
70
+ },
71
+ },
72
+ options: [
73
+ {
74
+ displayName: 'Forward Internal',
75
+ name: 'forwardinternal',
76
+ type: 'boolean',
77
+ default: true,
78
+ description: 'Whether to forward internal events',
79
+ },
80
+ {
81
+ displayName: 'Track ID',
82
+ name: 'trackid',
83
+ type: 'string',
84
+ default: '',
85
+ description: 'Custom tracking ID',
86
+ },
87
+ ],
88
+ },
89
+ ];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const GenericFunctions_1 = require("../utils/GenericFunctions");
4
+ describe('GenericFunctions', () => {
5
+ describe('formatPhoneNumber', () => {
6
+ it('should format phone number correctly', () => {
7
+ const result = (0, GenericFunctions_1.formatPhoneNumber)('5511999999999');
8
+ expect(result).toBe('5511999999999@s.whatsapp.net');
9
+ });
10
+ it('should format group ID correctly', () => {
11
+ const result = (0, GenericFunctions_1.formatPhoneNumber)('123456789', true);
12
+ expect(result).toBe('123456789@g.us');
13
+ });
14
+ it('should not modify already formatted number', () => {
15
+ const input = '5511999999999@s.whatsapp.net';
16
+ const result = (0, GenericFunctions_1.formatPhoneNumber)(input);
17
+ expect(result).toBe(input);
18
+ });
19
+ it('should remove non-numeric characters', () => {
20
+ const result = (0, GenericFunctions_1.formatPhoneNumber)('(55) 11 99999-9999');
21
+ expect(result).toBe('5511999999999@s.whatsapp.net');
22
+ });
23
+ });
24
+ describe('validateChatId', () => {
25
+ it('should throw error for empty chat ID', () => {
26
+ expect(() => (0, GenericFunctions_1.validateChatId)('')).toThrow('Chat ID is required');
27
+ });
28
+ it('should throw error for invalid format', () => {
29
+ expect(() => (0, GenericFunctions_1.validateChatId)('5511999999999')).toThrow('Invalid Chat ID format');
30
+ });
31
+ it('should pass for valid chat ID', () => {
32
+ expect(() => (0, GenericFunctions_1.validateChatId)('5511999999999@s.whatsapp.net')).not.toThrow();
33
+ });
34
+ it('should pass for valid group ID', () => {
35
+ expect(() => (0, GenericFunctions_1.validateChatId)('123456789@g.us')).not.toThrow();
36
+ });
37
+ });
38
+ });
@@ -0,0 +1,21 @@
1
+ import { IExecuteFunctions, IHttpRequestMethods, IDataObject } from 'n8n-workflow';
2
+ /**
3
+ * Faz requisição HTTP para API QuePasa
4
+ */
5
+ export declare function quePasaApiRequest(this: IExecuteFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject, option?: IDataObject): Promise<any>;
6
+ /**
7
+ * Formata número de telefone para formato WhatsApp
8
+ */
9
+ export declare function formatPhoneNumber(phone: string, isGroup?: boolean): string;
10
+ /**
11
+ * Valida formato de Chat ID
12
+ */
13
+ export declare function validateChatId(chatId: string): void;
14
+ /**
15
+ * Extrai dados binários do n8n
16
+ */
17
+ export declare function getBinaryData(this: IExecuteFunctions, itemIndex: number, propertyName: string): Promise<Buffer>;
18
+ /**
19
+ * Converte Buffer para base64
20
+ */
21
+ export declare function bufferToBase64(buffer: Buffer, mimetype: string): string;