n8n-nodes-aivencerealtycrm 1.8.9 → 1.9.1
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.
- package/dist/nodes/AivenceRealty/AivenceRealty.node.js +4 -4
- package/package.json +2 -3
- package/dist/nodes/AivenceSocialMedia/AivenceSocialMedia.node.d.ts +0 -5
- package/dist/nodes/AivenceSocialMedia/AivenceSocialMedia.node.js +0 -234
- package/dist/nodes/AivenceSocialMedia/aivencesocialmedia.png +0 -0
|
@@ -1840,7 +1840,7 @@ class AivenceRealty {
|
|
|
1840
1840
|
// Operación -> Estado (Laravel espera "estado": "for_rent" o "for_sale")
|
|
1841
1841
|
const operacion = this.getNodeParameter('searchOperacion', i, '');
|
|
1842
1842
|
if (operacion && operacion !== 'NULL' && operacion !== '') {
|
|
1843
|
-
qs.
|
|
1843
|
+
qs.operacion = operacion;
|
|
1844
1844
|
}
|
|
1845
1845
|
// Tipo de Propiedad
|
|
1846
1846
|
const tipoPropiedad = this.getNodeParameter('searchTipoPropiedad', i, '');
|
|
@@ -1850,7 +1850,7 @@ class AivenceRealty {
|
|
|
1850
1850
|
// Zonas (barrios) - Smart Zone Logic aplicado desde workflow
|
|
1851
1851
|
const zonas = this.getNodeParameter('searchZonas', i, '');
|
|
1852
1852
|
if (zonas && zonas !== '' && zonas !== 'NULL' && zonas !== 'null') {
|
|
1853
|
-
qs.
|
|
1853
|
+
qs.zona = zonas; // Formato: "Núñez, Saavedra, Belgrano"
|
|
1854
1854
|
}
|
|
1855
1855
|
// Dormitorios
|
|
1856
1856
|
const dormitoriosMin = this.getNodeParameter('searchDormitoriosMin', i, 0);
|
|
@@ -1925,7 +1925,7 @@ class AivenceRealty {
|
|
|
1925
1925
|
// Operación -> Estado (Laravel espera "estado": "for_rent" o "for_sale")
|
|
1926
1926
|
const operacion = this.getNodeParameter('searchOperacion', i, '');
|
|
1927
1927
|
if (operacion && operacion !== 'NULL' && operacion !== '') {
|
|
1928
|
-
qs.
|
|
1928
|
+
qs.operacion = operacion;
|
|
1929
1929
|
}
|
|
1930
1930
|
// Tipo de Propiedad
|
|
1931
1931
|
const tipoPropiedad = this.getNodeParameter('searchTipoPropiedad', i, '');
|
|
@@ -1935,7 +1935,7 @@ class AivenceRealty {
|
|
|
1935
1935
|
// Zonas (barrios) - Smart Zone Logic aplicado desde workflow
|
|
1936
1936
|
const zonas = this.getNodeParameter('searchZonas', i, '');
|
|
1937
1937
|
if (zonas && zonas !== '' && zonas !== 'NULL' && zonas !== 'null') {
|
|
1938
|
-
qs.
|
|
1938
|
+
qs.zona = zonas; // Formato: "Núñez, Saavedra, Belgrano"
|
|
1939
1939
|
}
|
|
1940
1940
|
// Dormitorios
|
|
1941
1941
|
const dormitoriosMin = this.getNodeParameter('searchDormitoriosMin', i, 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-aivencerealtycrm",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "Nodo n8n para integrar el CRM inmobiliario AivenceRealty",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -41,8 +41,7 @@
|
|
|
41
41
|
],
|
|
42
42
|
"nodes": [
|
|
43
43
|
"dist/nodes/AivenceRealty/AivenceRealty.node.js",
|
|
44
|
-
"dist/nodes/AivenceRealtyTrigger/AivenceRealtyTrigger.node.js"
|
|
45
|
-
"dist/nodes/AivenceSocialMedia/AivenceSocialMedia.node.js"
|
|
44
|
+
"dist/nodes/AivenceRealtyTrigger/AivenceRealtyTrigger.node.js"
|
|
46
45
|
]
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
-
export declare class AivenceSocialMedia implements INodeType {
|
|
3
|
-
description: INodeTypeDescription;
|
|
4
|
-
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
-
}
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AivenceSocialMedia = void 0;
|
|
4
|
-
class AivenceSocialMedia {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.description = {
|
|
7
|
-
displayName: 'Aivence Social Media',
|
|
8
|
-
name: 'aivenceSocialMedia',
|
|
9
|
-
icon: 'file:aivencesocialmedia.png',
|
|
10
|
-
group: ['transform'],
|
|
11
|
-
version: 1,
|
|
12
|
-
subtitle: '={{$parameter["operation"]}}',
|
|
13
|
-
description: 'Gestión de publicaciones en redes sociales con Postiz',
|
|
14
|
-
defaults: {
|
|
15
|
-
name: 'Aivence Social Media',
|
|
16
|
-
},
|
|
17
|
-
inputs: ['main'],
|
|
18
|
-
outputs: ['main'],
|
|
19
|
-
credentials: [
|
|
20
|
-
{
|
|
21
|
-
name: 'aivenceRealtyApi',
|
|
22
|
-
required: true,
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
properties: [
|
|
26
|
-
// ============================================
|
|
27
|
-
// OPERATION SELECTOR
|
|
28
|
-
// ============================================
|
|
29
|
-
{
|
|
30
|
-
displayName: 'Operación',
|
|
31
|
-
name: 'operation',
|
|
32
|
-
type: 'options',
|
|
33
|
-
noDataExpression: true,
|
|
34
|
-
options: [
|
|
35
|
-
{
|
|
36
|
-
name: 'Create Carousel Post',
|
|
37
|
-
value: 'createCarousel',
|
|
38
|
-
description: 'Crear post carrusel programado en Instagram + Facebook',
|
|
39
|
-
action: 'Crear carrusel en redes sociales',
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
default: 'createCarousel',
|
|
43
|
-
description: 'Operación a realizar',
|
|
44
|
-
},
|
|
45
|
-
// ============================================
|
|
46
|
-
// CAROUSEL POST FIELDS
|
|
47
|
-
// ============================================
|
|
48
|
-
{
|
|
49
|
-
displayName: 'Image URLs',
|
|
50
|
-
name: 'imageUrls',
|
|
51
|
-
type: 'string',
|
|
52
|
-
typeOptions: {
|
|
53
|
-
multipleValues: true,
|
|
54
|
-
multipleValueButtonText: 'Agregar imagen',
|
|
55
|
-
},
|
|
56
|
-
displayOptions: {
|
|
57
|
-
show: {
|
|
58
|
-
operation: ['createCarousel'],
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
default: [],
|
|
62
|
-
required: true,
|
|
63
|
-
description: 'URLs de las imágenes para el carrusel (máximo 10)',
|
|
64
|
-
placeholder: 'https://example.com/image1.jpg',
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
displayName: 'Caption',
|
|
68
|
-
name: 'caption',
|
|
69
|
-
type: 'string',
|
|
70
|
-
typeOptions: {
|
|
71
|
-
rows: 4,
|
|
72
|
-
},
|
|
73
|
-
displayOptions: {
|
|
74
|
-
show: {
|
|
75
|
-
operation: ['createCarousel'],
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
default: '',
|
|
79
|
-
required: true,
|
|
80
|
-
description: 'Texto del post (caption) para las redes sociales',
|
|
81
|
-
placeholder: '🏠 Nueva propiedad disponible...',
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
displayName: 'Schedule Hours Ahead',
|
|
85
|
-
name: 'scheduleHours',
|
|
86
|
-
type: 'number',
|
|
87
|
-
displayOptions: {
|
|
88
|
-
show: {
|
|
89
|
-
operation: ['createCarousel'],
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
default: 4,
|
|
93
|
-
required: true,
|
|
94
|
-
description: 'Horas desde ahora para programar la publicación',
|
|
95
|
-
typeOptions: {
|
|
96
|
-
minValue: 1,
|
|
97
|
-
maxValue: 168,
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
displayName: 'Instagram Integration ID',
|
|
102
|
-
name: 'instagramIntegrationId',
|
|
103
|
-
type: 'string',
|
|
104
|
-
displayOptions: {
|
|
105
|
-
show: {
|
|
106
|
-
operation: ['createCarousel'],
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
default: '',
|
|
110
|
-
required: true,
|
|
111
|
-
description: 'ID de la integración de Instagram en Postiz',
|
|
112
|
-
placeholder: 'instagram_channel_id',
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
displayName: 'Facebook Integration ID',
|
|
116
|
-
name: 'facebookIntegrationId',
|
|
117
|
-
type: 'string',
|
|
118
|
-
displayOptions: {
|
|
119
|
-
show: {
|
|
120
|
-
operation: ['createCarousel'],
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
default: '',
|
|
124
|
-
required: true,
|
|
125
|
-
description: 'ID de la integración de Facebook en Postiz',
|
|
126
|
-
placeholder: 'facebook_page_id',
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
displayName: 'Agent User ID',
|
|
130
|
-
name: 'agentUserId',
|
|
131
|
-
type: 'number',
|
|
132
|
-
displayOptions: {
|
|
133
|
-
show: {
|
|
134
|
-
operation: ['createCarousel'],
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
default: 5,
|
|
138
|
-
required: true,
|
|
139
|
-
description: 'ID del agente inmobiliario para notificar (default: Carlos Rodriguez = 5)',
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
displayName: 'Property Data',
|
|
143
|
-
name: 'propertyData',
|
|
144
|
-
type: 'json',
|
|
145
|
-
displayOptions: {
|
|
146
|
-
show: {
|
|
147
|
-
operation: ['createCarousel'],
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
default: '{}',
|
|
151
|
-
description: 'Datos adicionales de la propiedad (opcional, en formato JSON)',
|
|
152
|
-
placeholder: '{"property_id": 123, "title": "Casa en venta"}',
|
|
153
|
-
},
|
|
154
|
-
],
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
async execute() {
|
|
158
|
-
const items = this.getInputData();
|
|
159
|
-
const returnData = [];
|
|
160
|
-
const credentials = await this.getCredentials('aivenceRealtyApi');
|
|
161
|
-
const baseUrl = credentials.url.replace(/\/$/, '');
|
|
162
|
-
for (let i = 0; i < items.length; i++) {
|
|
163
|
-
try {
|
|
164
|
-
const operation = this.getNodeParameter('operation', i);
|
|
165
|
-
let responseData = {};
|
|
166
|
-
if (operation === 'createCarousel') {
|
|
167
|
-
// Get parameters
|
|
168
|
-
const imageUrls = this.getNodeParameter('imageUrls', i);
|
|
169
|
-
const caption = this.getNodeParameter('caption', i);
|
|
170
|
-
const scheduleHours = this.getNodeParameter('scheduleHours', i);
|
|
171
|
-
const instagramIntegrationId = this.getNodeParameter('instagramIntegrationId', i);
|
|
172
|
-
const facebookIntegrationId = this.getNodeParameter('facebookIntegrationId', i);
|
|
173
|
-
const agentUserId = this.getNodeParameter('agentUserId', i);
|
|
174
|
-
const propertyDataStr = this.getNodeParameter('propertyData', i, '{}');
|
|
175
|
-
// Parse property data
|
|
176
|
-
let propertyData = {};
|
|
177
|
-
try {
|
|
178
|
-
propertyData = JSON.parse(propertyDataStr);
|
|
179
|
-
}
|
|
180
|
-
catch (error) {
|
|
181
|
-
propertyData = {};
|
|
182
|
-
}
|
|
183
|
-
// Validate image count
|
|
184
|
-
if (imageUrls.length === 0) {
|
|
185
|
-
throw new Error('Debes proporcionar al menos 1 imagen');
|
|
186
|
-
}
|
|
187
|
-
if (imageUrls.length > 10) {
|
|
188
|
-
throw new Error('Máximo 10 imágenes permitidas en un carrusel');
|
|
189
|
-
}
|
|
190
|
-
// Calculate schedule time (ISO 8601 format)
|
|
191
|
-
const scheduledDate = new Date();
|
|
192
|
-
scheduledDate.setHours(scheduledDate.getHours() + scheduleHours);
|
|
193
|
-
const scheduledDateISO = scheduledDate.toISOString();
|
|
194
|
-
// Prepare request body
|
|
195
|
-
const requestBody = {
|
|
196
|
-
imageUrls,
|
|
197
|
-
caption,
|
|
198
|
-
scheduleDate: scheduledDateISO,
|
|
199
|
-
instagramIntegrationId,
|
|
200
|
-
facebookIntegrationId,
|
|
201
|
-
agentUserId,
|
|
202
|
-
propertyData,
|
|
203
|
-
};
|
|
204
|
-
// Make API request to AivenceRealty backend
|
|
205
|
-
responseData = await this.helpers.httpRequest({
|
|
206
|
-
method: 'POST',
|
|
207
|
-
url: `${baseUrl}/api/v1/social-media/create-carousel`,
|
|
208
|
-
body: requestBody,
|
|
209
|
-
json: true,
|
|
210
|
-
headers: {
|
|
211
|
-
'Content-Type': 'application/json',
|
|
212
|
-
},
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
// Format response
|
|
216
|
-
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
|
|
217
|
-
returnData.push(...executionData);
|
|
218
|
-
}
|
|
219
|
-
catch (error) {
|
|
220
|
-
if (this.continueOnFail()) {
|
|
221
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
222
|
-
returnData.push({
|
|
223
|
-
json: { error: errorMessage },
|
|
224
|
-
pairedItem: { item: i },
|
|
225
|
-
});
|
|
226
|
-
continue;
|
|
227
|
-
}
|
|
228
|
-
throw error;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return [returnData];
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
exports.AivenceSocialMedia = AivenceSocialMedia;
|
|
Binary file
|