n8n-nodes-aivencerealtycrm 1.0.7 → 1.0.8

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.
@@ -102,10 +102,16 @@ class AivenceRealty {
102
102
  description: 'Obtener lead por ID',
103
103
  action: 'Obtener lead',
104
104
  },
105
+ {
106
+ name: 'Add Activity',
107
+ value: 'addActivity',
108
+ description: 'Agregar actividad a un lead',
109
+ action: 'Agregar actividad',
110
+ },
105
111
  ],
106
112
  default: 'list',
107
113
  },
108
- // Lead ID (para Update y Get)
114
+ // Lead ID (para Update, Get y AddActivity)
109
115
  {
110
116
  displayName: 'Lead ID',
111
117
  name: 'leadId',
@@ -114,7 +120,7 @@ class AivenceRealty {
114
120
  displayOptions: {
115
121
  show: {
116
122
  resource: ['lead'],
117
- operation: ['update', 'get'],
123
+ operation: ['update', 'get', 'addActivity'],
118
124
  },
119
125
  },
120
126
  default: '',
@@ -297,6 +303,211 @@ class AivenceRealty {
297
303
  default: 'apartamento',
298
304
  description: 'Tipo de propiedad de interés',
299
305
  },
306
+ {
307
+ displayName: 'Conversation ID',
308
+ name: 'conversation_id',
309
+ type: 'string',
310
+ displayOptions: {
311
+ show: {
312
+ resource: ['lead'],
313
+ operation: ['create', 'update'],
314
+ useJsonInput: [false],
315
+ },
316
+ },
317
+ default: '',
318
+ description: 'ID de conversación de Chatwoot/AivenceGraph para vincular el lead con su historial',
319
+ },
320
+ {
321
+ displayName: 'Status',
322
+ name: 'status',
323
+ type: 'options',
324
+ options: [
325
+ {
326
+ name: 'New',
327
+ value: 'new',
328
+ },
329
+ {
330
+ name: 'Contacted',
331
+ value: 'contacted',
332
+ },
333
+ {
334
+ name: 'Qualified',
335
+ value: 'qualified',
336
+ },
337
+ {
338
+ name: 'Converted',
339
+ value: 'converted',
340
+ },
341
+ {
342
+ name: 'Lost',
343
+ value: 'lost',
344
+ },
345
+ ],
346
+ displayOptions: {
347
+ show: {
348
+ resource: ['lead'],
349
+ operation: ['create', 'update'],
350
+ useJsonInput: [false],
351
+ },
352
+ },
353
+ default: 'new',
354
+ description: 'Estado del lead',
355
+ },
356
+ {
357
+ displayName: 'Score',
358
+ name: 'score',
359
+ type: 'number',
360
+ typeOptions: {
361
+ minValue: 0,
362
+ maxValue: 100,
363
+ },
364
+ displayOptions: {
365
+ show: {
366
+ resource: ['lead'],
367
+ operation: ['create', 'update'],
368
+ useJsonInput: [false],
369
+ },
370
+ },
371
+ default: 0,
372
+ description: 'Puntuación del lead (0-100)',
373
+ },
374
+ {
375
+ displayName: 'Category',
376
+ name: 'category',
377
+ type: 'options',
378
+ options: [
379
+ {
380
+ name: 'Hot',
381
+ value: 'hot',
382
+ },
383
+ {
384
+ name: 'Warm',
385
+ value: 'warm',
386
+ },
387
+ {
388
+ name: 'Cold',
389
+ value: 'cold',
390
+ },
391
+ ],
392
+ displayOptions: {
393
+ show: {
394
+ resource: ['lead'],
395
+ operation: ['create', 'update'],
396
+ useJsonInput: [false],
397
+ },
398
+ },
399
+ default: 'warm',
400
+ description: 'Categoría del lead',
401
+ },
402
+ {
403
+ displayName: 'Tags',
404
+ name: 'tags',
405
+ type: 'string',
406
+ displayOptions: {
407
+ show: {
408
+ resource: ['lead'],
409
+ operation: ['create', 'update'],
410
+ useJsonInput: [false],
411
+ },
412
+ },
413
+ default: '',
414
+ description: 'Tags separados por comas (ej: "VIP,Urgente,Referido")',
415
+ },
416
+ {
417
+ displayName: 'Notes',
418
+ name: 'notes',
419
+ type: 'string',
420
+ typeOptions: {
421
+ rows: 4,
422
+ },
423
+ displayOptions: {
424
+ show: {
425
+ resource: ['lead'],
426
+ operation: ['create', 'update'],
427
+ useJsonInput: [false],
428
+ },
429
+ },
430
+ default: '',
431
+ description: 'Notas adicionales sobre el lead',
432
+ },
433
+ {
434
+ displayName: 'CRM ID',
435
+ name: 'crm_id',
436
+ type: 'string',
437
+ displayOptions: {
438
+ show: {
439
+ resource: ['lead'],
440
+ operation: ['create', 'update'],
441
+ useJsonInput: [false],
442
+ },
443
+ },
444
+ default: '',
445
+ description: 'ID del lead en sistema CRM externo',
446
+ },
447
+ // ============================================
448
+ // LEAD ADD ACTIVITY FIELDS
449
+ // ============================================
450
+ {
451
+ displayName: 'Activity Type',
452
+ name: 'activity_type',
453
+ type: 'options',
454
+ required: true,
455
+ options: [
456
+ {
457
+ name: 'Llamada',
458
+ value: 'llamada',
459
+ },
460
+ {
461
+ name: 'Email',
462
+ value: 'email',
463
+ },
464
+ {
465
+ name: 'WhatsApp',
466
+ value: 'whatsapp',
467
+ },
468
+ {
469
+ name: 'Reunión',
470
+ value: 'reunion',
471
+ },
472
+ {
473
+ name: 'Visita Propiedad',
474
+ value: 'visita_propiedad',
475
+ },
476
+ {
477
+ name: 'Seguimiento',
478
+ value: 'seguimiento',
479
+ },
480
+ {
481
+ name: 'Otro',
482
+ value: 'otro',
483
+ },
484
+ ],
485
+ displayOptions: {
486
+ show: {
487
+ resource: ['lead'],
488
+ operation: ['addActivity'],
489
+ },
490
+ },
491
+ default: 'llamada',
492
+ description: 'Tipo de actividad',
493
+ },
494
+ {
495
+ displayName: 'Description',
496
+ name: 'activity_description',
497
+ type: 'string',
498
+ required: true,
499
+ typeOptions: {
500
+ rows: 4,
501
+ },
502
+ displayOptions: {
503
+ show: {
504
+ resource: ['lead'],
505
+ operation: ['addActivity'],
506
+ },
507
+ },
508
+ default: '',
509
+ description: 'Descripción de la actividad',
510
+ },
300
511
  // ============================================
301
512
  // PROPERTY OPERATIONS
302
513
  // ============================================
@@ -537,14 +748,38 @@ class AivenceRealty {
537
748
  },
538
749
  },
539
750
  options: [
751
+ {
752
+ name: 'List',
753
+ value: 'list',
754
+ description: 'Listar citas',
755
+ action: 'Listar citas',
756
+ },
540
757
  {
541
758
  name: 'Create',
542
759
  value: 'create',
543
760
  description: 'Crear cita',
544
761
  action: 'Crear cita',
545
762
  },
763
+ {
764
+ name: 'Get',
765
+ value: 'get',
766
+ description: 'Obtener cita por ID',
767
+ action: 'Obtener cita',
768
+ },
769
+ {
770
+ name: 'Update Status',
771
+ value: 'updateStatus',
772
+ description: 'Actualizar estado de cita',
773
+ action: 'Actualizar estado',
774
+ },
775
+ {
776
+ name: 'Delete',
777
+ value: 'delete',
778
+ description: 'Eliminar cita',
779
+ action: 'Eliminar cita',
780
+ },
546
781
  ],
547
- default: 'create',
782
+ default: 'list',
548
783
  },
549
784
  {
550
785
  displayName: 'Usar datos del nodo anterior',
@@ -559,6 +794,54 @@ class AivenceRealty {
559
794
  default: true,
560
795
  description: 'Si está activado, usará el JSON completo del nodo anterior',
561
796
  },
797
+ // Appointment ID para get, updateStatus y delete
798
+ {
799
+ displayName: 'Appointment ID',
800
+ name: 'appointmentId',
801
+ type: 'string',
802
+ required: true,
803
+ displayOptions: {
804
+ show: {
805
+ resource: ['appointment'],
806
+ operation: ['get', 'updateStatus', 'delete'],
807
+ },
808
+ },
809
+ default: '',
810
+ description: 'ID de la cita',
811
+ },
812
+ // Estado para updateStatus
813
+ {
814
+ displayName: 'Estado',
815
+ name: 'appointment_status',
816
+ type: 'options',
817
+ required: true,
818
+ options: [
819
+ {
820
+ name: 'Pending',
821
+ value: 'pending',
822
+ },
823
+ {
824
+ name: 'Confirmed',
825
+ value: 'confirmed',
826
+ },
827
+ {
828
+ name: 'Completed',
829
+ value: 'completed',
830
+ },
831
+ {
832
+ name: 'Cancelled',
833
+ value: 'cancelled',
834
+ },
835
+ ],
836
+ displayOptions: {
837
+ show: {
838
+ resource: ['appointment'],
839
+ operation: ['updateStatus'],
840
+ },
841
+ },
842
+ default: 'pending',
843
+ description: 'Nuevo estado de la cita',
844
+ },
562
845
  ],
563
846
  };
564
847
  }
@@ -601,12 +884,23 @@ class AivenceRealty {
601
884
  budget_min: this.getNodeParameter('budget_min', i, 0),
602
885
  budget_max: this.getNodeParameter('budget_max', i, 0),
603
886
  property_type: this.getNodeParameter('property_type', i, 'apartamento'),
887
+ conversation_id: this.getNodeParameter('conversation_id', i, ''),
888
+ status: this.getNodeParameter('status', i, 'new'),
889
+ score: this.getNodeParameter('score', i, 0),
890
+ category: this.getNodeParameter('category', i, 'warm'),
891
+ notes: this.getNodeParameter('notes', i, ''),
892
+ crm_id: this.getNodeParameter('crm_id', i, ''),
604
893
  };
605
894
  // Procesar preferred_areas (convertir string separado por comas a array)
606
895
  const areasString = this.getNodeParameter('preferred_areas', i, '');
607
896
  if (areasString) {
608
897
  body.preferred_areas = areasString.split(',').map((area) => area.trim());
609
898
  }
899
+ // Procesar tags (convertir string separado por comas a array)
900
+ const tagsString = this.getNodeParameter('tags', i, '');
901
+ if (tagsString) {
902
+ body.tags = tagsString.split(',').map((tag) => tag.trim());
903
+ }
610
904
  // Remover campos vacíos opcionales
611
905
  if (!body.message)
612
906
  delete body.message;
@@ -616,6 +910,16 @@ class AivenceRealty {
616
910
  delete body.budget_max;
617
911
  if (!body.preferred_areas || body.preferred_areas.length === 0)
618
912
  delete body.preferred_areas;
913
+ if (!body.conversation_id)
914
+ delete body.conversation_id;
915
+ if (!body.notes)
916
+ delete body.notes;
917
+ if (!body.crm_id)
918
+ delete body.crm_id;
919
+ if (!body.tags || body.tags.length === 0)
920
+ delete body.tags;
921
+ if (body.score === 0)
922
+ delete body.score;
619
923
  }
620
924
  responseData = await this.helpers.httpRequest({
621
925
  method: 'POST',
@@ -643,6 +947,13 @@ class AivenceRealty {
643
947
  const budget_max = this.getNodeParameter('budget_max', i, 0);
644
948
  const property_type = this.getNodeParameter('property_type', i, '');
645
949
  const areasString = this.getNodeParameter('preferred_areas', i, '');
950
+ const conversation_id = this.getNodeParameter('conversation_id', i, '');
951
+ const status = this.getNodeParameter('status', i, '');
952
+ const score = this.getNodeParameter('score', i, 0);
953
+ const category = this.getNodeParameter('category', i, '');
954
+ const notes = this.getNodeParameter('notes', i, '');
955
+ const crm_id = this.getNodeParameter('crm_id', i, '');
956
+ const tagsString = this.getNodeParameter('tags', i, '');
646
957
  if (name)
647
958
  body.name = name;
648
959
  if (email)
@@ -659,9 +970,24 @@ class AivenceRealty {
659
970
  body.budget_max = budget_max;
660
971
  if (property_type)
661
972
  body.property_type = property_type;
973
+ if (conversation_id)
974
+ body.conversation_id = conversation_id;
975
+ if (status)
976
+ body.status = status;
977
+ if (score > 0)
978
+ body.score = score;
979
+ if (category)
980
+ body.category = category;
981
+ if (notes)
982
+ body.notes = notes;
983
+ if (crm_id)
984
+ body.crm_id = crm_id;
662
985
  if (areasString) {
663
986
  body.preferred_areas = areasString.split(',').map((area) => area.trim());
664
987
  }
988
+ if (tagsString) {
989
+ body.tags = tagsString.split(',').map((tag) => tag.trim());
990
+ }
665
991
  }
666
992
  responseData = await this.helpers.httpRequest({
667
993
  method: 'PATCH',
@@ -678,6 +1004,21 @@ class AivenceRealty {
678
1004
  json: true,
679
1005
  });
680
1006
  }
1007
+ else if (operation === 'addActivity') {
1008
+ const leadId = this.getNodeParameter('leadId', i);
1009
+ const activityType = this.getNodeParameter('activity_type', i);
1010
+ const description = this.getNodeParameter('activity_description', i);
1011
+ const body = {
1012
+ activity_type: activityType,
1013
+ description: description,
1014
+ };
1015
+ responseData = await this.helpers.httpRequest({
1016
+ method: 'POST',
1017
+ url: `${baseUrl}/api/v1/mariana/leads/${leadId}/activity`,
1018
+ body,
1019
+ json: true,
1020
+ });
1021
+ }
681
1022
  }
682
1023
  // ============================================
683
1024
  // PROPERTY RESOURCE
@@ -812,16 +1153,49 @@ class AivenceRealty {
812
1153
  // APPOINTMENT RESOURCE
813
1154
  // ============================================
814
1155
  else if (resource === 'appointment') {
815
- if (operation === 'create') {
1156
+ if (operation === 'list') {
1157
+ responseData = await this.helpers.httpRequest({
1158
+ method: 'GET',
1159
+ url: `${baseUrl}/api/v1/reservas`,
1160
+ json: true,
1161
+ });
1162
+ }
1163
+ else if (operation === 'create') {
816
1164
  const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
817
1165
  const body = useJsonInput ? items[i].json : {};
818
1166
  responseData = await this.helpers.httpRequest({
819
1167
  method: 'POST',
820
- url: `${baseUrl}/api/v1/appointments`,
1168
+ url: `${baseUrl}/api/v1/reservas`,
821
1169
  body,
822
1170
  json: true,
823
1171
  });
824
1172
  }
1173
+ else if (operation === 'get') {
1174
+ const appointmentId = this.getNodeParameter('appointmentId', i);
1175
+ responseData = await this.helpers.httpRequest({
1176
+ method: 'GET',
1177
+ url: `${baseUrl}/api/v1/reservas/${appointmentId}`,
1178
+ json: true,
1179
+ });
1180
+ }
1181
+ else if (operation === 'updateStatus') {
1182
+ const appointmentId = this.getNodeParameter('appointmentId', i);
1183
+ const status = this.getNodeParameter('appointment_status', i);
1184
+ responseData = await this.helpers.httpRequest({
1185
+ method: 'PUT',
1186
+ url: `${baseUrl}/api/v1/reservas/${appointmentId}/estado`,
1187
+ body: { estado: status },
1188
+ json: true,
1189
+ });
1190
+ }
1191
+ else if (operation === 'delete') {
1192
+ const appointmentId = this.getNodeParameter('appointmentId', i);
1193
+ responseData = await this.helpers.httpRequest({
1194
+ method: 'DELETE',
1195
+ url: `${baseUrl}/api/v1/reservas/${appointmentId}`,
1196
+ json: true,
1197
+ });
1198
+ }
825
1199
  }
826
1200
  // Formatear respuesta
827
1201
  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-aivencerealtycrm",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Nodo n8n para integrar el CRM inmobiliario AivenceRealty",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",