n8n-nodes-whaapy 0.3.4 → 0.3.6
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.
|
@@ -71,6 +71,15 @@ function buildInteractivePayload(params) {
|
|
|
71
71
|
})),
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
+
else if (params.interactiveType === 'cta_url' && params.ctaButtonText && params.ctaButtonUrl) {
|
|
75
|
+
interactive.action = {
|
|
76
|
+
name: 'cta_url',
|
|
77
|
+
parameters: {
|
|
78
|
+
display_text: params.ctaButtonText.substring(0, 20),
|
|
79
|
+
url: params.ctaButtonUrl,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
74
83
|
return interactive;
|
|
75
84
|
}
|
|
76
85
|
class Whaapy {
|
|
@@ -301,7 +310,7 @@ class Whaapy {
|
|
|
301
310
|
// ===========================================
|
|
302
311
|
// INTERACTIVE MESSAGE FIELDS (Structured)
|
|
303
312
|
// ===========================================
|
|
304
|
-
// Interactive: Type selector (button or
|
|
313
|
+
// Interactive: Type selector (button, list, or cta_url)
|
|
305
314
|
{
|
|
306
315
|
displayName: 'Interactive Type',
|
|
307
316
|
name: 'interactiveType',
|
|
@@ -310,9 +319,10 @@ class Whaapy {
|
|
|
310
319
|
options: [
|
|
311
320
|
{ name: 'Buttons (Reply Buttons)', value: 'button' },
|
|
312
321
|
{ name: 'List (Menu)', value: 'list' },
|
|
322
|
+
{ name: 'CTA URL (Link Button)', value: 'cta_url' },
|
|
313
323
|
],
|
|
314
324
|
default: 'button',
|
|
315
|
-
description: 'Type of interactive message. Buttons
|
|
325
|
+
description: 'Type of interactive message. Buttons: up to 3 reply options. List: menu with sections. CTA URL: single button that opens a URL.',
|
|
316
326
|
displayOptions: {
|
|
317
327
|
show: { resource: ['message'], operation: ['send'], messageType: ['interactive'] },
|
|
318
328
|
},
|
|
@@ -538,6 +548,42 @@ class Whaapy {
|
|
|
538
548
|
},
|
|
539
549
|
],
|
|
540
550
|
},
|
|
551
|
+
// Interactive: CTA URL Button Text (if type=cta_url)
|
|
552
|
+
{
|
|
553
|
+
displayName: 'Button Text',
|
|
554
|
+
name: 'ctaButtonText',
|
|
555
|
+
type: 'string',
|
|
556
|
+
required: true,
|
|
557
|
+
default: '',
|
|
558
|
+
placeholder: 'Ver Sitio Web',
|
|
559
|
+
description: 'Text displayed on the button. Max 20 characters.',
|
|
560
|
+
displayOptions: {
|
|
561
|
+
show: {
|
|
562
|
+
resource: ['message'],
|
|
563
|
+
operation: ['send'],
|
|
564
|
+
messageType: ['interactive'],
|
|
565
|
+
interactiveType: ['cta_url'],
|
|
566
|
+
},
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
// Interactive: CTA URL Button URL (if type=cta_url)
|
|
570
|
+
{
|
|
571
|
+
displayName: 'Button URL',
|
|
572
|
+
name: 'ctaButtonUrl',
|
|
573
|
+
type: 'string',
|
|
574
|
+
required: true,
|
|
575
|
+
default: '',
|
|
576
|
+
placeholder: 'https://example.com/page',
|
|
577
|
+
description: 'URL that opens when the user taps the button.',
|
|
578
|
+
displayOptions: {
|
|
579
|
+
show: {
|
|
580
|
+
resource: ['message'],
|
|
581
|
+
operation: ['send'],
|
|
582
|
+
messageType: ['interactive'],
|
|
583
|
+
interactiveType: ['cta_url'],
|
|
584
|
+
},
|
|
585
|
+
},
|
|
586
|
+
},
|
|
541
587
|
// Message: Send - Location
|
|
542
588
|
{
|
|
543
589
|
displayName: 'Latitude',
|
|
@@ -564,6 +610,17 @@ class Whaapy {
|
|
|
564
610
|
name: 'locationName',
|
|
565
611
|
type: 'string',
|
|
566
612
|
default: '',
|
|
613
|
+
description: 'Name of the location (e.g., "Starbucks Centro")',
|
|
614
|
+
displayOptions: {
|
|
615
|
+
show: { resource: ['message'], operation: ['send'], messageType: ['location'] },
|
|
616
|
+
}
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
displayName: 'Address',
|
|
620
|
+
name: 'locationAddress',
|
|
621
|
+
type: 'string',
|
|
622
|
+
default: '',
|
|
623
|
+
description: 'Address of the location (e.g., "Av. Reforma 123, CDMX")',
|
|
567
624
|
displayOptions: {
|
|
568
625
|
show: { resource: ['message'], operation: ['send'], messageType: ['location'] },
|
|
569
626
|
}
|
|
@@ -1713,6 +1770,13 @@ class Whaapy {
|
|
|
1713
1770
|
});
|
|
1714
1771
|
}
|
|
1715
1772
|
}
|
|
1773
|
+
// CTA URL button
|
|
1774
|
+
let ctaButtonText = '';
|
|
1775
|
+
let ctaButtonUrl = '';
|
|
1776
|
+
if (interactiveType === 'cta_url') {
|
|
1777
|
+
ctaButtonText = this.getNodeParameter('ctaButtonText', i, '');
|
|
1778
|
+
ctaButtonUrl = this.getNodeParameter('ctaButtonUrl', i, '');
|
|
1779
|
+
}
|
|
1716
1780
|
body.interactive = buildInteractivePayload({
|
|
1717
1781
|
interactiveType,
|
|
1718
1782
|
bodyText,
|
|
@@ -1723,13 +1787,18 @@ class Whaapy {
|
|
|
1723
1787
|
buttons,
|
|
1724
1788
|
listButtonText,
|
|
1725
1789
|
sections,
|
|
1790
|
+
ctaButtonText,
|
|
1791
|
+
ctaButtonUrl,
|
|
1726
1792
|
});
|
|
1727
1793
|
}
|
|
1728
1794
|
else if (messageType === 'location') {
|
|
1795
|
+
const locationName = this.getNodeParameter('locationName', i, '');
|
|
1796
|
+
const locationAddress = this.getNodeParameter('locationAddress', i, '');
|
|
1729
1797
|
body.location = {
|
|
1730
1798
|
latitude: this.getNodeParameter('latitude', i),
|
|
1731
1799
|
longitude: this.getNodeParameter('longitude', i),
|
|
1732
|
-
name:
|
|
1800
|
+
name: locationName || undefined,
|
|
1801
|
+
address: locationAddress || undefined,
|
|
1733
1802
|
};
|
|
1734
1803
|
}
|
|
1735
1804
|
else if (messageType === 'contacts') {
|