@connectorx/n8n-nodes-cortex 0.1.25 → 0.1.27

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.
@@ -84,6 +84,11 @@ class Cortex {
84
84
  value: 'update',
85
85
  description: 'Move column or assign owner',
86
86
  },
87
+ {
88
+ name: 'Handover',
89
+ value: 'handover',
90
+ description: 'Unassign conversation (remove owner and disable AI)',
91
+ },
87
92
  {
88
93
  name: 'Get History',
89
94
  value: 'getHistory',
@@ -353,6 +358,35 @@ class Cortex {
353
358
  default: '',
354
359
  description: 'New Owner ID. Leave empty to keep current.',
355
360
  },
361
+ {
362
+ displayName: 'Target Column',
363
+ name: 'handover_column_id',
364
+ type: 'options',
365
+ typeOptions: {
366
+ loadOptionsMethod: 'getColumns',
367
+ },
368
+ displayOptions: {
369
+ show: {
370
+ resource: ['conversation'],
371
+ operation: ['handover'],
372
+ },
373
+ },
374
+ default: 'inbox',
375
+ description: 'Column to move the conversation after handover. Defaults to inbox.',
376
+ },
377
+ {
378
+ displayName: 'User ID (for Audit)',
379
+ name: 'handover_user_id',
380
+ type: 'string',
381
+ displayOptions: {
382
+ show: {
383
+ resource: ['conversation'],
384
+ operation: ['handover'],
385
+ },
386
+ },
387
+ default: 'n8n',
388
+ description: 'User identifier for the handover action audit log',
389
+ },
356
390
  {
357
391
  displayName: 'Limit',
358
392
  name: 'limit',
@@ -508,7 +542,7 @@ class Cortex {
508
542
  const label = `${t.name} (${t.language || 'pt_BR'})${varNames ? ' — Vars: ' + varNames : ''}`;
509
543
  return {
510
544
  name: label,
511
- value: JSON.stringify({ id: t.id, name: t.name, language: t.language, variables: t.variables }),
545
+ value: JSON.stringify({ id: t.id, name: t.name, language: t.language, variables: t.variables, components: t.components }),
512
546
  };
513
547
  });
514
548
  }
@@ -525,17 +559,29 @@ class Cortex {
525
559
  return { fields: [] };
526
560
  const templateData = JSON.parse(templateDataStr);
527
561
  const vars = (templateData.variables || []);
528
- return {
529
- fields: vars.map((v) => ({
530
- id: v.name,
531
- displayName: v.name.toUpperCase(),
562
+ const fields = vars.map((v) => ({
563
+ id: v.name,
564
+ displayName: v.name.toUpperCase(),
565
+ required: true,
566
+ defaultMatch: false,
567
+ display: true,
568
+ type: 'string',
569
+ canBeUsedToMatch: false,
570
+ }));
571
+ const components = (templateData.components || []);
572
+ const headerComp = components.find((c) => c.type === 'HEADER');
573
+ if (headerComp && ['IMAGE', 'VIDEO', 'DOCUMENT'].includes(headerComp.format)) {
574
+ fields.unshift({
575
+ id: 'header_media_url',
576
+ displayName: `HEADER (${headerComp.format}) URL`,
532
577
  required: true,
533
578
  defaultMatch: false,
534
579
  display: true,
535
580
  type: 'string',
536
581
  canBeUsedToMatch: false,
537
- })),
538
- };
582
+ });
583
+ }
584
+ return { fields };
539
585
  }
540
586
  catch (e) {
541
587
  return { fields: [] };
@@ -631,6 +677,19 @@ class Cortex {
631
677
  });
632
678
  components.push({ type: 'body', parameters: params });
633
679
  }
680
+ const headerComp = (templateData.components || []).find((c) => c.type === 'HEADER');
681
+ if (headerComp && ['IMAGE', 'VIDEO', 'DOCUMENT'].includes(headerComp.format)) {
682
+ const mediaUrl = userValues['header_media_url'];
683
+ if (mediaUrl) {
684
+ const mediaType = headerComp.format.toLowerCase();
685
+ const mediaParam = { type: mediaType };
686
+ mediaParam[mediaType] = { link: mediaUrl };
687
+ components.unshift({
688
+ type: 'header',
689
+ parameters: [mediaParam]
690
+ });
691
+ }
692
+ }
634
693
  content = {
635
694
  name: templateData.name,
636
695
  language: templateData.language || 'pt_BR',
@@ -681,6 +740,19 @@ class Cortex {
681
740
  continue;
682
741
  }
683
742
  }
743
+ else if (operation === 'handover') {
744
+ options.method = 'POST';
745
+ options.uri = `${baseUrl}/conversations/${conversationId}/handover`;
746
+ const columnId = this.getNodeParameter('handover_column_id', i);
747
+ const userId = this.getNodeParameter('handover_user_id', i);
748
+ const body = {
749
+ user_id: userId || 'n8n',
750
+ };
751
+ if (columnId && columnId !== 'inbox') {
752
+ body.column_id = columnId;
753
+ }
754
+ options.body = body;
755
+ }
684
756
  else if (operation === 'getHistory') {
685
757
  options.method = 'GET';
686
758
  const limit = this.getNodeParameter('limit', i);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connectorx/n8n-nodes-cortex",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "n8n nodes for Cortex API",
5
5
  "keywords": [
6
6
  "n8n-community-node-package"