n8n-nodes-whaapy 0.3.1 → 0.3.3

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.
@@ -17,10 +17,6 @@ function slugify(text) {
17
17
  }
18
18
  // Build interactive message payload from structured fields
19
19
  function buildInteractivePayload(params) {
20
- // If using raw JSON, return it directly
21
- if (params.useRawJson && params.rawJson) {
22
- return params.rawJson;
23
- }
24
20
  const interactive = {
25
21
  type: params.interactiveType,
26
22
  body: {
@@ -98,13 +94,6 @@ class Whaapy {
98
94
  required: true,
99
95
  },
100
96
  ],
101
- requestDefaults: {
102
- baseURL: '={{$credentials.baseUrl}}',
103
- headers: {
104
- Accept: 'application/json',
105
- 'Content-Type': 'application/json',
106
- },
107
- },
108
97
  properties: [
109
98
  // ===========================================
110
99
  // RESOURCE SELECTOR
@@ -325,7 +314,7 @@ class Whaapy {
325
314
  default: 'button',
326
315
  description: 'Type of interactive message. Buttons show up to 3 options, Lists show a menu with sections.',
327
316
  displayOptions: {
328
- show: { resource: ['message'], operation: ['send'], messageType: ['interactive'], interactiveUseRawJson: [false] },
317
+ show: { resource: ['message'], operation: ['send'], messageType: ['interactive'] },
329
318
  },
330
319
  },
331
320
  // Interactive: Body text (required)
@@ -339,7 +328,7 @@ class Whaapy {
339
328
  placeholder: '¿Cómo podemos ayudarte hoy?',
340
329
  description: 'Main text of the message. Max 1024 characters.',
341
330
  displayOptions: {
342
- show: { resource: ['message'], operation: ['send'], messageType: ['interactive'], interactiveUseRawJson: [false] },
331
+ show: { resource: ['message'], operation: ['send'], messageType: ['interactive'] },
343
332
  },
344
333
  },
345
334
  // Interactive: Header type (optional)
@@ -357,7 +346,7 @@ class Whaapy {
357
346
  ],
358
347
  description: 'Optional header for the message',
359
348
  displayOptions: {
360
- show: { resource: ['message'], operation: ['send'], messageType: ['interactive'], interactiveUseRawJson: [false] },
349
+ show: { resource: ['message'], operation: ['send'], messageType: ['interactive'] },
361
350
  },
362
351
  },
363
352
  // Interactive: Header text (if type=text)
@@ -374,7 +363,6 @@ class Whaapy {
374
363
  operation: ['send'],
375
364
  messageType: ['interactive'],
376
365
  interactiveHeaderType: ['text'],
377
- interactiveUseRawJson: [false],
378
366
  },
379
367
  },
380
368
  },
@@ -392,7 +380,6 @@ class Whaapy {
392
380
  operation: ['send'],
393
381
  messageType: ['interactive'],
394
382
  interactiveHeaderType: ['image', 'video', 'document'],
395
- interactiveUseRawJson: [false],
396
383
  },
397
384
  },
398
385
  },
@@ -405,7 +392,7 @@ class Whaapy {
405
392
  placeholder: 'Responde con una opción',
406
393
  description: 'Optional footer text in gray. Max 60 characters. Leave empty to omit.',
407
394
  displayOptions: {
408
- show: { resource: ['message'], operation: ['send'], messageType: ['interactive'], interactiveUseRawJson: [false] },
395
+ show: { resource: ['message'], operation: ['send'], messageType: ['interactive'] },
409
396
  },
410
397
  },
411
398
  // Interactive: Buttons (if type=button)
@@ -425,7 +412,6 @@ class Whaapy {
425
412
  operation: ['send'],
426
413
  messageType: ['interactive'],
427
414
  interactiveType: ['button'],
428
- interactiveUseRawJson: [false],
429
415
  },
430
416
  },
431
417
  options: [
@@ -469,7 +455,6 @@ class Whaapy {
469
455
  operation: ['send'],
470
456
  messageType: ['interactive'],
471
457
  interactiveType: ['list'],
472
- interactiveUseRawJson: [false],
473
458
  },
474
459
  },
475
460
  },
@@ -490,7 +475,6 @@ class Whaapy {
490
475
  operation: ['send'],
491
476
  messageType: ['interactive'],
492
477
  interactiveType: ['list'],
493
- interactiveUseRawJson: [false],
494
478
  },
495
479
  },
496
480
  options: [
@@ -554,32 +538,6 @@ class Whaapy {
554
538
  },
555
539
  ],
556
540
  },
557
- // Interactive: Advanced JSON (fallback for complex cases)
558
- {
559
- displayName: 'Use Raw JSON',
560
- name: 'interactiveUseRawJson',
561
- type: 'boolean',
562
- default: false,
563
- description: 'Use raw JSON instead of structured fields (for advanced use cases)',
564
- displayOptions: {
565
- show: { resource: ['message'], operation: ['send'], messageType: ['interactive'] },
566
- },
567
- },
568
- {
569
- displayName: 'Interactive JSON',
570
- name: 'interactiveRawJson',
571
- type: 'json',
572
- default: '{}',
573
- description: 'Raw interactive content JSON. See docs.whaapy.com for structure.',
574
- displayOptions: {
575
- show: {
576
- resource: ['message'],
577
- operation: ['send'],
578
- messageType: ['interactive'],
579
- interactiveUseRawJson: [true],
580
- },
581
- },
582
- },
583
541
  // Message: Send - Location
584
542
  {
585
543
  displayName: 'Latitude',
@@ -1720,52 +1678,45 @@ class Whaapy {
1720
1678
  }
1721
1679
  else if (messageType === 'interactive') {
1722
1680
  // Build interactive message from structured fields
1723
- const useRawJson = this.getNodeParameter('interactiveUseRawJson', i, false);
1724
- if (useRawJson) {
1725
- const rawJson = this.getNodeParameter('interactiveRawJson', i, '{}');
1726
- body.interactive = typeof rawJson === 'string' ? JSON.parse(rawJson) : rawJson;
1681
+ const interactiveType = this.getNodeParameter('interactiveType', i);
1682
+ const bodyText = this.getNodeParameter('interactiveBodyText', i);
1683
+ const headerType = this.getNodeParameter('interactiveHeaderType', i, 'none');
1684
+ const headerText = this.getNodeParameter('interactiveHeaderText', i, '');
1685
+ const headerMediaUrl = this.getNodeParameter('interactiveHeaderMediaUrl', i, '');
1686
+ const footerText = this.getNodeParameter('interactiveFooterText', i, '');
1687
+ // Build buttons array
1688
+ let buttons = [];
1689
+ if (interactiveType === 'button') {
1690
+ const buttonsData = this.getNodeParameter('interactiveButtons', i, { buttonValues: [] });
1691
+ buttons = buttonsData.buttonValues || [];
1727
1692
  }
1728
- else {
1729
- const interactiveType = this.getNodeParameter('interactiveType', i);
1730
- const bodyText = this.getNodeParameter('interactiveBodyText', i);
1731
- const headerType = this.getNodeParameter('interactiveHeaderType', i, 'none');
1732
- const headerText = this.getNodeParameter('interactiveHeaderText', i, '');
1733
- const headerMediaUrl = this.getNodeParameter('interactiveHeaderMediaUrl', i, '');
1734
- const footerText = this.getNodeParameter('interactiveFooterText', i, '');
1735
- // Build buttons array
1736
- let buttons = [];
1737
- if (interactiveType === 'button') {
1738
- const buttonsData = this.getNodeParameter('interactiveButtons', i, { buttonValues: [] });
1739
- buttons = buttonsData.buttonValues || [];
1740
- }
1741
- // Build sections array
1742
- let sections = [];
1743
- let listButtonText = '';
1744
- if (interactiveType === 'list') {
1745
- listButtonText = this.getNodeParameter('interactiveListButtonText', i, 'Ver Opciones');
1746
- const sectionsData = this.getNodeParameter('interactiveSections', i, { sectionValues: [] });
1747
- if (sectionsData.sectionValues) {
1748
- sections = sectionsData.sectionValues.map((section) => {
1749
- var _a;
1750
- return ({
1751
- title: section.title,
1752
- rows: ((_a = section.rows) === null || _a === void 0 ? void 0 : _a.rowValues) || [],
1753
- });
1693
+ // Build sections array
1694
+ let sections = [];
1695
+ let listButtonText = '';
1696
+ if (interactiveType === 'list') {
1697
+ listButtonText = this.getNodeParameter('interactiveListButtonText', i, 'Ver Opciones');
1698
+ const sectionsData = this.getNodeParameter('interactiveSections', i, { sectionValues: [] });
1699
+ if (sectionsData.sectionValues) {
1700
+ sections = sectionsData.sectionValues.map((section) => {
1701
+ var _a;
1702
+ return ({
1703
+ title: section.title,
1704
+ rows: ((_a = section.rows) === null || _a === void 0 ? void 0 : _a.rowValues) || [],
1754
1705
  });
1755
- }
1706
+ });
1756
1707
  }
1757
- body.interactive = buildInteractivePayload({
1758
- interactiveType,
1759
- bodyText,
1760
- headerType,
1761
- headerText,
1762
- headerMediaUrl,
1763
- footerText,
1764
- buttons,
1765
- listButtonText,
1766
- sections,
1767
- });
1768
1708
  }
1709
+ body.interactive = buildInteractivePayload({
1710
+ interactiveType,
1711
+ bodyText,
1712
+ headerType,
1713
+ headerText,
1714
+ headerMediaUrl,
1715
+ footerText,
1716
+ buttons,
1717
+ listButtonText,
1718
+ sections,
1719
+ });
1769
1720
  }
1770
1721
  else if (messageType === 'location') {
1771
1722
  body.location = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-whaapy",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "n8n community node for Whaapy - WhatsApp Business API with AI",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",