@renatoascencio/n8n-nodes-chatwoot 0.6.1 → 0.7.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.
- package/dist/nodes/Chatwoot/Chatwoot.node.js +91 -37
- package/dist/nodes/Chatwoot/Chatwoot.node.js.map +1 -1
- package/dist/nodes/Chatwoot/GenericFunctions.d.ts +1 -0
- package/dist/nodes/Chatwoot/GenericFunctions.js +36 -13
- package/dist/nodes/Chatwoot/GenericFunctions.js.map +1 -1
- package/dist/nodes/Chatwoot/resources/appliedSla/download.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/appliedSla/download.operation.js +30 -0
- package/dist/nodes/Chatwoot/resources/appliedSla/download.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/appliedSla/getAll.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/appliedSla/getAll.operation.js +75 -0
- package/dist/nodes/Chatwoot/resources/appliedSla/getAll.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/appliedSla/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/appliedSla/index.js +25 -0
- package/dist/nodes/Chatwoot/resources/appliedSla/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/appliedSla/metrics.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/appliedSla/metrics.operation.js +30 -0
- package/dist/nodes/Chatwoot/resources/appliedSla/metrics.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/notification/index.js +8 -0
- package/dist/nodes/Chatwoot/resources/notification/index.js.map +1 -1
- package/dist/nodes/Chatwoot/resources/notification/snooze.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/notification/snooze.operation.js +34 -0
- package/dist/nodes/Chatwoot/resources/notification/snooze.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/profile/availability.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/profile/availability.operation.js +25 -0
- package/dist/nodes/Chatwoot/resources/profile/availability.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/profile/index.js +12 -1
- package/dist/nodes/Chatwoot/resources/profile/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -31,6 +31,7 @@ const conversationParticipant_1 = require("./resources/conversationParticipant")
|
|
|
31
31
|
const company_1 = require("./resources/company");
|
|
32
32
|
const search_1 = require("./resources/search");
|
|
33
33
|
const slaPolicy_1 = require("./resources/slaPolicy");
|
|
34
|
+
const appliedSla_1 = require("./resources/appliedSla");
|
|
34
35
|
const platformAccount_1 = require("./resources/platformAccount");
|
|
35
36
|
const platformUser_1 = require("./resources/platformUser");
|
|
36
37
|
const accountUser_1 = require("./resources/accountUser");
|
|
@@ -88,6 +89,7 @@ class Chatwoot {
|
|
|
88
89
|
'company',
|
|
89
90
|
'search',
|
|
90
91
|
'slaPolicy',
|
|
92
|
+
'appliedSla',
|
|
91
93
|
],
|
|
92
94
|
},
|
|
93
95
|
},
|
|
@@ -121,6 +123,7 @@ class Chatwoot {
|
|
|
121
123
|
{ name: 'Account', value: 'account' },
|
|
122
124
|
{ name: 'Agent', value: 'agent' },
|
|
123
125
|
{ name: 'Agent Bot', value: 'agentBot' },
|
|
126
|
+
{ name: 'Applied SLA (Enterprise)', value: 'appliedSla' },
|
|
124
127
|
{ name: 'Audit Log', value: 'auditLog' },
|
|
125
128
|
{ name: 'Automation Rule', value: 'automationRule' },
|
|
126
129
|
{ name: 'Campaign', value: 'campaign' },
|
|
@@ -184,6 +187,7 @@ class Chatwoot {
|
|
|
184
187
|
company_1.companyOperations,
|
|
185
188
|
search_1.searchOperations,
|
|
186
189
|
slaPolicy_1.slaPolicyOperations,
|
|
190
|
+
appliedSla_1.appliedSlaOperations,
|
|
187
191
|
platformAccount_1.platformAccountOperations,
|
|
188
192
|
platformUser_1.platformUserOperations,
|
|
189
193
|
accountUser_1.accountUserOperations,
|
|
@@ -219,6 +223,7 @@ class Chatwoot {
|
|
|
219
223
|
...company_1.companyFields,
|
|
220
224
|
...search_1.searchFields,
|
|
221
225
|
...slaPolicy_1.slaPolicyFields,
|
|
226
|
+
...appliedSla_1.appliedSlaFields,
|
|
222
227
|
...platformAccount_1.platformAccountFields,
|
|
223
228
|
...platformUser_1.platformUserFields,
|
|
224
229
|
...accountUser_1.accountUserFields,
|
|
@@ -668,7 +673,7 @@ class Chatwoot {
|
|
|
668
673
|
if (additionalFields.team_id)
|
|
669
674
|
body.team_id = additionalFields.team_id;
|
|
670
675
|
if (additionalFields.custom_attributes) {
|
|
671
|
-
body.custom_attributes =
|
|
676
|
+
body.custom_attributes = (0, GenericFunctions_1.parseJsonSafe)(additionalFields.custom_attributes, 'custom_attributes');
|
|
672
677
|
}
|
|
673
678
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/conversations', body);
|
|
674
679
|
}
|
|
@@ -690,12 +695,12 @@ class Chatwoot {
|
|
|
690
695
|
body.team_id = updateFields.team_id;
|
|
691
696
|
if (updateFields.status)
|
|
692
697
|
body.status = updateFields.status;
|
|
693
|
-
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, '
|
|
698
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/conversations/${conversationId}`, body);
|
|
694
699
|
}
|
|
695
700
|
else if (operation === 'filter') {
|
|
696
701
|
const filterPayload = this.getNodeParameter('filterPayload', i);
|
|
697
702
|
const returnAll = this.getNodeParameter('returnAll', i);
|
|
698
|
-
const body = { payload:
|
|
703
|
+
const body = { payload: (0, GenericFunctions_1.parseJsonSafe)(filterPayload, 'filter payload') };
|
|
699
704
|
if (returnAll) {
|
|
700
705
|
responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'POST', '/conversations/filter', body, {}, 'payload');
|
|
701
706
|
}
|
|
@@ -710,9 +715,7 @@ class Chatwoot {
|
|
|
710
715
|
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
711
716
|
const customAttributes = this.getNodeParameter('customAttributes', i);
|
|
712
717
|
const body = {
|
|
713
|
-
custom_attributes:
|
|
714
|
-
? JSON.parse(customAttributes)
|
|
715
|
-
: customAttributes,
|
|
718
|
+
custom_attributes: (0, GenericFunctions_1.parseJsonSafe)(customAttributes, 'custom_attributes'),
|
|
716
719
|
};
|
|
717
720
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/conversations/${conversationId}`, body);
|
|
718
721
|
}
|
|
@@ -844,10 +847,7 @@ class Chatwoot {
|
|
|
844
847
|
if (additionalFields.identifier)
|
|
845
848
|
body.identifier = additionalFields.identifier;
|
|
846
849
|
if (additionalFields.custom_attributes) {
|
|
847
|
-
body.custom_attributes =
|
|
848
|
-
typeof additionalFields.custom_attributes === 'string'
|
|
849
|
-
? JSON.parse(additionalFields.custom_attributes)
|
|
850
|
-
: additionalFields.custom_attributes;
|
|
850
|
+
body.custom_attributes = (0, GenericFunctions_1.parseJsonSafe)(additionalFields.custom_attributes, 'custom_attributes');
|
|
851
851
|
}
|
|
852
852
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/contacts', body);
|
|
853
853
|
}
|
|
@@ -889,10 +889,7 @@ class Chatwoot {
|
|
|
889
889
|
if (updateFields.blocked !== undefined)
|
|
890
890
|
body.blocked = updateFields.blocked;
|
|
891
891
|
if (updateFields.custom_attributes) {
|
|
892
|
-
body.custom_attributes =
|
|
893
|
-
typeof updateFields.custom_attributes === 'string'
|
|
894
|
-
? JSON.parse(updateFields.custom_attributes)
|
|
895
|
-
: updateFields.custom_attributes;
|
|
892
|
+
body.custom_attributes = (0, GenericFunctions_1.parseJsonSafe)(updateFields.custom_attributes, 'custom_attributes');
|
|
896
893
|
}
|
|
897
894
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PUT', `/contacts/${contactId}`, body);
|
|
898
895
|
}
|
|
@@ -936,7 +933,7 @@ class Chatwoot {
|
|
|
936
933
|
else if (operation === 'filter') {
|
|
937
934
|
const filterPayload = this.getNodeParameter('filterPayload', i);
|
|
938
935
|
const returnAll = this.getNodeParameter('returnAll', i);
|
|
939
|
-
const body = { payload:
|
|
936
|
+
const body = { payload: (0, GenericFunctions_1.parseJsonSafe)(filterPayload, 'filter payload') };
|
|
940
937
|
if (returnAll) {
|
|
941
938
|
responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'POST', '/contacts/filter', body, {}, 'payload');
|
|
942
939
|
}
|
|
@@ -1044,8 +1041,8 @@ class Chatwoot {
|
|
|
1044
1041
|
else if (operation === 'create') {
|
|
1045
1042
|
const name = this.getNodeParameter('name', i);
|
|
1046
1043
|
const eventName = this.getNodeParameter('eventName', i);
|
|
1047
|
-
const conditions =
|
|
1048
|
-
const actions =
|
|
1044
|
+
const conditions = (0, GenericFunctions_1.parseJsonSafe)(this.getNodeParameter('conditions', i), 'conditions');
|
|
1045
|
+
const actions = (0, GenericFunctions_1.parseJsonSafe)(this.getNodeParameter('actions', i), 'actions');
|
|
1049
1046
|
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1050
1047
|
const body = {
|
|
1051
1048
|
name,
|
|
@@ -1070,9 +1067,9 @@ class Chatwoot {
|
|
|
1070
1067
|
if (updateFields.active !== undefined)
|
|
1071
1068
|
body.active = updateFields.active;
|
|
1072
1069
|
if (updateFields.conditions)
|
|
1073
|
-
body.conditions =
|
|
1070
|
+
body.conditions = (0, GenericFunctions_1.parseJsonSafe)(updateFields.conditions, 'conditions');
|
|
1074
1071
|
if (updateFields.actions)
|
|
1075
|
-
body.actions =
|
|
1072
|
+
body.actions = (0, GenericFunctions_1.parseJsonSafe)(updateFields.actions, 'actions');
|
|
1076
1073
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/automation_rules/${automationRuleId}`, body);
|
|
1077
1074
|
}
|
|
1078
1075
|
else if (operation === 'delete') {
|
|
@@ -1096,7 +1093,7 @@ class Chatwoot {
|
|
|
1096
1093
|
else if (operation === 'create') {
|
|
1097
1094
|
const name = this.getNodeParameter('name', i);
|
|
1098
1095
|
const filterType = this.getNodeParameter('filterType', i);
|
|
1099
|
-
const query =
|
|
1096
|
+
const query = (0, GenericFunctions_1.parseJsonSafe)(this.getNodeParameter('query', i), 'query');
|
|
1100
1097
|
const body = {
|
|
1101
1098
|
name,
|
|
1102
1099
|
filter_type: filterType,
|
|
@@ -1111,7 +1108,7 @@ class Chatwoot {
|
|
|
1111
1108
|
if (updateFields.name)
|
|
1112
1109
|
body.name = updateFields.name;
|
|
1113
1110
|
if (updateFields.query)
|
|
1114
|
-
body.query =
|
|
1111
|
+
body.query = (0, GenericFunctions_1.parseJsonSafe)(updateFields.query, 'query');
|
|
1115
1112
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/custom_filters/${customFilterId}`, body);
|
|
1116
1113
|
}
|
|
1117
1114
|
else if (operation === 'delete') {
|
|
@@ -1196,6 +1193,10 @@ class Chatwoot {
|
|
|
1196
1193
|
body.auto_offline = updateFields.auto_offline;
|
|
1197
1194
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PUT', '/profile', body);
|
|
1198
1195
|
}
|
|
1196
|
+
else if (operation === 'availability') {
|
|
1197
|
+
const availability = this.getNodeParameter('availability', i);
|
|
1198
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/profile/availability', { availability });
|
|
1199
|
+
}
|
|
1199
1200
|
else {
|
|
1200
1201
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1201
1202
|
}
|
|
@@ -1278,13 +1279,13 @@ class Chatwoot {
|
|
|
1278
1279
|
else if (operation === 'createHook') {
|
|
1279
1280
|
const appId = this.getNodeParameter('appId', i);
|
|
1280
1281
|
const inboxId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('inboxId', i), 'Inbox ID');
|
|
1281
|
-
const settings =
|
|
1282
|
+
const settings = (0, GenericFunctions_1.parseJsonSafe)(this.getNodeParameter('settings', i), 'settings');
|
|
1282
1283
|
const body = { app_id: appId, inbox_id: inboxId, settings };
|
|
1283
1284
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/integrations/hooks', body);
|
|
1284
1285
|
}
|
|
1285
1286
|
else if (operation === 'updateHook') {
|
|
1286
1287
|
const hookId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('hookId', i), 'Hook ID');
|
|
1287
|
-
const settings =
|
|
1288
|
+
const settings = (0, GenericFunctions_1.parseJsonSafe)(this.getNodeParameter('settings', i), 'settings');
|
|
1288
1289
|
const body = { settings };
|
|
1289
1290
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/integrations/hooks/${hookId}`, body);
|
|
1290
1291
|
}
|
|
@@ -1324,7 +1325,7 @@ class Chatwoot {
|
|
|
1324
1325
|
else if (resource === 'csatSurvey') {
|
|
1325
1326
|
if (operation === 'get') {
|
|
1326
1327
|
const conversationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('conversationId', i), 'Conversation ID');
|
|
1327
|
-
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET',
|
|
1328
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/csat_survey_responses', {}, { conversation_id: conversationId });
|
|
1328
1329
|
}
|
|
1329
1330
|
else if (operation === 'metrics') {
|
|
1330
1331
|
const options = this.getNodeParameter('options', i);
|
|
@@ -1362,7 +1363,7 @@ class Chatwoot {
|
|
|
1362
1363
|
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1363
1364
|
const body = {
|
|
1364
1365
|
name,
|
|
1365
|
-
actions:
|
|
1366
|
+
actions: (0, GenericFunctions_1.parseJsonSafe)(actions, 'actions'),
|
|
1366
1367
|
};
|
|
1367
1368
|
if (additionalFields.visibility)
|
|
1368
1369
|
body.visibility = additionalFields.visibility;
|
|
@@ -1377,9 +1378,7 @@ class Chatwoot {
|
|
|
1377
1378
|
if (updateFields.visibility)
|
|
1378
1379
|
body.visibility = updateFields.visibility;
|
|
1379
1380
|
if (updateFields.actions) {
|
|
1380
|
-
body.actions =
|
|
1381
|
-
? JSON.parse(updateFields.actions)
|
|
1382
|
-
: updateFields.actions;
|
|
1381
|
+
body.actions = (0, GenericFunctions_1.parseJsonSafe)(updateFields.actions, 'actions');
|
|
1383
1382
|
}
|
|
1384
1383
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'PATCH', `/macros/${macroId}`, body);
|
|
1385
1384
|
}
|
|
@@ -1459,6 +1458,13 @@ class Chatwoot {
|
|
|
1459
1458
|
const notificationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('notificationId', i), 'Notification ID');
|
|
1460
1459
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/notifications/${notificationId}/unread`);
|
|
1461
1460
|
}
|
|
1461
|
+
else if (operation === 'snooze') {
|
|
1462
|
+
const notificationId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('notificationId', i), 'Notification ID');
|
|
1463
|
+
const snoozedUntil = this.getNodeParameter('snoozedUntil', i);
|
|
1464
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', `/notifications/${notificationId}/snooze`, {
|
|
1465
|
+
snoozed_until: snoozedUntil,
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1462
1468
|
else {
|
|
1463
1469
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1464
1470
|
}
|
|
@@ -1481,9 +1487,7 @@ class Chatwoot {
|
|
|
1481
1487
|
if (additionalFields.scheduled_at)
|
|
1482
1488
|
body.scheduled_at = additionalFields.scheduled_at;
|
|
1483
1489
|
if (additionalFields.audience) {
|
|
1484
|
-
body.audience =
|
|
1485
|
-
? JSON.parse(additionalFields.audience)
|
|
1486
|
-
: additionalFields.audience;
|
|
1490
|
+
body.audience = (0, GenericFunctions_1.parseJsonSafe)(additionalFields.audience, 'audience');
|
|
1487
1491
|
}
|
|
1488
1492
|
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'POST', '/campaigns', body);
|
|
1489
1493
|
}
|
|
@@ -1728,6 +1732,56 @@ class Chatwoot {
|
|
|
1728
1732
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1729
1733
|
}
|
|
1730
1734
|
}
|
|
1735
|
+
else if (resource === 'appliedSla') {
|
|
1736
|
+
if (operation === 'getAll') {
|
|
1737
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1738
|
+
const options = this.getNodeParameter('options', i);
|
|
1739
|
+
const qs = {};
|
|
1740
|
+
if (options.since)
|
|
1741
|
+
qs.since = new Date(options.since).getTime() / 1000;
|
|
1742
|
+
if (options.until)
|
|
1743
|
+
qs.until = new Date(options.until).getTime() / 1000;
|
|
1744
|
+
if (options.inbox_id)
|
|
1745
|
+
qs.inbox_id = options.inbox_id;
|
|
1746
|
+
if (options.team_id)
|
|
1747
|
+
qs.team_id = options.team_id;
|
|
1748
|
+
if (options.sla_policy_id)
|
|
1749
|
+
qs.sla_policy_id = options.sla_policy_id;
|
|
1750
|
+
if (options.assigned_agent_id)
|
|
1751
|
+
qs.assigned_agent_id = options.assigned_agent_id;
|
|
1752
|
+
if (returnAll) {
|
|
1753
|
+
responseData = await GenericFunctions_1.chatwootApiRequestAllItems.call(this, 'GET', '/applied_slas', {}, qs, 'payload');
|
|
1754
|
+
}
|
|
1755
|
+
else {
|
|
1756
|
+
const limit = this.getNodeParameter('limit', i);
|
|
1757
|
+
qs.page = 1;
|
|
1758
|
+
const result = (await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/applied_slas', {}, qs));
|
|
1759
|
+
const payload = (result.payload || []);
|
|
1760
|
+
responseData = payload.slice(0, limit);
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
else if (operation === 'metrics') {
|
|
1764
|
+
const options = this.getNodeParameter('options', i);
|
|
1765
|
+
const qs = {};
|
|
1766
|
+
if (options.since)
|
|
1767
|
+
qs.since = new Date(options.since).getTime() / 1000;
|
|
1768
|
+
if (options.until)
|
|
1769
|
+
qs.until = new Date(options.until).getTime() / 1000;
|
|
1770
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/applied_slas/metrics', {}, qs);
|
|
1771
|
+
}
|
|
1772
|
+
else if (operation === 'download') {
|
|
1773
|
+
const options = this.getNodeParameter('options', i);
|
|
1774
|
+
const qs = {};
|
|
1775
|
+
if (options.since)
|
|
1776
|
+
qs.since = new Date(options.since).getTime() / 1000;
|
|
1777
|
+
if (options.until)
|
|
1778
|
+
qs.until = new Date(options.until).getTime() / 1000;
|
|
1779
|
+
responseData = await GenericFunctions_1.chatwootApiRequest.call(this, 'GET', '/applied_slas/download', {}, qs);
|
|
1780
|
+
}
|
|
1781
|
+
else {
|
|
1782
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation "${operation}" not supported`, { itemIndex: i });
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1731
1785
|
else if (resource === 'platformAccount') {
|
|
1732
1786
|
if (operation === 'create') {
|
|
1733
1787
|
const name = this.getNodeParameter('name', i);
|
|
@@ -1762,7 +1816,7 @@ class Chatwoot {
|
|
|
1762
1816
|
if (additionalFields.password)
|
|
1763
1817
|
body.password = additionalFields.password;
|
|
1764
1818
|
if (additionalFields.custom_attributes) {
|
|
1765
|
-
body.custom_attributes =
|
|
1819
|
+
body.custom_attributes = (0, GenericFunctions_1.parseJsonSafe)(additionalFields.custom_attributes, 'custom_attributes');
|
|
1766
1820
|
}
|
|
1767
1821
|
responseData = await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'POST', '/users', body);
|
|
1768
1822
|
}
|
|
@@ -1773,8 +1827,8 @@ class Chatwoot {
|
|
|
1773
1827
|
else if (operation === 'update') {
|
|
1774
1828
|
const userId = (0, GenericFunctions_1.validateId)(this.getNodeParameter('userId', i), 'User ID');
|
|
1775
1829
|
const updateFields = this.getNodeParameter('updateFields', i);
|
|
1776
|
-
if (updateFields.custom_attributes
|
|
1777
|
-
updateFields.custom_attributes =
|
|
1830
|
+
if (updateFields.custom_attributes) {
|
|
1831
|
+
updateFields.custom_attributes = (0, GenericFunctions_1.parseJsonSafe)(updateFields.custom_attributes, 'custom_attributes');
|
|
1778
1832
|
}
|
|
1779
1833
|
responseData = await GenericFunctions_1.chatwootPlatformApiRequest.call(this, 'PATCH', `/users/${userId}`, updateFields);
|
|
1780
1834
|
}
|
|
@@ -1852,7 +1906,7 @@ class Chatwoot {
|
|
|
1852
1906
|
if (operation === 'create') {
|
|
1853
1907
|
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1854
1908
|
if (additionalFields.custom_attributes && typeof additionalFields.custom_attributes === 'string') {
|
|
1855
|
-
additionalFields.custom_attributes =
|
|
1909
|
+
additionalFields.custom_attributes = (0, GenericFunctions_1.parseJsonSafe)(additionalFields.custom_attributes, 'custom_attributes');
|
|
1856
1910
|
}
|
|
1857
1911
|
responseData = await GenericFunctions_1.chatwootPublicApiRequest.call(this, 'POST', `/inboxes/${inboxIdentifier}/contacts`, additionalFields);
|
|
1858
1912
|
}
|
|
@@ -1864,7 +1918,7 @@ class Chatwoot {
|
|
|
1864
1918
|
const contactIdentifier = this.getNodeParameter('contactIdentifier', i);
|
|
1865
1919
|
const updateFields = this.getNodeParameter('updateFields', i);
|
|
1866
1920
|
if (updateFields.custom_attributes && typeof updateFields.custom_attributes === 'string') {
|
|
1867
|
-
updateFields.custom_attributes =
|
|
1921
|
+
updateFields.custom_attributes = (0, GenericFunctions_1.parseJsonSafe)(updateFields.custom_attributes, 'custom_attributes');
|
|
1868
1922
|
}
|
|
1869
1923
|
responseData = await GenericFunctions_1.chatwootPublicApiRequest.call(this, 'PATCH', `/inboxes/${inboxIdentifier}/contacts/${contactIdentifier}`, updateFields);
|
|
1870
1924
|
}
|
|
@@ -1879,7 +1933,7 @@ class Chatwoot {
|
|
|
1879
1933
|
const contactIdentifier = this.getNodeParameter('contactIdentifier', i);
|
|
1880
1934
|
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
1881
1935
|
if (additionalFields.custom_attributes && typeof additionalFields.custom_attributes === 'string') {
|
|
1882
|
-
additionalFields.custom_attributes =
|
|
1936
|
+
additionalFields.custom_attributes = (0, GenericFunctions_1.parseJsonSafe)(additionalFields.custom_attributes, 'custom_attributes');
|
|
1883
1937
|
}
|
|
1884
1938
|
responseData = await GenericFunctions_1.chatwootPublicApiRequest.call(this, 'POST', `/inboxes/${inboxIdentifier}/contacts/${contactIdentifier}/conversations`, additionalFields);
|
|
1885
1939
|
}
|