n8n-nodes-aivence-realty 0.1.4 → 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
  {
@@ -868,6 +895,7 @@ class AivenceRealty {
868
895
  const returnData = [];
869
896
  const credentials = await this.getCredentials('aivenceRealtyApi');
870
897
  const baseUrl = credentials.baseUrl;
898
+ const apiKey = credentials.apiKey;
871
899
  for (let i = 0; i < items.length; i++) {
872
900
  try {
873
901
  const resource = this.getNodeParameter('resource', i);
@@ -1161,6 +1189,37 @@ class AivenceRealty {
1161
1189
  });
1162
1190
  }
1163
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
+ }
1164
1223
  // Formatear respuesta
1165
1224
  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
1166
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.4",
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",