n8n-nodes-whaapy 0.3.3 → 0.3.5
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.
|
@@ -564,6 +564,17 @@ class Whaapy {
|
|
|
564
564
|
name: 'locationName',
|
|
565
565
|
type: 'string',
|
|
566
566
|
default: '',
|
|
567
|
+
description: 'Name of the location (e.g., "Starbucks Centro")',
|
|
568
|
+
displayOptions: {
|
|
569
|
+
show: { resource: ['message'], operation: ['send'], messageType: ['location'] },
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
displayName: 'Address',
|
|
574
|
+
name: 'locationAddress',
|
|
575
|
+
type: 'string',
|
|
576
|
+
default: '',
|
|
577
|
+
description: 'Address of the location (e.g., "Av. Reforma 123, CDMX")',
|
|
567
578
|
displayOptions: {
|
|
568
579
|
show: { resource: ['message'], operation: ['send'], messageType: ['location'] },
|
|
569
580
|
}
|
|
@@ -1248,6 +1259,13 @@ class Whaapy {
|
|
|
1248
1259
|
default: '',
|
|
1249
1260
|
description: 'Comma-separated list of tags'
|
|
1250
1261
|
},
|
|
1262
|
+
{
|
|
1263
|
+
displayName: 'Funnel Stage ID',
|
|
1264
|
+
name: 'funnelStageId',
|
|
1265
|
+
type: 'string',
|
|
1266
|
+
default: '',
|
|
1267
|
+
description: 'ID of the funnel stage to assign the contact to'
|
|
1268
|
+
},
|
|
1251
1269
|
{
|
|
1252
1270
|
displayName: 'Custom Fields',
|
|
1253
1271
|
name: 'customFields',
|
|
@@ -1719,10 +1737,13 @@ class Whaapy {
|
|
|
1719
1737
|
});
|
|
1720
1738
|
}
|
|
1721
1739
|
else if (messageType === 'location') {
|
|
1740
|
+
const locationName = this.getNodeParameter('locationName', i, '');
|
|
1741
|
+
const locationAddress = this.getNodeParameter('locationAddress', i, '');
|
|
1722
1742
|
body.location = {
|
|
1723
1743
|
latitude: this.getNodeParameter('latitude', i),
|
|
1724
1744
|
longitude: this.getNodeParameter('longitude', i),
|
|
1725
|
-
name:
|
|
1745
|
+
name: locationName || undefined,
|
|
1746
|
+
address: locationAddress || undefined,
|
|
1726
1747
|
};
|
|
1727
1748
|
}
|
|
1728
1749
|
else if (messageType === 'contacts') {
|
|
@@ -2044,13 +2065,20 @@ class Whaapy {
|
|
|
2044
2065
|
const contactId = this.getNodeParameter('contactId', i);
|
|
2045
2066
|
const updateFields = this.getNodeParameter('contactUpdateFields', i, {});
|
|
2046
2067
|
const body = {};
|
|
2068
|
+
// Map camelCase to snake_case for API compatibility
|
|
2069
|
+
const fieldMapping = {
|
|
2070
|
+
phoneNumber: 'phone_number',
|
|
2071
|
+
funnelStageId: 'funnel_stage_id',
|
|
2072
|
+
customFields: 'custom_fields',
|
|
2073
|
+
};
|
|
2047
2074
|
Object.entries(updateFields).forEach(([key, value]) => {
|
|
2048
2075
|
if (value !== undefined && value !== '') {
|
|
2076
|
+
const mappedKey = fieldMapping[key] || key;
|
|
2049
2077
|
if (key === 'customFields') {
|
|
2050
|
-
body[
|
|
2078
|
+
body[mappedKey] = typeof value === 'string' ? JSON.parse(value) : value;
|
|
2051
2079
|
}
|
|
2052
2080
|
else {
|
|
2053
|
-
body[
|
|
2081
|
+
body[mappedKey] = value;
|
|
2054
2082
|
}
|
|
2055
2083
|
}
|
|
2056
2084
|
});
|
|
@@ -2223,7 +2251,7 @@ class Whaapy {
|
|
|
2223
2251
|
method: 'POST',
|
|
2224
2252
|
url: `${baseUrl}/funnel/v1/contacts/${contactId}/move`,
|
|
2225
2253
|
headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
|
|
2226
|
-
body: { stageId },
|
|
2254
|
+
body: { stage_id: stageId },
|
|
2227
2255
|
json: true,
|
|
2228
2256
|
});
|
|
2229
2257
|
}
|