n8n-nodes-digit 0.1.17 → 0.1.19
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
|
@@ -188,6 +188,59 @@ class DIGIT {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
// ==================================================
|
|
191
|
+
// NOTIFICATION — SEND EMAIL (FIXED)
|
|
192
|
+
// ==================================================
|
|
193
|
+
if (resource === 'notification') {
|
|
194
|
+
const operation = this.getNodeParameter('notificationOperation', 0);
|
|
195
|
+
if (operation === 'notification_send_email') {
|
|
196
|
+
for (let i = 0; i < items.length; i++) {
|
|
197
|
+
try {
|
|
198
|
+
const tenantId = this.getNodeParameter('tenantId', i);
|
|
199
|
+
const accessToken = this.getNodeParameter('accessToken', i);
|
|
200
|
+
const cleanToken = accessToken.replace(/^Bearer\s+/i, '').trim();
|
|
201
|
+
let body;
|
|
202
|
+
try {
|
|
203
|
+
body = JSON.parse(this.getNodeParameter('requestBody', i));
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
throw new Error('Invalid JSON in Request Body');
|
|
207
|
+
}
|
|
208
|
+
const url = new URL('/notification/v1/email/send', baseUrl).toString();
|
|
209
|
+
const response = await this.helpers.httpRequest({
|
|
210
|
+
method: 'POST',
|
|
211
|
+
url,
|
|
212
|
+
headers: {
|
|
213
|
+
'X-Tenant-ID': tenantId,
|
|
214
|
+
Authorization: `Bearer ${cleanToken}`,
|
|
215
|
+
'Content-Type': 'application/json',
|
|
216
|
+
},
|
|
217
|
+
body,
|
|
218
|
+
json: true,
|
|
219
|
+
});
|
|
220
|
+
// ✅ Push only JSON-safe data
|
|
221
|
+
returnData.push({
|
|
222
|
+
json: response,
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
if (this.continueOnFail()) {
|
|
227
|
+
// ✅ Never push raw error object
|
|
228
|
+
returnData.push({
|
|
229
|
+
json: {
|
|
230
|
+
error: error.message,
|
|
231
|
+
statusCode: error.statusCode || null,
|
|
232
|
+
},
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
throw error;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return [returnData];
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
// ==================================================
|
|
191
244
|
// IDGEN — GENERATE
|
|
192
245
|
// ==================================================
|
|
193
246
|
if (resource === 'idgen') {
|
package/dist/package.json
CHANGED