n8n-nodes-digit 0.1.19 → 0.1.20
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/DIGIT.node.js +53 -0
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/nodes/DIGIT.node.js
CHANGED
|
@@ -241,6 +241,59 @@ class DIGIT {
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
// ==================================================
|
|
244
|
+
// NOTIFICATION — SEND EMAIL (FIXED)
|
|
245
|
+
// ==================================================
|
|
246
|
+
if (resource === 'notification') {
|
|
247
|
+
const operation = this.getNodeParameter('notificationOperation', 0);
|
|
248
|
+
if (operation === 'notification_send_email') {
|
|
249
|
+
for (let i = 0; i < items.length; i++) {
|
|
250
|
+
try {
|
|
251
|
+
const tenantId = this.getNodeParameter('tenantId', i);
|
|
252
|
+
const accessToken = this.getNodeParameter('accessToken', i);
|
|
253
|
+
const cleanToken = accessToken.replace(/^Bearer\s+/i, '').trim();
|
|
254
|
+
let body;
|
|
255
|
+
try {
|
|
256
|
+
body = JSON.parse(this.getNodeParameter('requestBody', i));
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
throw new Error('Invalid JSON in Request Body');
|
|
260
|
+
}
|
|
261
|
+
const url = new URL('/notification/v1/email/send', baseUrl).toString();
|
|
262
|
+
const response = await this.helpers.httpRequest({
|
|
263
|
+
method: 'POST',
|
|
264
|
+
url,
|
|
265
|
+
headers: {
|
|
266
|
+
'X-Tenant-ID': tenantId,
|
|
267
|
+
Authorization: `Bearer ${cleanToken}`,
|
|
268
|
+
'Content-Type': 'application/json',
|
|
269
|
+
},
|
|
270
|
+
body,
|
|
271
|
+
json: true,
|
|
272
|
+
});
|
|
273
|
+
// ✅ Push only JSON-safe data
|
|
274
|
+
returnData.push({
|
|
275
|
+
json: response,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
if (this.continueOnFail()) {
|
|
280
|
+
// ✅ Never push raw error object
|
|
281
|
+
returnData.push({
|
|
282
|
+
json: {
|
|
283
|
+
error: error.message,
|
|
284
|
+
statusCode: error.statusCode || null,
|
|
285
|
+
},
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
throw error;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return [returnData];
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
// ==================================================
|
|
244
297
|
// IDGEN — GENERATE
|
|
245
298
|
// ==================================================
|
|
246
299
|
if (resource === 'idgen') {
|
package/dist/package.json
CHANGED