@connectorx/n8n-nodes-cortex 0.1.39 → 0.1.41

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.
@@ -112,6 +112,11 @@ class Cortex {
112
112
  },
113
113
  },
114
114
  options: [
115
+ {
116
+ name: 'List',
117
+ value: 'list',
118
+ description: 'List contacts with optional filters',
119
+ },
115
120
  {
116
121
  name: 'Get',
117
122
  value: 'get',
@@ -122,6 +127,21 @@ class Cortex {
122
127
  value: 'update',
123
128
  description: 'Update contact fields (name, email, tags, custom_data)',
124
129
  },
130
+ {
131
+ name: 'Get Metrics',
132
+ value: 'getMetrics',
133
+ description: 'Get contact metrics and analytics',
134
+ },
135
+ {
136
+ name: 'AI Analysis',
137
+ value: 'aiAnalysis',
138
+ description: 'Generate AI analysis for a contact',
139
+ },
140
+ {
141
+ name: 'Bulk Update',
142
+ value: 'bulkUpdate',
143
+ description: 'Update multiple contacts at once',
144
+ },
125
145
  ],
126
146
  default: 'get',
127
147
  },
@@ -146,6 +166,7 @@ class Cortex {
146
166
  displayOptions: {
147
167
  show: {
148
168
  resource: ['contact'],
169
+ operation: ['get', 'update', 'getMetrics', 'aiAnalysis'],
149
170
  },
150
171
  },
151
172
  default: '',
@@ -486,6 +507,68 @@ class Cortex {
486
507
  default: '',
487
508
  description: 'Custom properties in JSON format',
488
509
  },
510
+ {
511
+ displayName: 'Search',
512
+ name: 'contactSearch',
513
+ type: 'string',
514
+ displayOptions: { show: { resource: ['contact'], operation: ['list'] } },
515
+ default: '',
516
+ description: 'Search by name, phone or email',
517
+ },
518
+ {
519
+ displayName: 'Filter by Tag',
520
+ name: 'contactFilterTag',
521
+ type: 'string',
522
+ displayOptions: { show: { resource: ['contact'], operation: ['list'] } },
523
+ default: '',
524
+ description: 'Filter contacts by tag',
525
+ },
526
+ {
527
+ displayName: 'Filter by Source',
528
+ name: 'contactFilterSource',
529
+ type: 'string',
530
+ displayOptions: { show: { resource: ['contact'], operation: ['list'] } },
531
+ default: '',
532
+ description: 'Filter contacts by source',
533
+ },
534
+ {
535
+ displayName: 'Limit',
536
+ name: 'contactLimit',
537
+ type: 'number',
538
+ displayOptions: { show: { resource: ['contact'], operation: ['list'] } },
539
+ typeOptions: { minValue: 1, maxValue: 100 },
540
+ default: 50,
541
+ description: 'How many contacts to retrieve',
542
+ },
543
+ {
544
+ displayName: 'Offset',
545
+ name: 'contactOffset',
546
+ type: 'number',
547
+ displayOptions: { show: { resource: ['contact'], operation: ['list'] } },
548
+ default: 0,
549
+ description: 'Pagination offset',
550
+ },
551
+ {
552
+ displayName: 'Analysis Type',
553
+ name: 'aiAnalysisType',
554
+ type: 'options',
555
+ displayOptions: { show: { resource: ['contact'], operation: ['aiAnalysis'] } },
556
+ options: [
557
+ { name: 'Both (General + Last Conversation)', value: 'both' },
558
+ { name: 'General Profile', value: 'general' },
559
+ { name: 'Last Conversation Only', value: 'last_conversation' },
560
+ ],
561
+ default: 'both',
562
+ description: 'Type of AI analysis to generate',
563
+ },
564
+ {
565
+ displayName: 'Contacts Data (JSON Array)',
566
+ name: 'bulkContactsData',
567
+ type: 'string',
568
+ displayOptions: { show: { resource: ['contact'], operation: ['bulkUpdate'] } },
569
+ default: '',
570
+ description: 'JSON array of contact objects with contact_id and fields to update. Example: [{"contact_id":"uuid","name":"New Name","tags":["vip"]}]',
571
+ },
489
572
  {
490
573
  displayName: 'Operation',
491
574
  name: 'operation',
@@ -833,12 +916,32 @@ class Cortex {
833
916
  }
834
917
  }
835
918
  else if (resource === 'contact') {
836
- const contactId = this.getNodeParameter('contactId', i);
837
- if (operation === 'get') {
919
+ if (operation === 'list') {
920
+ options.method = 'GET';
921
+ options.uri = `${baseUrl}/contacts`;
922
+ const qs = {};
923
+ const search = this.getNodeParameter('contactSearch', i, '');
924
+ const tag = this.getNodeParameter('contactFilterTag', i, '');
925
+ const source = this.getNodeParameter('contactFilterSource', i, '');
926
+ const limit = this.getNodeParameter('contactLimit', i, 50);
927
+ const offset = this.getNodeParameter('contactOffset', i, 0);
928
+ if (search)
929
+ qs.search = search;
930
+ if (tag)
931
+ qs.tag = tag;
932
+ if (source)
933
+ qs.source = source;
934
+ qs.limit = limit;
935
+ qs.offset = offset;
936
+ options.qs = qs;
937
+ }
938
+ else if (operation === 'get') {
939
+ const contactId = this.getNodeParameter('contactId', i);
838
940
  options.method = 'GET';
839
941
  options.uri = `${baseUrl}/contacts/${contactId}`;
840
942
  }
841
943
  else if (operation === 'update') {
944
+ const contactId = this.getNodeParameter('contactId', i);
842
945
  options.method = 'PATCH';
843
946
  options.uri = `${baseUrl}/contacts/${contactId}`;
844
947
  const name = this.getNodeParameter('contactName', i);
@@ -869,6 +972,34 @@ class Cortex {
869
972
  continue;
870
973
  }
871
974
  }
975
+ else if (operation === 'getMetrics') {
976
+ const contactId = this.getNodeParameter('contactId', i);
977
+ options.method = 'GET';
978
+ options.uri = `${baseUrl}/contacts/${contactId}/metrics`;
979
+ }
980
+ else if (operation === 'aiAnalysis') {
981
+ const contactId = this.getNodeParameter('contactId', i);
982
+ const analysisType = this.getNodeParameter('aiAnalysisType', i, 'both');
983
+ options.method = 'POST';
984
+ options.uri = `${baseUrl}/contacts/${contactId}/ai-analysis`;
985
+ options.body = { type: analysisType };
986
+ }
987
+ else if (operation === 'bulkUpdate') {
988
+ const bulkDataStr = this.getNodeParameter('bulkContactsData', i);
989
+ let contacts;
990
+ try {
991
+ contacts = JSON.parse(bulkDataStr);
992
+ }
993
+ catch (e) {
994
+ throw new Error('Bulk Contacts Data must be a valid JSON array');
995
+ }
996
+ if (!Array.isArray(contacts)) {
997
+ throw new Error('Bulk Contacts Data must be a JSON array');
998
+ }
999
+ options.method = 'PATCH';
1000
+ options.uri = `${baseUrl}/contacts/bulk`;
1001
+ options.body = { contacts };
1002
+ }
872
1003
  }
873
1004
  const responseData = await this.helpers.request(options);
874
1005
  returnData.push(Array.isArray(responseData) ? { json: responseData } : responseData);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connectorx/n8n-nodes-cortex",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
4
4
  "description": "n8n nodes for Cortex API",
5
5
  "keywords": [
6
6
  "n8n-community-node-package"