n8n-nodes-idb2b 1.1.2 → 1.1.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.
|
@@ -308,6 +308,10 @@ class IDB2B {
|
|
|
308
308
|
name: 'Lead',
|
|
309
309
|
value: 'lead',
|
|
310
310
|
},
|
|
311
|
+
{
|
|
312
|
+
name: 'Lead Activities',
|
|
313
|
+
value: 'leadActivities',
|
|
314
|
+
},
|
|
311
315
|
{
|
|
312
316
|
name: 'Custom',
|
|
313
317
|
value: 'custom',
|
|
@@ -367,6 +371,26 @@ class IDB2B {
|
|
|
367
371
|
],
|
|
368
372
|
default: 'getAll',
|
|
369
373
|
},
|
|
374
|
+
{
|
|
375
|
+
displayName: 'Operation',
|
|
376
|
+
name: 'operation',
|
|
377
|
+
type: 'options',
|
|
378
|
+
noDataExpression: true,
|
|
379
|
+
displayOptions: {
|
|
380
|
+
show: {
|
|
381
|
+
resource: ['leadActivities'],
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
options: [
|
|
385
|
+
{
|
|
386
|
+
name: 'Create',
|
|
387
|
+
value: 'create',
|
|
388
|
+
action: 'Create a lead activity',
|
|
389
|
+
description: 'Create a new activity for a lead',
|
|
390
|
+
},
|
|
391
|
+
],
|
|
392
|
+
default: 'create',
|
|
393
|
+
},
|
|
370
394
|
{
|
|
371
395
|
displayName: 'Operation',
|
|
372
396
|
name: 'operation',
|
|
@@ -768,6 +792,130 @@ class IDB2B {
|
|
|
768
792
|
},
|
|
769
793
|
],
|
|
770
794
|
},
|
|
795
|
+
{
|
|
796
|
+
displayName: 'Lead ID',
|
|
797
|
+
name: 'lead_id',
|
|
798
|
+
type: 'string',
|
|
799
|
+
default: '',
|
|
800
|
+
required: true,
|
|
801
|
+
displayOptions: {
|
|
802
|
+
show: {
|
|
803
|
+
resource: ['leadActivities'],
|
|
804
|
+
operation: ['create'],
|
|
805
|
+
},
|
|
806
|
+
},
|
|
807
|
+
description: 'ID of the lead to add activity to',
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
displayName: 'Subject',
|
|
811
|
+
name: 'subject',
|
|
812
|
+
type: 'string',
|
|
813
|
+
default: '',
|
|
814
|
+
required: true,
|
|
815
|
+
displayOptions: {
|
|
816
|
+
show: {
|
|
817
|
+
resource: ['leadActivities'],
|
|
818
|
+
operation: ['create'],
|
|
819
|
+
},
|
|
820
|
+
},
|
|
821
|
+
description: 'Subject of the activity',
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
displayName: 'Additional Fields',
|
|
825
|
+
name: 'additionalFields',
|
|
826
|
+
type: 'collection',
|
|
827
|
+
placeholder: 'Add Field',
|
|
828
|
+
default: {},
|
|
829
|
+
displayOptions: {
|
|
830
|
+
show: {
|
|
831
|
+
resource: ['leadActivities'],
|
|
832
|
+
operation: ['create'],
|
|
833
|
+
},
|
|
834
|
+
},
|
|
835
|
+
options: [
|
|
836
|
+
{
|
|
837
|
+
displayName: 'Icon',
|
|
838
|
+
name: 'icon',
|
|
839
|
+
type: 'string',
|
|
840
|
+
default: '',
|
|
841
|
+
description: 'Icon for the activity',
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
displayName: 'Description',
|
|
845
|
+
name: 'description',
|
|
846
|
+
type: 'string',
|
|
847
|
+
default: '',
|
|
848
|
+
description: 'Description of the activity',
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
displayName: 'Date and Time',
|
|
852
|
+
name: 'datetime',
|
|
853
|
+
type: 'string',
|
|
854
|
+
default: '',
|
|
855
|
+
placeholder: '2025-10-13T10:00:00Z',
|
|
856
|
+
description: 'Date and time of the activity (ISO format)',
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
displayName: 'User ID',
|
|
860
|
+
name: 'user_id',
|
|
861
|
+
type: 'string',
|
|
862
|
+
default: '',
|
|
863
|
+
description: 'User ID associated with the activity',
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
displayName: 'Attachments',
|
|
867
|
+
name: 'attachments',
|
|
868
|
+
type: 'fixedCollection',
|
|
869
|
+
typeOptions: {
|
|
870
|
+
multipleValues: true,
|
|
871
|
+
},
|
|
872
|
+
default: {},
|
|
873
|
+
placeholder: 'Add Attachment',
|
|
874
|
+
description: 'Attachment files for the activity',
|
|
875
|
+
options: [
|
|
876
|
+
{
|
|
877
|
+
name: 'attachment',
|
|
878
|
+
displayName: 'Attachment',
|
|
879
|
+
values: [
|
|
880
|
+
{
|
|
881
|
+
displayName: 'File Path/URL',
|
|
882
|
+
name: 'file',
|
|
883
|
+
type: 'string',
|
|
884
|
+
default: '',
|
|
885
|
+
required: true,
|
|
886
|
+
},
|
|
887
|
+
],
|
|
888
|
+
},
|
|
889
|
+
],
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
displayName: 'Attachments to Delete',
|
|
893
|
+
name: 'attachments_to_delete',
|
|
894
|
+
type: 'fixedCollection',
|
|
895
|
+
typeOptions: {
|
|
896
|
+
multipleValues: true,
|
|
897
|
+
},
|
|
898
|
+
default: {},
|
|
899
|
+
placeholder: 'Add Attachment ID',
|
|
900
|
+
description: 'Array of attachment IDs to delete (for updates)',
|
|
901
|
+
options: [
|
|
902
|
+
{
|
|
903
|
+
name: 'attachment_id',
|
|
904
|
+
displayName: 'Attachment ID',
|
|
905
|
+
values: [
|
|
906
|
+
{
|
|
907
|
+
displayName: 'ID',
|
|
908
|
+
name: 'id',
|
|
909
|
+
type: 'string',
|
|
910
|
+
default: '',
|
|
911
|
+
required: true,
|
|
912
|
+
},
|
|
913
|
+
],
|
|
914
|
+
},
|
|
915
|
+
],
|
|
916
|
+
},
|
|
917
|
+
],
|
|
918
|
+
},
|
|
771
919
|
{
|
|
772
920
|
displayName: 'Endpoint',
|
|
773
921
|
name: 'endpoint',
|
|
@@ -1090,6 +1238,47 @@ class IDB2B {
|
|
|
1090
1238
|
}
|
|
1091
1239
|
}
|
|
1092
1240
|
}
|
|
1241
|
+
else if (resource === 'leadActivities') {
|
|
1242
|
+
if (operation === 'create') {
|
|
1243
|
+
method = 'POST';
|
|
1244
|
+
const leadId = this.getNodeParameter('lead_id', i);
|
|
1245
|
+
const subject = this.getNodeParameter('subject', i);
|
|
1246
|
+
const additionalFields = this.getNodeParameter('additionalFields', i, {});
|
|
1247
|
+
// Validate required fields
|
|
1248
|
+
if (!leadId || typeof leadId !== 'string' || leadId.trim().length === 0) {
|
|
1249
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Lead ID is required and must be a non-empty string', { itemIndex: i });
|
|
1250
|
+
}
|
|
1251
|
+
if (!subject || typeof subject !== 'string' || subject.trim().length === 0) {
|
|
1252
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Subject is required and must be a non-empty string', { itemIndex: i });
|
|
1253
|
+
}
|
|
1254
|
+
endpoint = `/leads/${leadId.trim()}/activities`;
|
|
1255
|
+
// Build activity data object
|
|
1256
|
+
body = {
|
|
1257
|
+
subject: subject.trim(),
|
|
1258
|
+
};
|
|
1259
|
+
// Add additional fields if provided
|
|
1260
|
+
if (additionalFields.icon) {
|
|
1261
|
+
body.icon = additionalFields.icon;
|
|
1262
|
+
}
|
|
1263
|
+
if (additionalFields.description) {
|
|
1264
|
+
body.description = additionalFields.description;
|
|
1265
|
+
}
|
|
1266
|
+
if (additionalFields.datetime) {
|
|
1267
|
+
body.datetime = additionalFields.datetime;
|
|
1268
|
+
}
|
|
1269
|
+
if (additionalFields.user_id) {
|
|
1270
|
+
body.user_id = additionalFields.user_id;
|
|
1271
|
+
}
|
|
1272
|
+
// Process attachments if provided
|
|
1273
|
+
if (additionalFields.attachments && additionalFields.attachments.attachment) {
|
|
1274
|
+
body.attachments = additionalFields.attachments.attachment.map((attachment) => attachment.file);
|
|
1275
|
+
}
|
|
1276
|
+
// Process attachments to delete if provided
|
|
1277
|
+
if (additionalFields.attachments_to_delete && additionalFields.attachments_to_delete.attachment_id) {
|
|
1278
|
+
body.attachments_to_delete = additionalFields.attachments_to_delete.attachment_id.map((attachment) => attachment.id);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1093
1282
|
else if (resource === 'custom') {
|
|
1094
1283
|
endpoint = this.getNodeParameter('endpoint', i);
|
|
1095
1284
|
// Validate endpoint
|
|
@@ -1122,7 +1311,19 @@ class IDB2B {
|
|
|
1122
1311
|
});
|
|
1123
1312
|
let processedResponse = response;
|
|
1124
1313
|
// Enhance response for create operations
|
|
1125
|
-
if (operation === 'create' &&
|
|
1314
|
+
if (operation === 'create' && (resource === 'lead' || resource === 'leadActivities')) {
|
|
1315
|
+
// For lead and leadActivities creation, ensure the response includes the data with ID
|
|
1316
|
+
if (response.message === 'success' && response.data) {
|
|
1317
|
+
// API returned actual data - use it
|
|
1318
|
+
processedResponse = response;
|
|
1319
|
+
}
|
|
1320
|
+
else if (response.message === 'success' && response.data === null) {
|
|
1321
|
+
// Fallback: create synthetic response but try to include any ID from headers or other sources
|
|
1322
|
+
processedResponse = Object.assign(Object.assign({}, response), { data: Object.assign(Object.assign({}, body), { created: true, status: 'success' }) });
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
else if (operation === 'create' && response.message === 'success' && response.data === null) {
|
|
1326
|
+
// Original logic for other create operations
|
|
1126
1327
|
processedResponse = Object.assign(Object.assign({}, response), { data: Object.assign(Object.assign({}, body), { created: true, status: 'success' }) });
|
|
1127
1328
|
}
|
|
1128
1329
|
// Apply field filtering for contact getAll operation
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface IDB2BLeadActivity {
|
|
2
|
+
id?: string;
|
|
3
|
+
lead_id?: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
subject: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
datetime?: string;
|
|
8
|
+
user_id?: string;
|
|
9
|
+
attachments?: string[];
|
|
10
|
+
attachments_to_delete?: string[];
|
|
11
|
+
created_at?: string;
|
|
12
|
+
updated_at?: string;
|
|
13
|
+
}
|