n8n-nodes-whaapy 0.3.3 → 0.3.4
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.
|
@@ -1248,6 +1248,13 @@ class Whaapy {
|
|
|
1248
1248
|
default: '',
|
|
1249
1249
|
description: 'Comma-separated list of tags'
|
|
1250
1250
|
},
|
|
1251
|
+
{
|
|
1252
|
+
displayName: 'Funnel Stage ID',
|
|
1253
|
+
name: 'funnelStageId',
|
|
1254
|
+
type: 'string',
|
|
1255
|
+
default: '',
|
|
1256
|
+
description: 'ID of the funnel stage to assign the contact to'
|
|
1257
|
+
},
|
|
1251
1258
|
{
|
|
1252
1259
|
displayName: 'Custom Fields',
|
|
1253
1260
|
name: 'customFields',
|
|
@@ -2044,13 +2051,20 @@ class Whaapy {
|
|
|
2044
2051
|
const contactId = this.getNodeParameter('contactId', i);
|
|
2045
2052
|
const updateFields = this.getNodeParameter('contactUpdateFields', i, {});
|
|
2046
2053
|
const body = {};
|
|
2054
|
+
// Map camelCase to snake_case for API compatibility
|
|
2055
|
+
const fieldMapping = {
|
|
2056
|
+
phoneNumber: 'phone_number',
|
|
2057
|
+
funnelStageId: 'funnel_stage_id',
|
|
2058
|
+
customFields: 'custom_fields',
|
|
2059
|
+
};
|
|
2047
2060
|
Object.entries(updateFields).forEach(([key, value]) => {
|
|
2048
2061
|
if (value !== undefined && value !== '') {
|
|
2062
|
+
const mappedKey = fieldMapping[key] || key;
|
|
2049
2063
|
if (key === 'customFields') {
|
|
2050
|
-
body[
|
|
2064
|
+
body[mappedKey] = typeof value === 'string' ? JSON.parse(value) : value;
|
|
2051
2065
|
}
|
|
2052
2066
|
else {
|
|
2053
|
-
body[
|
|
2067
|
+
body[mappedKey] = value;
|
|
2054
2068
|
}
|
|
2055
2069
|
}
|
|
2056
2070
|
});
|
|
@@ -2223,7 +2237,7 @@ class Whaapy {
|
|
|
2223
2237
|
method: 'POST',
|
|
2224
2238
|
url: `${baseUrl}/funnel/v1/contacts/${contactId}/move`,
|
|
2225
2239
|
headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
|
|
2226
|
-
body: { stageId },
|
|
2240
|
+
body: { stage_id: stageId },
|
|
2227
2241
|
json: true,
|
|
2228
2242
|
});
|
|
2229
2243
|
}
|