n8n-nodes-aivencerealtycrm 1.0.3 → 1.0.5

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.
@@ -32,74 +32,39 @@ class AivenceRealty {
32
32
  type: 'options',
33
33
  noDataExpression: true,
34
34
  options: [
35
- {
36
- name: 'Property',
37
- value: 'property',
38
- },
39
35
  {
40
36
  name: 'Lead',
41
37
  value: 'lead',
42
38
  },
43
39
  {
44
- name: 'Tenant',
45
- value: 'tenant',
40
+ name: 'Property',
41
+ value: 'property',
42
+ },
43
+ {
44
+ name: 'Email',
45
+ value: 'email',
46
46
  },
47
47
  {
48
- name: 'Maintenance Order',
49
- value: 'maintenanceOrder',
48
+ name: 'Maintenance Request',
49
+ value: 'maintenanceRequest',
50
50
  },
51
51
  {
52
52
  name: 'Contractor',
53
53
  value: 'contractor',
54
54
  },
55
55
  {
56
- name: 'Monthly Cost',
57
- value: 'monthlyCost',
56
+ name: 'Maintenance Cost',
57
+ value: 'maintenanceCost',
58
58
  },
59
59
  {
60
- name: 'WhatsApp',
61
- value: 'whatsapp',
60
+ name: 'Appointment',
61
+ value: 'appointment',
62
62
  },
63
63
  ],
64
- default: 'property',
64
+ default: 'lead',
65
65
  description: 'Recurso del CRM a operar',
66
66
  },
67
67
  // ============================================
68
- // PROPERTY OPERATIONS
69
- // ============================================
70
- {
71
- displayName: 'Operación',
72
- name: 'operation',
73
- type: 'options',
74
- noDataExpression: true,
75
- displayOptions: {
76
- show: {
77
- resource: ['property'],
78
- },
79
- },
80
- options: [
81
- {
82
- name: 'List',
83
- value: 'list',
84
- description: 'Listar todas las propiedades',
85
- action: 'Listar propiedades',
86
- },
87
- {
88
- name: 'Get Similar',
89
- value: 'getSimilar',
90
- description: 'Obtener propiedades similares',
91
- action: 'Obtener propiedades similares',
92
- },
93
- {
94
- name: 'Get Statistics',
95
- value: 'getStatistics',
96
- description: 'Obtener estadísticas de propiedades',
97
- action: 'Obtener estadísticas',
98
- },
99
- ],
100
- default: 'list',
101
- },
102
- // ============================================
103
68
  // LEAD OPERATIONS
104
69
  // ============================================
105
70
  {
@@ -116,66 +81,61 @@ class AivenceRealty {
116
81
  {
117
82
  name: 'List',
118
83
  value: 'list',
119
- description: 'Listar todos los leads',
84
+ description: 'Listar leads',
120
85
  action: 'Listar leads',
121
86
  },
122
87
  {
123
88
  name: 'Create',
124
89
  value: 'create',
125
- description: 'Crear un nuevo lead',
90
+ description: 'Crear nuevo lead',
126
91
  action: 'Crear lead',
127
92
  },
93
+ {
94
+ name: 'Update',
95
+ value: 'update',
96
+ description: 'Actualizar lead',
97
+ action: 'Actualizar lead',
98
+ },
99
+ {
100
+ name: 'Get',
101
+ value: 'get',
102
+ description: 'Obtener lead por ID',
103
+ action: 'Obtener lead',
104
+ },
128
105
  ],
129
106
  default: 'list',
130
107
  },
131
- // Lead Create Fields
108
+ // Lead ID (para Update y Get)
132
109
  {
133
- displayName: 'Nombre',
134
- name: 'nombre',
110
+ displayName: 'Lead ID',
111
+ name: 'leadId',
135
112
  type: 'string',
136
113
  required: true,
137
114
  displayOptions: {
138
115
  show: {
139
116
  resource: ['lead'],
140
- operation: ['create'],
117
+ operation: ['update', 'get'],
141
118
  },
142
119
  },
143
120
  default: '',
144
- description: 'Nombre completo del lead',
121
+ description: 'ID del lead',
145
122
  },
123
+ // Lead Create/Update: JSON from previous node
146
124
  {
147
- displayName: 'Teléfono',
148
- name: 'telefono',
149
- type: 'string',
150
- required: true,
125
+ displayName: 'Usar datos del nodo anterior',
126
+ name: 'useJsonInput',
127
+ type: 'boolean',
151
128
  displayOptions: {
152
129
  show: {
153
130
  resource: ['lead'],
154
- operation: ['create'],
131
+ operation: ['create', 'update'],
155
132
  },
156
133
  },
157
- default: '',
158
- description: 'Número de teléfono del lead',
159
- },
160
- {
161
- displayName: 'Mensaje',
162
- name: 'mensaje',
163
- type: 'string',
164
- typeOptions: {
165
- rows: 4,
166
- },
167
- required: true,
168
- displayOptions: {
169
- show: {
170
- resource: ['lead'],
171
- operation: ['create'],
172
- },
173
- },
174
- default: '',
175
- description: 'Mensaje o consulta del lead',
134
+ default: true,
135
+ description: 'Si está activado, usará el JSON completo del nodo anterior',
176
136
  },
177
137
  // ============================================
178
- // TENANT OPERATIONS
138
+ // PROPERTY OPERATIONS
179
139
  // ============================================
180
140
  {
181
141
  displayName: 'Operación',
@@ -184,202 +144,156 @@ class AivenceRealty {
184
144
  noDataExpression: true,
185
145
  displayOptions: {
186
146
  show: {
187
- resource: ['tenant'],
147
+ resource: ['property'],
188
148
  },
189
149
  },
190
150
  options: [
191
151
  {
192
152
  name: 'List',
193
153
  value: 'list',
194
- description: 'Listar todos los inquilinos',
195
- action: 'Listar inquilinos',
196
- },
197
- ],
198
- default: 'list',
199
- },
200
- // ============================================
201
- // MAINTENANCE ORDER OPERATIONS
202
- // ============================================
203
- {
204
- displayName: 'Operación',
205
- name: 'operation',
206
- type: 'options',
207
- noDataExpression: true,
208
- displayOptions: {
209
- show: {
210
- resource: ['maintenanceOrder'],
211
- },
212
- },
213
- options: [
214
- {
215
- name: 'Check Duplicate',
216
- value: 'checkDuplicate',
217
- description: 'Verificar si existe orden duplicada',
218
- action: 'Verificar duplicado',
219
- },
220
- {
221
- name: 'Create',
222
- value: 'create',
223
- description: 'Crear nueva orden de trabajo',
224
- action: 'Crear orden',
154
+ description: 'Listar propiedades',
155
+ action: 'Listar propiedades',
225
156
  },
226
157
  {
227
158
  name: 'Get',
228
159
  value: 'get',
229
- description: 'Obtener orden por ID',
230
- action: 'Obtener orden',
160
+ description: 'Obtener propiedad por ID',
161
+ action: 'Obtener propiedad',
231
162
  },
232
163
  {
233
- name: 'Update',
234
- value: 'update',
235
- description: 'Actualizar orden existente',
236
- action: 'Actualizar orden',
237
- },
238
- {
239
- name: 'List',
240
- value: 'list',
241
- description: 'Listar órdenes de trabajo',
242
- action: 'Listar órdenes',
164
+ name: 'Get Agent View',
165
+ value: 'getAgentView',
166
+ description: 'Vista de agente (búsqueda avanzada)',
167
+ action: 'Vista de agente',
243
168
  },
244
169
  ],
245
170
  default: 'list',
246
171
  },
247
- // Maintenance Order - Check Duplicate Fields
172
+ // Property ID
248
173
  {
249
174
  displayName: 'Property ID',
250
- name: 'propiedadId',
251
- type: 'number',
175
+ name: 'propertyId',
176
+ type: 'string',
252
177
  required: true,
253
178
  displayOptions: {
254
179
  show: {
255
- resource: ['maintenanceOrder'],
256
- operation: ['checkDuplicate'],
180
+ resource: ['property'],
181
+ operation: ['get', 'getAgentView'],
257
182
  },
258
183
  },
259
- default: 0,
184
+ default: '',
260
185
  description: 'ID de la propiedad',
261
186
  },
262
- // Maintenance Order - Get/Update ID Field
263
- {
264
- displayName: 'Order ID',
265
- name: 'orderId',
266
- type: 'number',
267
- required: true,
268
- displayOptions: {
269
- show: {
270
- resource: ['maintenanceOrder'],
271
- operation: ['get', 'update'],
272
- },
273
- },
274
- default: 0,
275
- description: 'ID de la orden de trabajo',
276
- },
277
- // Maintenance Order - Create Fields
187
+ // ============================================
188
+ // EMAIL OPERATIONS
189
+ // ============================================
278
190
  {
279
- displayName: 'Cliente ID',
280
- name: 'clienteId',
281
- type: 'number',
282
- required: true,
191
+ displayName: 'Operación',
192
+ name: 'operation',
193
+ type: 'options',
194
+ noDataExpression: true,
283
195
  displayOptions: {
284
196
  show: {
285
- resource: ['maintenanceOrder'],
286
- operation: ['create'],
197
+ resource: ['email'],
287
198
  },
288
199
  },
289
- default: 0,
290
- },
291
- {
292
- displayName: 'Propiedad ID',
293
- name: 'propiedadId',
294
- type: 'number',
295
- required: true,
296
- displayOptions: {
297
- show: {
298
- resource: ['maintenanceOrder'],
299
- operation: ['create'],
200
+ options: [
201
+ {
202
+ name: 'Ingest',
203
+ value: 'ingest',
204
+ description: 'Ingestar email al CRM',
205
+ action: 'Ingestar email',
300
206
  },
301
- },
302
- default: 0,
207
+ ],
208
+ default: 'ingest',
303
209
  },
304
210
  {
305
- displayName: 'Contratista ID',
306
- name: 'contratistaId',
307
- type: 'number',
308
- required: true,
211
+ displayName: 'Usar datos del nodo anterior',
212
+ name: 'useJsonInput',
213
+ type: 'boolean',
309
214
  displayOptions: {
310
215
  show: {
311
- resource: ['maintenanceOrder'],
312
- operation: ['create'],
216
+ resource: ['email'],
217
+ operation: ['ingest'],
313
218
  },
314
219
  },
315
- default: 0,
220
+ default: true,
221
+ description: 'Si está activado, usará el JSON completo del nodo anterior',
316
222
  },
223
+ // ============================================
224
+ // MAINTENANCE REQUEST OPERATIONS
225
+ // ============================================
317
226
  {
318
- displayName: 'Categoría',
319
- name: 'categoria',
227
+ displayName: 'Operación',
228
+ name: 'operation',
320
229
  type: 'options',
321
- required: true,
230
+ noDataExpression: true,
322
231
  displayOptions: {
323
232
  show: {
324
- resource: ['maintenanceOrder'],
325
- operation: ['create'],
233
+ resource: ['maintenanceRequest'],
326
234
  },
327
235
  },
328
236
  options: [
329
- { name: 'Fontanería', value: 'fontanería' },
330
- { name: 'Electricidad', value: 'electricidad' },
331
- { name: 'Pintura', value: 'pintura' },
332
- { name: 'Cerrajería', value: 'cerrajería' },
333
- { name: 'Carpintería', value: 'carpintería' },
334
- { name: 'Aires Acondicionados', value: 'aires_acondicionados' },
335
- { name: 'Otro', value: 'otro' },
336
- ],
337
- default: 'fontanería',
338
- },
339
- {
340
- displayName: 'Urgencia',
341
- name: 'urgencia',
342
- type: 'options',
343
- required: true,
344
- displayOptions: {
345
- show: {
346
- resource: ['maintenanceOrder'],
347
- operation: ['create'],
237
+ {
238
+ name: 'List',
239
+ value: 'list',
240
+ description: 'Listar solicitudes',
241
+ action: 'Listar solicitudes',
242
+ },
243
+ {
244
+ name: 'Get',
245
+ value: 'get',
246
+ description: 'Obtener solicitud por ID',
247
+ action: 'Obtener solicitud',
248
+ },
249
+ {
250
+ name: 'Create',
251
+ value: 'create',
252
+ description: 'Crear solicitud',
253
+ action: 'Crear solicitud',
254
+ },
255
+ {
256
+ name: 'Update',
257
+ value: 'update',
258
+ description: 'Actualizar solicitud',
259
+ action: 'Actualizar solicitud',
260
+ },
261
+ {
262
+ name: 'Add Message',
263
+ value: 'addMessage',
264
+ description: 'Agregar mensaje a solicitud',
265
+ action: 'Agregar mensaje',
348
266
  },
349
- },
350
- options: [
351
- { name: 'Baja', value: 'baja' },
352
- { name: 'Media', value: 'media' },
353
- { name: 'Alta', value: 'alta' },
354
267
  ],
355
- default: 'media',
268
+ default: 'list',
356
269
  },
270
+ // Maintenance Request ID
357
271
  {
358
- displayName: 'Descripción Corta',
359
- name: 'descripcionCorta',
272
+ displayName: 'Request ID',
273
+ name: 'requestId',
360
274
  type: 'string',
361
275
  required: true,
362
276
  displayOptions: {
363
277
  show: {
364
- resource: ['maintenanceOrder'],
365
- operation: ['create'],
278
+ resource: ['maintenanceRequest'],
279
+ operation: ['get', 'update', 'addMessage'],
366
280
  },
367
281
  },
368
282
  default: '',
283
+ description: 'ID de la solicitud',
369
284
  },
370
285
  {
371
- displayName: 'Descripción Detallada',
372
- name: 'descripcionDetallada',
373
- type: 'string',
374
- typeOptions: { rows: 4 },
375
- required: true,
286
+ displayName: 'Usar datos del nodo anterior',
287
+ name: 'useJsonInput',
288
+ type: 'boolean',
376
289
  displayOptions: {
377
290
  show: {
378
- resource: ['maintenanceOrder'],
379
- operation: ['create'],
291
+ resource: ['maintenanceRequest'],
292
+ operation: ['create', 'update', 'addMessage'],
380
293
  },
381
294
  },
382
- default: '',
295
+ default: true,
296
+ description: 'Si está activado, usará el JSON completo del nodo anterior',
383
297
  },
384
298
  // ============================================
385
299
  // CONTRACTOR OPERATIONS
@@ -396,44 +310,22 @@ class AivenceRealty {
396
310
  },
397
311
  options: [
398
312
  {
399
- name: 'Find By Category',
400
- value: 'findByCategory',
401
- description: 'Buscar contratista por categoría',
402
- action: 'Buscar por categoría',
313
+ name: 'List',
314
+ value: 'list',
315
+ description: 'Listar contractors',
316
+ action: 'Listar contractors',
403
317
  },
404
318
  {
405
- name: 'Find Alternatives',
406
- value: 'findAlternatives',
407
- description: 'Buscar contratistas alternativos',
408
- action: 'Buscar alternativos',
319
+ name: 'Get Next Available',
320
+ value: 'getNextAvailable',
321
+ description: 'Obtener siguiente disponible',
322
+ action: 'Obtener siguiente disponible',
409
323
  },
410
324
  ],
411
- default: 'findByCategory',
412
- },
413
- // Contractor - Find By Category
414
- {
415
- displayName: 'Categoría',
416
- name: 'categoria',
417
- type: 'options',
418
- required: true,
419
- displayOptions: {
420
- show: {
421
- resource: ['contractor'],
422
- operation: ['findByCategory'],
423
- },
424
- },
425
- options: [
426
- { name: 'Fontanería', value: 'fontanería' },
427
- { name: 'Electricidad', value: 'electricidad' },
428
- { name: 'Pintura', value: 'pintura' },
429
- { name: 'Cerrajería', value: 'cerrajería' },
430
- { name: 'Carpintería', value: 'carpintería' },
431
- { name: 'Aires Acondicionados', value: 'aires_acondicionados' },
432
- ],
433
- default: 'fontanería',
325
+ default: 'list',
434
326
  },
435
327
  // ============================================
436
- // MONTHLY COST OPERATIONS
328
+ // MAINTENANCE COST OPERATIONS
437
329
  // ============================================
438
330
  {
439
331
  displayName: 'Operación',
@@ -442,75 +334,34 @@ class AivenceRealty {
442
334
  noDataExpression: true,
443
335
  displayOptions: {
444
336
  show: {
445
- resource: ['monthlyCost'],
337
+ resource: ['maintenanceCost'],
446
338
  },
447
339
  },
448
340
  options: [
449
341
  {
450
- name: 'Track',
451
- value: 'track',
452
- description: 'Registrar costo mensual',
453
- action: 'Registrar costo',
342
+ name: 'Create',
343
+ value: 'create',
344
+ description: 'Crear costo de mantenimiento',
345
+ action: 'Crear costo',
454
346
  },
455
347
  ],
456
- default: 'track',
348
+ default: 'create',
457
349
  },
458
- // Monthly Cost - Track Fields
459
350
  {
460
- displayName: 'Mes',
461
- name: 'mes',
462
- type: 'number',
463
- required: true,
351
+ displayName: 'Usar datos del nodo anterior',
352
+ name: 'useJsonInput',
353
+ type: 'boolean',
464
354
  displayOptions: {
465
355
  show: {
466
- resource: ['monthlyCost'],
467
- operation: ['track'],
468
- },
469
- },
470
- default: new Date().getMonth() + 1,
471
- description: 'Mes (1-12)',
472
- },
473
- {
474
- displayName: 'Año',
475
- name: 'anio',
476
- type: 'number',
477
- required: true,
478
- displayOptions: {
479
- show: {
480
- resource: ['monthlyCost'],
481
- operation: ['track'],
482
- },
483
- },
484
- default: new Date().getFullYear(),
485
- },
486
- {
487
- displayName: 'Categoría',
488
- name: 'categoria',
489
- type: 'string',
490
- required: true,
491
- displayOptions: {
492
- show: {
493
- resource: ['monthlyCost'],
494
- operation: ['track'],
495
- },
496
- },
497
- default: '',
498
- },
499
- {
500
- displayName: 'Total Gastado',
501
- name: 'totalGastado',
502
- type: 'number',
503
- required: true,
504
- displayOptions: {
505
- show: {
506
- resource: ['monthlyCost'],
507
- operation: ['track'],
356
+ resource: ['maintenanceCost'],
357
+ operation: ['create'],
508
358
  },
509
359
  },
510
- default: 0,
360
+ default: true,
361
+ description: 'Si está activado, usará el JSON completo del nodo anterior',
511
362
  },
512
363
  // ============================================
513
- // WHATSAPP OPERATIONS
364
+ // APPOINTMENT OPERATIONS
514
365
  // ============================================
515
366
  {
516
367
  displayName: 'Operación',
@@ -519,48 +370,31 @@ class AivenceRealty {
519
370
  noDataExpression: true,
520
371
  displayOptions: {
521
372
  show: {
522
- resource: ['whatsapp'],
373
+ resource: ['appointment'],
523
374
  },
524
375
  },
525
376
  options: [
526
377
  {
527
- name: 'Send Message',
528
- value: 'sendMessage',
529
- description: 'Enviar mensaje por WhatsApp',
530
- action: 'Enviar mensaje',
378
+ name: 'Create',
379
+ value: 'create',
380
+ description: 'Crear cita',
381
+ action: 'Crear cita',
531
382
  },
532
383
  ],
533
- default: 'sendMessage',
384
+ default: 'create',
534
385
  },
535
- // WhatsApp - Send Message Fields
536
386
  {
537
- displayName: 'Número',
538
- name: 'numero',
539
- type: 'string',
540
- required: true,
387
+ displayName: 'Usar datos del nodo anterior',
388
+ name: 'useJsonInput',
389
+ type: 'boolean',
541
390
  displayOptions: {
542
391
  show: {
543
- resource: ['whatsapp'],
544
- operation: ['sendMessage'],
545
- },
546
- },
547
- default: '',
548
- placeholder: '5491112345678',
549
- description: 'Número de WhatsApp (con código de país)',
550
- },
551
- {
552
- displayName: 'Mensaje',
553
- name: 'mensaje',
554
- type: 'string',
555
- typeOptions: { rows: 4 },
556
- required: true,
557
- displayOptions: {
558
- show: {
559
- resource: ['whatsapp'],
560
- operation: ['sendMessage'],
392
+ resource: ['appointment'],
393
+ operation: ['create'],
561
394
  },
562
395
  },
563
- default: '',
396
+ default: true,
397
+ description: 'Si está activado, usará el JSON completo del nodo anterior',
564
398
  },
565
399
  ],
566
400
  };
@@ -576,124 +410,137 @@ class AivenceRealty {
576
410
  const operation = this.getNodeParameter('operation', i);
577
411
  let responseData;
578
412
  // ============================================
579
- // PROPERTY RESOURCE
413
+ // LEAD RESOURCE
580
414
  // ============================================
581
- if (resource === 'property') {
415
+ if (resource === 'lead') {
582
416
  if (operation === 'list') {
583
417
  responseData = await this.helpers.httpRequest({
584
418
  method: 'GET',
585
- url: `${baseUrl}/api/v1/properties`,
419
+ url: `${baseUrl}/api/v1/leads`,
586
420
  json: true,
587
421
  });
588
422
  }
589
- else if (operation === 'getSimilar') {
423
+ else if (operation === 'create') {
424
+ const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
425
+ const body = useJsonInput ? items[i].json : {};
590
426
  responseData = await this.helpers.httpRequest({
591
- method: 'GET',
592
- url: `${baseUrl}/api/v1/properties/similares`,
427
+ method: 'POST',
428
+ url: `${baseUrl}/api/v1/leads`,
429
+ body,
430
+ json: true,
431
+ });
432
+ }
433
+ else if (operation === 'update') {
434
+ const leadId = this.getNodeParameter('leadId', i);
435
+ const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
436
+ const body = useJsonInput ? items[i].json : {};
437
+ responseData = await this.helpers.httpRequest({
438
+ method: 'PATCH',
439
+ url: `${baseUrl}/api/v1/leads/${leadId}`,
440
+ body,
593
441
  json: true,
594
442
  });
595
443
  }
596
- else if (operation === 'getStatistics') {
444
+ else if (operation === 'get') {
445
+ const leadId = this.getNodeParameter('leadId', i);
597
446
  responseData = await this.helpers.httpRequest({
598
447
  method: 'GET',
599
- url: `${baseUrl}/api/v1/properties/estadisticas`,
448
+ url: `${baseUrl}/api/v1/leads/${leadId}`,
600
449
  json: true,
601
450
  });
602
451
  }
603
452
  }
604
453
  // ============================================
605
- // LEAD RESOURCE
454
+ // PROPERTY RESOURCE
606
455
  // ============================================
607
- else if (resource === 'lead') {
456
+ else if (resource === 'property') {
608
457
  if (operation === 'list') {
609
458
  responseData = await this.helpers.httpRequest({
610
459
  method: 'GET',
611
- url: `${baseUrl}/api/v1/leads`,
460
+ url: `${baseUrl}/api/v1/properties`,
612
461
  json: true,
613
462
  });
614
463
  }
615
- else if (operation === 'create') {
616
- const body = {
617
- nombre: this.getNodeParameter('nombre', i),
618
- telefono: this.getNodeParameter('telefono', i),
619
- mensaje: this.getNodeParameter('mensaje', i),
620
- };
464
+ else if (operation === 'get') {
465
+ const propertyId = this.getNodeParameter('propertyId', i);
621
466
  responseData = await this.helpers.httpRequest({
622
- method: 'POST',
623
- url: `${baseUrl}/api/v1/leads`,
624
- body,
467
+ method: 'GET',
468
+ url: `${baseUrl}/api/v1/properties/${propertyId}`,
625
469
  json: true,
626
470
  });
627
471
  }
628
- }
629
- // ============================================
630
- // TENANT RESOURCE
631
- // ============================================
632
- else if (resource === 'tenant') {
633
- if (operation === 'list') {
472
+ else if (operation === 'getAgentView') {
473
+ const propertyId = this.getNodeParameter('propertyId', i);
634
474
  responseData = await this.helpers.httpRequest({
635
475
  method: 'GET',
636
- url: `${baseUrl}/api/v1/tenants`,
476
+ url: `${baseUrl}/api/v1/propiedades/agent/${propertyId}`,
637
477
  json: true,
638
478
  });
639
479
  }
640
480
  }
641
481
  // ============================================
642
- // MAINTENANCE ORDER RESOURCE
482
+ // EMAIL RESOURCE
643
483
  // ============================================
644
- else if (resource === 'maintenanceOrder') {
645
- if (operation === 'checkDuplicate') {
646
- const body = {
647
- propiedad_id: this.getNodeParameter('propiedadId', i),
648
- estado: 'abierto',
649
- };
484
+ else if (resource === 'email') {
485
+ if (operation === 'ingest') {
486
+ const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
487
+ const body = useJsonInput ? items[i].json : {};
650
488
  responseData = await this.helpers.httpRequest({
651
489
  method: 'POST',
652
- url: `${baseUrl}/api/ordenes-trabajo/verificar-duplicado`,
490
+ url: `${baseUrl}/api/v1/emails/ingest`,
653
491
  body,
654
492
  json: true,
655
493
  });
656
494
  }
657
- else if (operation === 'create') {
658
- const body = {
659
- cliente_id: this.getNodeParameter('clienteId', i),
660
- propiedad_id: this.getNodeParameter('propiedadId', i),
661
- contratista_id: this.getNodeParameter('contratistaId', i),
662
- categoria: this.getNodeParameter('categoria', i),
663
- urgencia: this.getNodeParameter('urgencia', i),
664
- descripcion_corta: this.getNodeParameter('descripcionCorta', i),
665
- descripcion_detallada: this.getNodeParameter('descripcionDetallada', i),
666
- estado: 'pendiente_aceptacion',
667
- };
495
+ }
496
+ // ============================================
497
+ // MAINTENANCE REQUEST RESOURCE
498
+ // ============================================
499
+ else if (resource === 'maintenanceRequest') {
500
+ if (operation === 'list') {
668
501
  responseData = await this.helpers.httpRequest({
669
- method: 'POST',
670
- url: `${baseUrl}/api/ordenes-trabajo`,
671
- body,
502
+ method: 'GET',
503
+ url: `${baseUrl}/api/maintenance-requests`,
672
504
  json: true,
673
505
  });
674
506
  }
675
507
  else if (operation === 'get') {
676
- const orderId = this.getNodeParameter('orderId', i);
508
+ const requestId = this.getNodeParameter('requestId', i);
677
509
  responseData = await this.helpers.httpRequest({
678
510
  method: 'GET',
679
- url: `${baseUrl}/api/ordenes-trabajo/${orderId}`,
511
+ url: `${baseUrl}/api/maintenance-requests/${requestId}`,
512
+ json: true,
513
+ });
514
+ }
515
+ else if (operation === 'create') {
516
+ const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
517
+ const body = useJsonInput ? items[i].json : {};
518
+ responseData = await this.helpers.httpRequest({
519
+ method: 'POST',
520
+ url: `${baseUrl}/api/maintenance-requests`,
521
+ body,
680
522
  json: true,
681
523
  });
682
524
  }
683
525
  else if (operation === 'update') {
684
- const orderId = this.getNodeParameter('orderId', i);
685
- // Aquí puedes añadir los campos a actualizar según necesites
526
+ const requestId = this.getNodeParameter('requestId', i);
527
+ const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
528
+ const body = useJsonInput ? items[i].json : {};
686
529
  responseData = await this.helpers.httpRequest({
687
530
  method: 'PATCH',
688
- url: `${baseUrl}/api/ordenes-trabajo/${orderId}`,
689
- body: {},
531
+ url: `${baseUrl}/api/maintenance-requests/${requestId}`,
532
+ body,
690
533
  json: true,
691
534
  });
692
535
  }
693
- else if (operation === 'list') {
536
+ else if (operation === 'addMessage') {
537
+ const requestId = this.getNodeParameter('requestId', i);
538
+ const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
539
+ const body = useJsonInput ? items[i].json : {};
694
540
  responseData = await this.helpers.httpRequest({
695
- method: 'GET',
696
- url: `${baseUrl}/api/ordenes-trabajo`,
541
+ method: 'PATCH',
542
+ url: `${baseUrl}/api/maintenance-requests/${requestId}/add-message`,
543
+ body,
697
544
  json: true,
698
545
  });
699
546
  }
@@ -702,54 +549,46 @@ class AivenceRealty {
702
549
  // CONTRACTOR RESOURCE
703
550
  // ============================================
704
551
  else if (resource === 'contractor') {
705
- if (operation === 'findByCategory') {
706
- const categoria = this.getNodeParameter('categoria', i);
552
+ if (operation === 'list') {
707
553
  responseData = await this.helpers.httpRequest({
708
554
  method: 'GET',
709
- url: `${baseUrl}/api/contratistas/por-categoria`,
710
- qs: { categoria },
555
+ url: `${baseUrl}/api/contractors`,
711
556
  json: true,
712
557
  });
713
558
  }
714
- else if (operation === 'findAlternatives') {
559
+ else if (operation === 'getNextAvailable') {
715
560
  responseData = await this.helpers.httpRequest({
716
561
  method: 'GET',
717
- url: `${baseUrl}/api/contratistas/alternativos`,
562
+ url: `${baseUrl}/api/contractors/next-available`,
718
563
  json: true,
719
564
  });
720
565
  }
721
566
  }
722
567
  // ============================================
723
- // MONTHLY COST RESOURCE
568
+ // MAINTENANCE COST RESOURCE
724
569
  // ============================================
725
- else if (resource === 'monthlyCost') {
726
- if (operation === 'track') {
727
- const body = {
728
- mes: this.getNodeParameter('mes', i),
729
- anio: this.getNodeParameter('anio', i),
730
- categoria: this.getNodeParameter('categoria', i),
731
- total_gastado: this.getNodeParameter('totalGastado', i),
732
- };
570
+ else if (resource === 'maintenanceCost') {
571
+ if (operation === 'create') {
572
+ const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
573
+ const body = useJsonInput ? items[i].json : {};
733
574
  responseData = await this.helpers.httpRequest({
734
575
  method: 'POST',
735
- url: `${baseUrl}/api/costos-mensuales`,
576
+ url: `${baseUrl}/api/maintenance-costs`,
736
577
  body,
737
578
  json: true,
738
579
  });
739
580
  }
740
581
  }
741
582
  // ============================================
742
- // WHATSAPP RESOURCE
583
+ // APPOINTMENT RESOURCE
743
584
  // ============================================
744
- else if (resource === 'whatsapp') {
745
- if (operation === 'sendMessage') {
746
- const body = {
747
- number: this.getNodeParameter('numero', i),
748
- text: this.getNodeParameter('mensaje', i),
749
- };
585
+ else if (resource === 'appointment') {
586
+ if (operation === 'create') {
587
+ const useJsonInput = this.getNodeParameter('useJsonInput', i, true);
588
+ const body = useJsonInput ? items[i].json : {};
750
589
  responseData = await this.helpers.httpRequest({
751
590
  method: 'POST',
752
- url: `${baseUrl}/api/evolution/send-message`,
591
+ url: `${baseUrl}/api/v1/appointments`,
753
592
  body,
754
593
  json: true,
755
594
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-aivencerealtycrm",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Nodo n8n para integrar el CRM inmobiliario AivenceRealty",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",