n8n-nodes-aivence-realty 0.1.3 → 0.1.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.
@@ -64,11 +64,38 @@ class AivenceRealty {
64
64
  name: 'Calculator',
65
65
  value: 'calculator',
66
66
  },
67
+ {
68
+ name: 'Email',
69
+ value: 'email',
70
+ },
67
71
  ],
68
72
  default: 'property',
69
73
  description: 'Recurso del CRM a operar',
70
74
  },
71
75
  // ============================================
76
+ // EMAIL OPERATIONS
77
+ // ============================================
78
+ {
79
+ displayName: 'Operación',
80
+ name: 'operation',
81
+ type: 'options',
82
+ noDataExpression: true,
83
+ displayOptions: {
84
+ show: {
85
+ resource: ['email'],
86
+ },
87
+ },
88
+ options: [
89
+ {
90
+ name: 'Ingest',
91
+ value: 'ingest',
92
+ description: 'Ingestar email en la bandeja del CRM',
93
+ action: 'Ingestar email',
94
+ },
95
+ ],
96
+ default: 'ingest',
97
+ },
98
+ // ============================================
72
99
  // PROPERTY OPERATIONS
73
100
  // ============================================
74
101
  {
@@ -82,6 +109,12 @@ class AivenceRealty {
82
109
  },
83
110
  },
84
111
  options: [
112
+ {
113
+ name: 'Search',
114
+ value: 'search',
115
+ description: 'Buscar propiedades con filtros avanzados',
116
+ action: 'Buscar propiedades',
117
+ },
85
118
  {
86
119
  name: 'List',
87
120
  value: 'list',
@@ -104,6 +137,177 @@ class AivenceRealty {
104
137
  default: 'list',
105
138
  },
106
139
  // ============================================
140
+ // PROPERTY SEARCH PARAMETERS
141
+ // ============================================
142
+ {
143
+ displayName: 'Property ID',
144
+ name: 'propertyId',
145
+ type: 'number',
146
+ displayOptions: {
147
+ show: {
148
+ resource: ['property'],
149
+ operation: ['search'],
150
+ },
151
+ },
152
+ default: 0,
153
+ description: 'ID específico de la propiedad (opcional)',
154
+ },
155
+ {
156
+ displayName: 'Operación',
157
+ name: 'operacion',
158
+ type: 'options',
159
+ displayOptions: {
160
+ show: {
161
+ resource: ['property'],
162
+ operation: ['search'],
163
+ },
164
+ },
165
+ options: [
166
+ { name: 'Alquiler', value: 'Alquiler' },
167
+ { name: 'Compra', value: 'Compra' },
168
+ ],
169
+ default: 'Alquiler',
170
+ description: 'Tipo de operación inmobiliaria',
171
+ },
172
+ {
173
+ displayName: 'Tipo de Propiedad',
174
+ name: 'tipoPropiedad',
175
+ type: 'options',
176
+ displayOptions: {
177
+ show: {
178
+ resource: ['property'],
179
+ operation: ['search'],
180
+ },
181
+ },
182
+ options: [
183
+ { name: 'Casa', value: 'casa' },
184
+ { name: 'Apartamento', value: 'apartamento' },
185
+ { name: 'Departamento', value: 'apartamento' },
186
+ { name: 'Duplex', value: 'duplex' },
187
+ { name: 'PH', value: 'ph' },
188
+ { name: 'Local Comercial', value: 'local_comercial' },
189
+ { name: 'Oficina', value: 'oficina' },
190
+ { name: 'Terreno', value: 'terreno' },
191
+ { name: 'Bodega', value: 'bodega' },
192
+ { name: 'Quinta', value: 'quinta' },
193
+ { name: 'Cochera', value: 'cochera' },
194
+ ],
195
+ default: '',
196
+ description: 'Tipo de propiedad a buscar',
197
+ },
198
+ {
199
+ displayName: 'Zonas (Barrios)',
200
+ name: 'zonas',
201
+ type: 'string',
202
+ displayOptions: {
203
+ show: {
204
+ resource: ['property'],
205
+ operation: ['search'],
206
+ },
207
+ },
208
+ default: '',
209
+ placeholder: 'Núñez, Saavedra, Belgrano',
210
+ description: 'Zonas separadas por coma (Smart Zone Logic aplicado automáticamente)',
211
+ },
212
+ {
213
+ displayName: 'Dormitorios Mínimo',
214
+ name: 'dormitoriosMinimo',
215
+ type: 'number',
216
+ displayOptions: {
217
+ show: {
218
+ resource: ['property'],
219
+ operation: ['search'],
220
+ },
221
+ },
222
+ default: 0,
223
+ description: 'Cantidad mínima de dormitorios',
224
+ },
225
+ {
226
+ displayName: 'Dormitorios Máximo',
227
+ name: 'dormitoriosMaximo',
228
+ type: 'number',
229
+ displayOptions: {
230
+ show: {
231
+ resource: ['property'],
232
+ operation: ['search'],
233
+ },
234
+ },
235
+ default: 0,
236
+ description: 'Cantidad máxima de dormitorios',
237
+ },
238
+ {
239
+ displayName: 'Baños',
240
+ name: 'banos',
241
+ type: 'number',
242
+ displayOptions: {
243
+ show: {
244
+ resource: ['property'],
245
+ operation: ['search'],
246
+ },
247
+ },
248
+ default: 0,
249
+ description: 'Cantidad de baños',
250
+ },
251
+ {
252
+ displayName: 'Precio Mínimo',
253
+ name: 'precioMinimo',
254
+ type: 'number',
255
+ displayOptions: {
256
+ show: {
257
+ resource: ['property'],
258
+ operation: ['search'],
259
+ },
260
+ },
261
+ default: 0,
262
+ description: 'Precio mínimo en USD',
263
+ },
264
+ {
265
+ displayName: 'Precio Máximo',
266
+ name: 'precioMaximo',
267
+ type: 'number',
268
+ displayOptions: {
269
+ show: {
270
+ resource: ['property'],
271
+ operation: ['search'],
272
+ },
273
+ },
274
+ default: 0,
275
+ description: 'Precio máximo en USD',
276
+ },
277
+ {
278
+ displayName: 'Estado',
279
+ name: 'estado',
280
+ type: 'options',
281
+ displayOptions: {
282
+ show: {
283
+ resource: ['property'],
284
+ operation: ['search'],
285
+ },
286
+ },
287
+ options: [
288
+ { name: 'Activo', value: 'activo' },
289
+ { name: 'Inactivo', value: 'inactivo' },
290
+ { name: 'Vendido', value: 'vendido' },
291
+ { name: 'Alquilado', value: 'alquilado' },
292
+ ],
293
+ default: 'activo',
294
+ description: 'Estado de la propiedad',
295
+ },
296
+ {
297
+ displayName: 'Amenidades',
298
+ name: 'amenidades',
299
+ type: 'string',
300
+ displayOptions: {
301
+ show: {
302
+ resource: ['property'],
303
+ operation: ['search'],
304
+ },
305
+ },
306
+ default: '',
307
+ placeholder: 'Piscina, Gimnasio, Parrilla',
308
+ description: 'Amenidades separadas por coma',
309
+ },
310
+ // ============================================
107
311
  // LEAD OPERATIONS
108
312
  // ============================================
109
313
  {
@@ -691,6 +895,7 @@ class AivenceRealty {
691
895
  const returnData = [];
692
896
  const credentials = await this.getCredentials('aivenceRealtyApi');
693
897
  const baseUrl = credentials.baseUrl;
898
+ const apiKey = credentials.apiKey;
694
899
  for (let i = 0; i < items.length; i++) {
695
900
  try {
696
901
  const resource = this.getNodeParameter('resource', i);
@@ -700,7 +905,72 @@ class AivenceRealty {
700
905
  // PROPERTY RESOURCE
701
906
  // ============================================
702
907
  if (resource === 'property') {
703
- if (operation === 'list') {
908
+ if (operation === 'search') {
909
+ // ============================================
910
+ // PROPERTY SEARCH - Smart Zone Logic
911
+ // ============================================
912
+ const qs = {};
913
+ // Property ID (búsqueda directa por ID)
914
+ const propertyId = this.getNodeParameter('propertyId', i);
915
+ if (propertyId > 0) {
916
+ qs.id = propertyId;
917
+ }
918
+ // Operación (Alquiler/Compra)
919
+ const operacion = this.getNodeParameter('operacion', i);
920
+ if (operacion && operacion !== 'NULL') {
921
+ qs.operacion = operacion;
922
+ }
923
+ // Tipo de Propiedad
924
+ const tipoPropiedad = this.getNodeParameter('tipoPropiedad', i);
925
+ if (tipoPropiedad && tipoPropiedad !== '' && tipoPropiedad !== 'NULL') {
926
+ qs.tipo_propiedad = tipoPropiedad;
927
+ }
928
+ // Zonas (barrios) - Smart Zone Logic aplicado en el workflow
929
+ const zonas = this.getNodeParameter('zonas', i);
930
+ if (zonas && zonas !== '' && zonas !== 'NULL' && zonas !== 'null') {
931
+ qs.barrio = zonas; // Ya viene con formato "Núñez, Saavedra, Belgrano"
932
+ }
933
+ // Dormitorios
934
+ const dormitoriosMinimo = this.getNodeParameter('dormitoriosMinimo', i);
935
+ if (dormitoriosMinimo > 0) {
936
+ qs.dormitorios_minimo = dormitoriosMinimo;
937
+ }
938
+ const dormitoriosMaximo = this.getNodeParameter('dormitoriosMaximo', i);
939
+ if (dormitoriosMaximo > 0) {
940
+ qs.dormitorios_maximo = dormitoriosMaximo;
941
+ }
942
+ // Baños
943
+ const banos = this.getNodeParameter('banos', i);
944
+ if (banos > 0) {
945
+ qs.banos = banos;
946
+ }
947
+ // Precio
948
+ const precioMinimo = this.getNodeParameter('precioMinimo', i);
949
+ if (precioMinimo > 0) {
950
+ qs.precio_minimo = precioMinimo;
951
+ }
952
+ const precioMaximo = this.getNodeParameter('precioMaximo', i);
953
+ if (precioMaximo > 0) {
954
+ qs.precio_maximo = precioMaximo;
955
+ }
956
+ // Estado
957
+ const estado = this.getNodeParameter('estado', i);
958
+ if (estado && estado !== '') {
959
+ qs.estado = estado;
960
+ }
961
+ // Amenidades
962
+ const amenidades = this.getNodeParameter('amenidades', i);
963
+ if (amenidades && amenidades !== '' && amenidades !== 'NULL') {
964
+ qs.amenidades = amenidades;
965
+ }
966
+ responseData = await this.helpers.httpRequest({
967
+ method: 'GET',
968
+ url: `${baseUrl}/api/v1/properties`,
969
+ qs,
970
+ json: true,
971
+ });
972
+ }
973
+ else if (operation === 'list') {
704
974
  responseData = await this.helpers.httpRequest({
705
975
  method: 'GET',
706
976
  url: `${baseUrl}/api/v1/properties`,
@@ -919,6 +1189,37 @@ class AivenceRealty {
919
1189
  });
920
1190
  }
921
1191
  }
1192
+ // ============================================
1193
+ // EMAIL RESOURCE
1194
+ // ============================================
1195
+ else if (resource === 'email') {
1196
+ if (operation === 'ingest') {
1197
+ // Tomar los datos directamente del input (viene del Code node anterior)
1198
+ const inputData = items[i].json;
1199
+ const body = {
1200
+ message_id: inputData.message_id,
1201
+ from_email: inputData.from_email,
1202
+ from_name: inputData.from_name,
1203
+ to_email: inputData.to_email,
1204
+ subject: inputData.subject,
1205
+ body_text: inputData.body_text,
1206
+ body_html: inputData.body_html,
1207
+ category: inputData.category,
1208
+ received_at: inputData.received_at,
1209
+ };
1210
+ responseData = await this.helpers.httpRequest({
1211
+ method: 'POST',
1212
+ url: `${baseUrl}/api/v1/emails/ingest`,
1213
+ headers: {
1214
+ 'Authorization': `Bearer ${apiKey}`,
1215
+ 'Accept': 'application/json',
1216
+ 'Content-Type': 'application/json',
1217
+ },
1218
+ body,
1219
+ json: true,
1220
+ });
1221
+ }
1222
+ }
922
1223
  // Formatear respuesta
923
1224
  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
924
1225
  returnData.push(...executionData);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-aivence-realty",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Nodo n8n para integrar el CRM inmobiliario AivenceRealty",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",