n8n-nodes-resend 1.0.3 → 1.0.4
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.
|
@@ -10,7 +10,7 @@ class Resend {
|
|
|
10
10
|
icon: 'file:Resend.svg',
|
|
11
11
|
group: ['output'],
|
|
12
12
|
version: 1,
|
|
13
|
-
description: '
|
|
13
|
+
description: 'Interact with Resend API for emails, domains, API keys, broadcasts, audiences, and contacts',
|
|
14
14
|
defaults: {
|
|
15
15
|
name: 'Resend',
|
|
16
16
|
},
|
|
@@ -23,25 +23,86 @@ class Resend {
|
|
|
23
23
|
inputs: ['main'],
|
|
24
24
|
outputs: ['main'],
|
|
25
25
|
properties: [
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Resource',
|
|
28
|
+
name: 'resource',
|
|
29
|
+
type: 'options',
|
|
30
|
+
noDataExpression: true, options: [
|
|
31
|
+
{
|
|
32
|
+
name: 'API Key',
|
|
33
|
+
value: 'apiKeys',
|
|
34
|
+
description: 'Manage API keys',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'Audience',
|
|
38
|
+
value: 'audiences',
|
|
39
|
+
description: 'Manage email audiences',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Broadcast',
|
|
43
|
+
value: 'broadcasts',
|
|
44
|
+
description: 'Manage email broadcasts',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'Contact',
|
|
48
|
+
value: 'contacts',
|
|
49
|
+
description: 'Manage audience contacts',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'Domain',
|
|
53
|
+
value: 'domains',
|
|
54
|
+
description: 'Manage email domains',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'Email',
|
|
58
|
+
value: 'email',
|
|
59
|
+
description: 'Send and manage emails',
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
default: 'email',
|
|
63
|
+
},
|
|
26
64
|
{
|
|
27
65
|
displayName: 'Operation',
|
|
28
66
|
name: 'operation',
|
|
29
67
|
type: 'options',
|
|
30
68
|
noDataExpression: true,
|
|
31
|
-
|
|
69
|
+
displayOptions: {
|
|
70
|
+
show: {
|
|
71
|
+
resource: ['email'],
|
|
72
|
+
},
|
|
73
|
+
}, options: [
|
|
74
|
+
{
|
|
75
|
+
name: 'Cancel',
|
|
76
|
+
value: 'cancel',
|
|
77
|
+
description: 'Cancel a scheduled email',
|
|
78
|
+
action: 'Cancel an email',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'Retrieve',
|
|
82
|
+
value: 'retrieve',
|
|
83
|
+
description: 'Retrieve an email by ID',
|
|
84
|
+
action: 'Retrieve an email',
|
|
85
|
+
},
|
|
32
86
|
{
|
|
33
|
-
name: 'Send
|
|
34
|
-
value: '
|
|
87
|
+
name: 'Send',
|
|
88
|
+
value: 'send',
|
|
89
|
+
description: 'Send an email',
|
|
35
90
|
action: 'Send an email',
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'Send Batch',
|
|
94
|
+
value: 'sendBatch',
|
|
95
|
+
description: 'Send multiple emails at once',
|
|
96
|
+
action: 'Send batch emails',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'Update',
|
|
100
|
+
value: 'update',
|
|
101
|
+
description: 'Update an email',
|
|
102
|
+
action: 'Update an email',
|
|
42
103
|
},
|
|
43
104
|
],
|
|
44
|
-
default: '
|
|
105
|
+
default: 'send',
|
|
45
106
|
},
|
|
46
107
|
{
|
|
47
108
|
displayName: 'Email Format',
|
|
@@ -74,31 +135,33 @@ class Resend {
|
|
|
74
135
|
},
|
|
75
136
|
{
|
|
76
137
|
displayName: 'From',
|
|
77
|
-
name: '
|
|
138
|
+
name: 'from',
|
|
78
139
|
type: 'string',
|
|
79
140
|
required: true,
|
|
80
141
|
default: '',
|
|
81
142
|
placeholder: 'you@example.com',
|
|
82
143
|
displayOptions: {
|
|
83
144
|
show: {
|
|
84
|
-
|
|
145
|
+
resource: ['email'],
|
|
146
|
+
operation: ['send'],
|
|
85
147
|
},
|
|
86
148
|
},
|
|
87
|
-
description: 'Sender email address',
|
|
149
|
+
description: 'Sender email address. To include a friendly name, use the format "Your Name <sender@domain.com>".',
|
|
88
150
|
},
|
|
89
151
|
{
|
|
90
152
|
displayName: 'To',
|
|
91
|
-
name: '
|
|
153
|
+
name: 'to',
|
|
92
154
|
type: 'string',
|
|
93
155
|
required: true,
|
|
94
156
|
default: '',
|
|
95
157
|
placeholder: 'user@example.com',
|
|
96
158
|
displayOptions: {
|
|
97
159
|
show: {
|
|
98
|
-
|
|
160
|
+
resource: ['email'],
|
|
161
|
+
operation: ['send'],
|
|
99
162
|
},
|
|
100
163
|
},
|
|
101
|
-
description: '
|
|
164
|
+
description: 'Recipient email address. For multiple addresses, separate with commas (max 50).',
|
|
102
165
|
},
|
|
103
166
|
{
|
|
104
167
|
displayName: 'Subject',
|
|
@@ -109,14 +172,16 @@ class Resend {
|
|
|
109
172
|
placeholder: 'Hello from n8n!',
|
|
110
173
|
displayOptions: {
|
|
111
174
|
show: {
|
|
112
|
-
|
|
175
|
+
resource: ['email'],
|
|
176
|
+
operation: ['send'],
|
|
113
177
|
},
|
|
114
178
|
},
|
|
115
|
-
|
|
179
|
+
description: 'Email subject line',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
116
182
|
displayName: 'HTML Content',
|
|
117
|
-
name: '
|
|
183
|
+
name: 'html',
|
|
118
184
|
type: 'string',
|
|
119
|
-
required: true,
|
|
120
185
|
default: '',
|
|
121
186
|
typeOptions: {
|
|
122
187
|
multiline: true,
|
|
@@ -124,16 +189,16 @@ class Resend {
|
|
|
124
189
|
placeholder: '<p>Your HTML content here</p>',
|
|
125
190
|
displayOptions: {
|
|
126
191
|
show: {
|
|
127
|
-
|
|
128
|
-
|
|
192
|
+
resource: ['email'],
|
|
193
|
+
operation: ['send'],
|
|
129
194
|
},
|
|
130
195
|
},
|
|
131
|
-
description: 'HTML
|
|
132
|
-
},
|
|
196
|
+
description: 'HTML version of the email content',
|
|
197
|
+
},
|
|
198
|
+
{
|
|
133
199
|
displayName: 'Text Content',
|
|
134
|
-
name: '
|
|
200
|
+
name: 'text',
|
|
135
201
|
type: 'string',
|
|
136
|
-
required: true,
|
|
137
202
|
default: '',
|
|
138
203
|
typeOptions: {
|
|
139
204
|
multiline: true,
|
|
@@ -141,96 +206,403 @@ class Resend {
|
|
|
141
206
|
placeholder: 'Your plain text content here',
|
|
142
207
|
displayOptions: {
|
|
143
208
|
show: {
|
|
144
|
-
|
|
145
|
-
|
|
209
|
+
resource: ['email'],
|
|
210
|
+
operation: ['send'],
|
|
146
211
|
},
|
|
147
212
|
},
|
|
148
|
-
description: 'Plain text
|
|
213
|
+
description: 'Plain text version of the email content',
|
|
149
214
|
},
|
|
150
215
|
{
|
|
151
|
-
displayName: 'Options',
|
|
152
|
-
name: '
|
|
216
|
+
displayName: 'Additional Options',
|
|
217
|
+
name: 'additionalOptions',
|
|
153
218
|
type: 'collection',
|
|
154
219
|
placeholder: 'Add Option',
|
|
155
220
|
default: {},
|
|
156
221
|
displayOptions: {
|
|
157
222
|
show: {
|
|
158
|
-
|
|
223
|
+
resource: ['email'],
|
|
224
|
+
operation: ['send'],
|
|
159
225
|
},
|
|
160
226
|
},
|
|
161
|
-
|
|
227
|
+
options: [
|
|
162
228
|
{
|
|
163
|
-
displayName: '
|
|
164
|
-
name: '
|
|
229
|
+
displayName: 'CC',
|
|
230
|
+
name: 'cc',
|
|
165
231
|
type: 'string',
|
|
166
232
|
default: '',
|
|
167
|
-
|
|
168
|
-
description: 'Comma-separated list of BCC email addresses',
|
|
233
|
+
description: 'CC recipient email addresses (comma-separated)',
|
|
169
234
|
},
|
|
170
235
|
{
|
|
171
|
-
displayName: '
|
|
172
|
-
name: '
|
|
236
|
+
displayName: 'BCC',
|
|
237
|
+
name: 'bcc',
|
|
173
238
|
type: 'string',
|
|
174
239
|
default: '',
|
|
175
|
-
|
|
176
|
-
description: 'Comma-separated list of CC email addresses',
|
|
240
|
+
description: 'BCC recipient email addresses (comma-separated)',
|
|
177
241
|
},
|
|
178
242
|
{
|
|
179
243
|
displayName: 'Reply To',
|
|
180
|
-
name: '
|
|
244
|
+
name: 'reply_to',
|
|
181
245
|
type: 'string',
|
|
182
246
|
default: '',
|
|
183
|
-
|
|
184
|
-
description: 'Email address to set as reply-to',
|
|
247
|
+
description: 'Reply-to email address',
|
|
185
248
|
},
|
|
186
249
|
{
|
|
187
|
-
displayName: '
|
|
188
|
-
name: '
|
|
189
|
-
type: '
|
|
190
|
-
default:
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
250
|
+
displayName: 'Scheduled At',
|
|
251
|
+
name: 'scheduled_at',
|
|
252
|
+
type: 'string',
|
|
253
|
+
default: '',
|
|
254
|
+
description: 'Schedule email to be sent later (e.g., "in 1 min" or ISO 8601 format)',
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
displayName: 'Emails',
|
|
260
|
+
name: 'emails',
|
|
261
|
+
type: 'fixedCollection',
|
|
262
|
+
required: true,
|
|
263
|
+
default: { emails: [{}] },
|
|
264
|
+
typeOptions: {
|
|
265
|
+
multipleValues: true,
|
|
266
|
+
},
|
|
267
|
+
displayOptions: {
|
|
268
|
+
show: {
|
|
269
|
+
resource: ['email'],
|
|
270
|
+
operation: ['sendBatch'],
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
description: 'Array of emails to send (max 100)',
|
|
274
|
+
options: [
|
|
275
|
+
{
|
|
276
|
+
name: 'emails',
|
|
277
|
+
displayName: 'Email',
|
|
278
|
+
values: [
|
|
279
|
+
{
|
|
280
|
+
displayName: 'From',
|
|
281
|
+
name: 'from',
|
|
282
|
+
type: 'string',
|
|
283
|
+
required: true,
|
|
284
|
+
default: '',
|
|
285
|
+
placeholder: 'you@example.com',
|
|
286
|
+
description: 'Sender email address',
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
displayName: 'HTML Content',
|
|
290
|
+
name: 'html',
|
|
291
|
+
type: 'string',
|
|
292
|
+
default: '',
|
|
293
|
+
description: 'HTML content of the email',
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
displayName: 'Subject',
|
|
297
|
+
name: 'subject',
|
|
298
|
+
type: 'string',
|
|
299
|
+
required: true,
|
|
300
|
+
default: '',
|
|
301
|
+
placeholder: 'Hello from n8n!',
|
|
302
|
+
description: 'Email subject',
|
|
303
|
+
},
|
|
196
304
|
{
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
default: '',
|
|
212
|
-
description: 'Value of the tag',
|
|
213
|
-
},
|
|
214
|
-
],
|
|
305
|
+
displayName: 'Text Content',
|
|
306
|
+
name: 'text',
|
|
307
|
+
type: 'string',
|
|
308
|
+
default: '',
|
|
309
|
+
description: 'Plain text content of the email',
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
displayName: 'To',
|
|
313
|
+
name: 'to',
|
|
314
|
+
type: 'string',
|
|
315
|
+
required: true,
|
|
316
|
+
default: '',
|
|
317
|
+
placeholder: 'user@example.com',
|
|
318
|
+
description: 'Recipient email address (comma-separated for multiple)',
|
|
215
319
|
},
|
|
216
320
|
],
|
|
217
|
-
description: 'Tags to categorize the email',
|
|
218
321
|
},
|
|
322
|
+
],
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
displayName: 'Email ID',
|
|
326
|
+
name: 'emailId',
|
|
327
|
+
type: 'string',
|
|
328
|
+
required: true,
|
|
329
|
+
default: '',
|
|
330
|
+
placeholder: 'ae2014de-c168-4c61-8267-70d2662a1ce1',
|
|
331
|
+
displayOptions: {
|
|
332
|
+
show: {
|
|
333
|
+
resource: ['email'],
|
|
334
|
+
operation: ['retrieve', 'update', 'cancel'],
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
description: 'The ID of the email to retrieve, update, or cancel',
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
displayName: 'Domain Name',
|
|
341
|
+
name: 'domainName',
|
|
342
|
+
type: 'string',
|
|
343
|
+
required: true,
|
|
344
|
+
default: '',
|
|
345
|
+
placeholder: 'example.com',
|
|
346
|
+
displayOptions: {
|
|
347
|
+
show: {
|
|
348
|
+
resource: ['domains'],
|
|
349
|
+
operation: ['create'],
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
description: 'The name of the domain you want to create',
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
displayName: 'Domain ID',
|
|
356
|
+
name: 'domainId',
|
|
357
|
+
type: 'string',
|
|
358
|
+
required: true,
|
|
359
|
+
default: '',
|
|
360
|
+
placeholder: '4dd369bc-aa82-4ff3-97de-514ae3000ee0',
|
|
361
|
+
displayOptions: {
|
|
362
|
+
show: {
|
|
363
|
+
resource: ['domains'],
|
|
364
|
+
operation: ['get', 'verify', 'update', 'delete'],
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
description: 'The ID of the domain',
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
displayName: 'Additional Options',
|
|
371
|
+
name: 'additionalOptions',
|
|
372
|
+
type: 'collection',
|
|
373
|
+
placeholder: 'Add Option',
|
|
374
|
+
default: {},
|
|
375
|
+
displayOptions: {
|
|
376
|
+
show: {
|
|
377
|
+
resource: ['domains'],
|
|
378
|
+
operation: ['create'],
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
options: [
|
|
382
|
+
{
|
|
383
|
+
displayName: 'Region',
|
|
384
|
+
name: 'region',
|
|
385
|
+
type: 'options',
|
|
386
|
+
options: [
|
|
387
|
+
{ name: 'US East 1', value: 'us-east-1' },
|
|
388
|
+
{ name: 'EU West 1', value: 'eu-west-1' },
|
|
389
|
+
{ name: 'South America East 1', value: 'sa-east-1' },
|
|
390
|
+
{ name: 'Asia Pacific Northeast 1', value: 'ap-northeast-1' },
|
|
391
|
+
],
|
|
392
|
+
default: 'us-east-1',
|
|
393
|
+
description: 'The region where emails will be sent from',
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
displayName: 'Custom Return Path',
|
|
397
|
+
name: 'custom_return_path',
|
|
398
|
+
type: 'string',
|
|
399
|
+
default: 'send',
|
|
400
|
+
description: 'Custom subdomain for the Return-Path address',
|
|
401
|
+
},
|
|
402
|
+
],
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
displayName: 'API Key Name',
|
|
406
|
+
name: 'apiKeyName',
|
|
407
|
+
type: 'string',
|
|
408
|
+
typeOptions: { password: true },
|
|
409
|
+
required: true,
|
|
410
|
+
default: '',
|
|
411
|
+
placeholder: 'My API Key',
|
|
412
|
+
displayOptions: {
|
|
413
|
+
show: {
|
|
414
|
+
resource: ['apiKeys'],
|
|
415
|
+
operation: ['create'],
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
description: 'The name of the API key to create',
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
displayName: 'API Key ID',
|
|
422
|
+
name: 'apiKeyId',
|
|
423
|
+
type: 'string',
|
|
424
|
+
typeOptions: { password: true },
|
|
425
|
+
required: true,
|
|
426
|
+
default: '',
|
|
427
|
+
placeholder: 'key_123456',
|
|
428
|
+
displayOptions: {
|
|
429
|
+
show: {
|
|
430
|
+
resource: ['apiKeys'],
|
|
431
|
+
operation: ['delete'],
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
description: 'The ID of the API key to delete',
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
displayName: 'Permission',
|
|
438
|
+
name: 'permission',
|
|
439
|
+
type: 'options',
|
|
440
|
+
options: [
|
|
441
|
+
{ name: 'Full Access', value: 'full_access' },
|
|
442
|
+
{ name: 'Sending Access', value: 'sending_access' },
|
|
443
|
+
],
|
|
444
|
+
default: 'full_access',
|
|
445
|
+
displayOptions: {
|
|
446
|
+
show: {
|
|
447
|
+
resource: ['apiKeys'],
|
|
448
|
+
operation: ['create'],
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
description: 'The permission level for the API key',
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
displayName: 'Broadcast Name',
|
|
455
|
+
name: 'broadcastName',
|
|
456
|
+
type: 'string',
|
|
457
|
+
required: true,
|
|
458
|
+
default: '',
|
|
459
|
+
placeholder: 'My Newsletter',
|
|
460
|
+
displayOptions: {
|
|
461
|
+
show: {
|
|
462
|
+
resource: ['broadcasts'],
|
|
463
|
+
operation: ['create'],
|
|
464
|
+
},
|
|
465
|
+
},
|
|
466
|
+
description: 'The name of the broadcast',
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
displayName: 'Broadcast ID',
|
|
470
|
+
name: 'broadcastId',
|
|
471
|
+
type: 'string',
|
|
472
|
+
required: true,
|
|
473
|
+
default: '',
|
|
474
|
+
placeholder: 'bc_123456',
|
|
475
|
+
displayOptions: {
|
|
476
|
+
show: {
|
|
477
|
+
resource: ['broadcasts'],
|
|
478
|
+
operation: ['get', 'update', 'send', 'delete'],
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
description: 'The ID of the broadcast',
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
displayName: 'Audience ID',
|
|
485
|
+
name: 'audienceId',
|
|
486
|
+
type: 'string',
|
|
487
|
+
required: true,
|
|
488
|
+
default: '',
|
|
489
|
+
placeholder: 'aud_123456',
|
|
490
|
+
displayOptions: {
|
|
491
|
+
show: {
|
|
492
|
+
resource: ['broadcasts'],
|
|
493
|
+
operation: ['create'],
|
|
494
|
+
},
|
|
495
|
+
},
|
|
496
|
+
description: 'The ID of the audience for this broadcast',
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
displayName: 'Audience Name',
|
|
500
|
+
name: 'audienceName',
|
|
501
|
+
type: 'string',
|
|
502
|
+
required: true,
|
|
503
|
+
default: '',
|
|
504
|
+
placeholder: 'Newsletter Subscribers',
|
|
505
|
+
displayOptions: {
|
|
506
|
+
show: {
|
|
507
|
+
resource: ['audiences'],
|
|
508
|
+
operation: ['create'],
|
|
509
|
+
},
|
|
510
|
+
},
|
|
511
|
+
description: 'The name of the audience',
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
displayName: 'Audience ID',
|
|
515
|
+
name: 'audienceId',
|
|
516
|
+
type: 'string',
|
|
517
|
+
required: true,
|
|
518
|
+
default: '',
|
|
519
|
+
placeholder: 'aud_123456',
|
|
520
|
+
displayOptions: {
|
|
521
|
+
show: {
|
|
522
|
+
resource: ['audiences'],
|
|
523
|
+
operation: ['get', 'delete'],
|
|
524
|
+
},
|
|
525
|
+
},
|
|
526
|
+
description: 'The ID of the audience',
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
displayName: 'Email',
|
|
530
|
+
name: 'email',
|
|
531
|
+
type: 'string',
|
|
532
|
+
required: true,
|
|
533
|
+
default: '',
|
|
534
|
+
placeholder: 'contact@example.com',
|
|
535
|
+
displayOptions: {
|
|
536
|
+
show: {
|
|
537
|
+
resource: ['contacts'],
|
|
538
|
+
operation: ['create'],
|
|
539
|
+
},
|
|
540
|
+
},
|
|
541
|
+
description: 'The email address of the contact',
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
displayName: 'Contact ID',
|
|
545
|
+
name: 'contactId',
|
|
546
|
+
type: 'string',
|
|
547
|
+
required: true,
|
|
548
|
+
default: '',
|
|
549
|
+
placeholder: 'con_123456',
|
|
550
|
+
displayOptions: {
|
|
551
|
+
show: {
|
|
552
|
+
resource: ['contacts'],
|
|
553
|
+
operation: ['get', 'update', 'delete'],
|
|
554
|
+
},
|
|
555
|
+
},
|
|
556
|
+
description: 'The ID of the contact',
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
displayName: 'Audience ID',
|
|
560
|
+
name: 'audienceId',
|
|
561
|
+
type: 'string',
|
|
562
|
+
required: true,
|
|
563
|
+
default: '',
|
|
564
|
+
placeholder: 'aud_123456',
|
|
565
|
+
displayOptions: {
|
|
566
|
+
show: {
|
|
567
|
+
resource: ['contacts'],
|
|
568
|
+
operation: ['create', 'list'],
|
|
569
|
+
},
|
|
570
|
+
},
|
|
571
|
+
description: 'The ID of the audience',
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
displayName: 'Additional Contact Fields',
|
|
575
|
+
name: 'additionalFields',
|
|
576
|
+
type: 'collection',
|
|
577
|
+
placeholder: 'Add Field',
|
|
578
|
+
default: {},
|
|
579
|
+
displayOptions: {
|
|
580
|
+
show: {
|
|
581
|
+
resource: ['contacts'],
|
|
582
|
+
operation: ['create', 'update'],
|
|
583
|
+
},
|
|
584
|
+
},
|
|
585
|
+
options: [
|
|
219
586
|
{
|
|
220
|
-
displayName: '
|
|
221
|
-
name: '
|
|
587
|
+
displayName: 'First Name',
|
|
588
|
+
name: 'first_name',
|
|
222
589
|
type: 'string',
|
|
223
590
|
default: '',
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
591
|
+
description: 'First name of the contact',
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
displayName: 'Last Name',
|
|
595
|
+
name: 'last_name',
|
|
596
|
+
type: 'string',
|
|
597
|
+
default: '',
|
|
598
|
+
description: 'Last name of the contact',
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
displayName: 'Unsubscribed',
|
|
602
|
+
name: 'unsubscribed',
|
|
603
|
+
type: 'boolean',
|
|
604
|
+
default: false,
|
|
605
|
+
description: 'Whether the contact is unsubscribed',
|
|
234
606
|
},
|
|
235
607
|
],
|
|
236
608
|
},
|
|
@@ -243,64 +615,434 @@ class Resend {
|
|
|
243
615
|
const length = items.length;
|
|
244
616
|
for (let i = 0; i < length; i++) {
|
|
245
617
|
try {
|
|
618
|
+
const resource = this.getNodeParameter('resource', i);
|
|
246
619
|
const operation = this.getNodeParameter('operation', i);
|
|
247
620
|
const credentials = await this.getCredentials('resendApi');
|
|
248
621
|
const apiKey = credentials.apiKey;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
622
|
+
let response;
|
|
623
|
+
if (resource === 'email') {
|
|
624
|
+
if (operation === 'send') {
|
|
625
|
+
const from = this.getNodeParameter('from', i);
|
|
626
|
+
const to = this.getNodeParameter('to', i);
|
|
627
|
+
const subject = this.getNodeParameter('subject', i);
|
|
628
|
+
const html = this.getNodeParameter('html', i);
|
|
629
|
+
const text = this.getNodeParameter('text', i);
|
|
630
|
+
const additionalOptions = this.getNodeParameter('additionalOptions', i, {});
|
|
631
|
+
const requestBody = {
|
|
632
|
+
from,
|
|
633
|
+
to: to.split(',').map((email) => email.trim()).filter((email) => email),
|
|
634
|
+
subject,
|
|
635
|
+
};
|
|
636
|
+
if (html)
|
|
637
|
+
requestBody.html = html;
|
|
638
|
+
if (text)
|
|
639
|
+
requestBody.text = text;
|
|
640
|
+
if (additionalOptions.cc) {
|
|
641
|
+
requestBody.cc = additionalOptions.cc.split(',').map((email) => email.trim());
|
|
642
|
+
}
|
|
643
|
+
if (additionalOptions.bcc) {
|
|
644
|
+
requestBody.bcc = additionalOptions.bcc.split(',').map((email) => email.trim());
|
|
645
|
+
}
|
|
646
|
+
if (additionalOptions.reply_to)
|
|
647
|
+
requestBody.reply_to = additionalOptions.reply_to;
|
|
648
|
+
if (additionalOptions.scheduled_at)
|
|
649
|
+
requestBody.scheduled_at = additionalOptions.scheduled_at;
|
|
650
|
+
response = await this.helpers.httpRequest({
|
|
651
|
+
url: 'https://api.resend.com/emails',
|
|
652
|
+
method: 'POST',
|
|
653
|
+
headers: {
|
|
654
|
+
Authorization: `Bearer ${apiKey}`,
|
|
655
|
+
'Content-Type': 'application/json',
|
|
656
|
+
},
|
|
657
|
+
body: requestBody,
|
|
658
|
+
json: true,
|
|
659
|
+
});
|
|
273
660
|
}
|
|
274
|
-
if (
|
|
275
|
-
|
|
661
|
+
else if (operation === 'sendBatch') {
|
|
662
|
+
const emailsData = this.getNodeParameter('emails', i);
|
|
663
|
+
const emails = emailsData.emails.map((email) => ({
|
|
664
|
+
from: email.from,
|
|
665
|
+
to: email.to.split(',').map((e) => e.trim()).filter((e) => e),
|
|
666
|
+
subject: email.subject,
|
|
667
|
+
...(email.html && { html: email.html }),
|
|
668
|
+
...(email.text && { text: email.text }),
|
|
669
|
+
}));
|
|
670
|
+
response = await this.helpers.httpRequest({
|
|
671
|
+
url: 'https://api.resend.com/emails/batch',
|
|
672
|
+
method: 'POST',
|
|
673
|
+
headers: {
|
|
674
|
+
Authorization: `Bearer ${apiKey}`,
|
|
675
|
+
'Content-Type': 'application/json',
|
|
676
|
+
},
|
|
677
|
+
body: emails,
|
|
678
|
+
json: true,
|
|
679
|
+
});
|
|
276
680
|
}
|
|
277
|
-
else if (
|
|
278
|
-
|
|
681
|
+
else if (operation === 'retrieve') {
|
|
682
|
+
const emailId = this.getNodeParameter('emailId', i);
|
|
683
|
+
response = await this.helpers.httpRequest({
|
|
684
|
+
url: `https://api.resend.com/emails/${emailId}`,
|
|
685
|
+
method: 'GET',
|
|
686
|
+
headers: {
|
|
687
|
+
Authorization: `Bearer ${apiKey}`,
|
|
688
|
+
},
|
|
689
|
+
json: true,
|
|
690
|
+
});
|
|
279
691
|
}
|
|
280
|
-
if (
|
|
281
|
-
|
|
692
|
+
else if (operation === 'update') {
|
|
693
|
+
const emailId = this.getNodeParameter('emailId', i);
|
|
694
|
+
response = await this.helpers.httpRequest({
|
|
695
|
+
url: `https://api.resend.com/emails/${emailId}`,
|
|
696
|
+
method: 'PATCH',
|
|
697
|
+
headers: {
|
|
698
|
+
Authorization: `Bearer ${apiKey}`,
|
|
699
|
+
'Content-Type': 'application/json',
|
|
700
|
+
},
|
|
701
|
+
body: {},
|
|
702
|
+
json: true,
|
|
703
|
+
});
|
|
282
704
|
}
|
|
283
|
-
if (
|
|
284
|
-
|
|
705
|
+
else if (operation === 'cancel') {
|
|
706
|
+
const emailId = this.getNodeParameter('emailId', i);
|
|
707
|
+
response = await this.helpers.httpRequest({
|
|
708
|
+
url: `https://api.resend.com/emails/${emailId}/cancel`,
|
|
709
|
+
method: 'POST',
|
|
710
|
+
headers: {
|
|
711
|
+
Authorization: `Bearer ${apiKey}`,
|
|
712
|
+
'Content-Type': 'application/json',
|
|
713
|
+
},
|
|
714
|
+
body: {},
|
|
715
|
+
json: true,
|
|
716
|
+
});
|
|
285
717
|
}
|
|
286
|
-
|
|
287
|
-
|
|
718
|
+
}
|
|
719
|
+
else if (resource === 'domains') {
|
|
720
|
+
if (operation === 'create') {
|
|
721
|
+
const domainName = this.getNodeParameter('domainName', i);
|
|
722
|
+
const additionalOptions = this.getNodeParameter('additionalOptions', i, {});
|
|
723
|
+
const requestBody = { name: domainName };
|
|
724
|
+
if (additionalOptions.region)
|
|
725
|
+
requestBody.region = additionalOptions.region;
|
|
726
|
+
if (additionalOptions.custom_return_path)
|
|
727
|
+
requestBody.custom_return_path = additionalOptions.custom_return_path;
|
|
728
|
+
response = await this.helpers.httpRequest({
|
|
729
|
+
url: 'https://api.resend.com/domains',
|
|
730
|
+
method: 'POST',
|
|
731
|
+
headers: {
|
|
732
|
+
Authorization: `Bearer ${apiKey}`,
|
|
733
|
+
'Content-Type': 'application/json',
|
|
734
|
+
},
|
|
735
|
+
body: requestBody,
|
|
736
|
+
json: true,
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
else if (operation === 'get') {
|
|
740
|
+
const domainId = this.getNodeParameter('domainId', i);
|
|
741
|
+
response = await this.helpers.httpRequest({
|
|
742
|
+
url: `https://api.resend.com/domains/${domainId}`,
|
|
743
|
+
method: 'GET',
|
|
744
|
+
headers: {
|
|
745
|
+
Authorization: `Bearer ${apiKey}`,
|
|
746
|
+
},
|
|
747
|
+
json: true,
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
else if (operation === 'verify') {
|
|
751
|
+
const domainId = this.getNodeParameter('domainId', i);
|
|
752
|
+
response = await this.helpers.httpRequest({
|
|
753
|
+
url: `https://api.resend.com/domains/${domainId}/verify`,
|
|
754
|
+
method: 'POST',
|
|
755
|
+
headers: {
|
|
756
|
+
Authorization: `Bearer ${apiKey}`,
|
|
757
|
+
'Content-Type': 'application/json',
|
|
758
|
+
},
|
|
759
|
+
body: {},
|
|
760
|
+
json: true,
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
else if (operation === 'update') {
|
|
764
|
+
const domainId = this.getNodeParameter('domainId', i);
|
|
765
|
+
response = await this.helpers.httpRequest({
|
|
766
|
+
url: `https://api.resend.com/domains/${domainId}`,
|
|
767
|
+
method: 'PATCH',
|
|
768
|
+
headers: {
|
|
769
|
+
Authorization: `Bearer ${apiKey}`,
|
|
770
|
+
'Content-Type': 'application/json',
|
|
771
|
+
},
|
|
772
|
+
body: {},
|
|
773
|
+
json: true,
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
else if (operation === 'list') {
|
|
777
|
+
response = await this.helpers.httpRequest({
|
|
778
|
+
url: 'https://api.resend.com/domains',
|
|
779
|
+
method: 'GET',
|
|
780
|
+
headers: {
|
|
781
|
+
Authorization: `Bearer ${apiKey}`,
|
|
782
|
+
},
|
|
783
|
+
json: true,
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
else if (operation === 'delete') {
|
|
787
|
+
const domainId = this.getNodeParameter('domainId', i);
|
|
788
|
+
response = await this.helpers.httpRequest({
|
|
789
|
+
url: `https://api.resend.com/domains/${domainId}`,
|
|
790
|
+
method: 'DELETE',
|
|
791
|
+
headers: {
|
|
792
|
+
Authorization: `Bearer ${apiKey}`,
|
|
793
|
+
},
|
|
794
|
+
json: true,
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
else if (resource === 'apiKeys') {
|
|
799
|
+
if (operation === 'create') {
|
|
800
|
+
const apiKeyName = this.getNodeParameter('apiKeyName', i);
|
|
801
|
+
const permission = this.getNodeParameter('permission', i);
|
|
802
|
+
response = await this.helpers.httpRequest({
|
|
803
|
+
url: 'https://api.resend.com/api-keys',
|
|
804
|
+
method: 'POST',
|
|
805
|
+
headers: {
|
|
806
|
+
Authorization: `Bearer ${apiKey}`,
|
|
807
|
+
'Content-Type': 'application/json',
|
|
808
|
+
},
|
|
809
|
+
body: {
|
|
810
|
+
name: apiKeyName,
|
|
811
|
+
permission,
|
|
812
|
+
},
|
|
813
|
+
json: true,
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
else if (operation === 'list') {
|
|
817
|
+
response = await this.helpers.httpRequest({
|
|
818
|
+
url: 'https://api.resend.com/api-keys',
|
|
819
|
+
method: 'GET',
|
|
820
|
+
headers: {
|
|
821
|
+
Authorization: `Bearer ${apiKey}`,
|
|
822
|
+
},
|
|
823
|
+
json: true,
|
|
824
|
+
});
|
|
288
825
|
}
|
|
289
|
-
if (
|
|
290
|
-
|
|
826
|
+
else if (operation === 'delete') {
|
|
827
|
+
const apiKeyId = this.getNodeParameter('apiKeyId', i);
|
|
828
|
+
response = await this.helpers.httpRequest({
|
|
829
|
+
url: `https://api.resend.com/api-keys/${apiKeyId}`,
|
|
830
|
+
method: 'DELETE',
|
|
831
|
+
headers: {
|
|
832
|
+
Authorization: `Bearer ${apiKey}`,
|
|
833
|
+
},
|
|
834
|
+
json: true,
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
else if (resource === 'broadcasts') {
|
|
839
|
+
if (operation === 'create') {
|
|
840
|
+
const broadcastName = this.getNodeParameter('broadcastName', i);
|
|
841
|
+
const audienceId = this.getNodeParameter('audienceId', i);
|
|
842
|
+
response = await this.helpers.httpRequest({
|
|
843
|
+
url: 'https://api.resend.com/broadcasts',
|
|
844
|
+
method: 'POST',
|
|
845
|
+
headers: {
|
|
846
|
+
Authorization: `Bearer ${apiKey}`,
|
|
847
|
+
'Content-Type': 'application/json',
|
|
848
|
+
},
|
|
849
|
+
body: {
|
|
850
|
+
name: broadcastName,
|
|
851
|
+
audience_id: audienceId,
|
|
852
|
+
},
|
|
853
|
+
json: true,
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
else if (operation === 'get') {
|
|
857
|
+
const broadcastId = this.getNodeParameter('broadcastId', i);
|
|
858
|
+
response = await this.helpers.httpRequest({
|
|
859
|
+
url: `https://api.resend.com/broadcasts/${broadcastId}`,
|
|
860
|
+
method: 'GET',
|
|
861
|
+
headers: {
|
|
862
|
+
Authorization: `Bearer ${apiKey}`,
|
|
863
|
+
},
|
|
864
|
+
json: true,
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
else if (operation === 'update') {
|
|
868
|
+
const broadcastId = this.getNodeParameter('broadcastId', i);
|
|
869
|
+
response = await this.helpers.httpRequest({
|
|
870
|
+
url: `https://api.resend.com/broadcasts/${broadcastId}`,
|
|
871
|
+
method: 'PATCH',
|
|
872
|
+
headers: {
|
|
873
|
+
Authorization: `Bearer ${apiKey}`,
|
|
874
|
+
'Content-Type': 'application/json',
|
|
875
|
+
},
|
|
876
|
+
body: {},
|
|
877
|
+
json: true,
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
else if (operation === 'send') {
|
|
881
|
+
const broadcastId = this.getNodeParameter('broadcastId', i);
|
|
882
|
+
response = await this.helpers.httpRequest({
|
|
883
|
+
url: `https://api.resend.com/broadcasts/${broadcastId}/send`,
|
|
884
|
+
method: 'POST',
|
|
885
|
+
headers: {
|
|
886
|
+
Authorization: `Bearer ${apiKey}`,
|
|
887
|
+
'Content-Type': 'application/json',
|
|
888
|
+
},
|
|
889
|
+
body: {},
|
|
890
|
+
json: true,
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
else if (operation === 'list') {
|
|
894
|
+
response = await this.helpers.httpRequest({
|
|
895
|
+
url: 'https://api.resend.com/broadcasts',
|
|
896
|
+
method: 'GET',
|
|
897
|
+
headers: {
|
|
898
|
+
Authorization: `Bearer ${apiKey}`,
|
|
899
|
+
},
|
|
900
|
+
json: true,
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
else if (operation === 'delete') {
|
|
904
|
+
const broadcastId = this.getNodeParameter('broadcastId', i);
|
|
905
|
+
response = await this.helpers.httpRequest({
|
|
906
|
+
url: `https://api.resend.com/broadcasts/${broadcastId}`,
|
|
907
|
+
method: 'DELETE',
|
|
908
|
+
headers: {
|
|
909
|
+
Authorization: `Bearer ${apiKey}`,
|
|
910
|
+
},
|
|
911
|
+
json: true,
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
else if (resource === 'audiences') {
|
|
916
|
+
if (operation === 'create') {
|
|
917
|
+
const audienceName = this.getNodeParameter('audienceName', i);
|
|
918
|
+
response = await this.helpers.httpRequest({
|
|
919
|
+
url: 'https://api.resend.com/audiences',
|
|
920
|
+
method: 'POST',
|
|
921
|
+
headers: {
|
|
922
|
+
Authorization: `Bearer ${apiKey}`,
|
|
923
|
+
'Content-Type': 'application/json',
|
|
924
|
+
},
|
|
925
|
+
body: {
|
|
926
|
+
name: audienceName,
|
|
927
|
+
},
|
|
928
|
+
json: true,
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
else if (operation === 'get') {
|
|
932
|
+
const audienceId = this.getNodeParameter('audienceId', i);
|
|
933
|
+
response = await this.helpers.httpRequest({
|
|
934
|
+
url: `https://api.resend.com/audiences/${audienceId}`,
|
|
935
|
+
method: 'GET',
|
|
936
|
+
headers: {
|
|
937
|
+
Authorization: `Bearer ${apiKey}`,
|
|
938
|
+
},
|
|
939
|
+
json: true,
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
else if (operation === 'list') {
|
|
943
|
+
response = await this.helpers.httpRequest({
|
|
944
|
+
url: 'https://api.resend.com/audiences',
|
|
945
|
+
method: 'GET',
|
|
946
|
+
headers: {
|
|
947
|
+
Authorization: `Bearer ${apiKey}`,
|
|
948
|
+
},
|
|
949
|
+
json: true,
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
else if (operation === 'delete') {
|
|
953
|
+
const audienceId = this.getNodeParameter('audienceId', i);
|
|
954
|
+
response = await this.helpers.httpRequest({
|
|
955
|
+
url: `https://api.resend.com/audiences/${audienceId}`,
|
|
956
|
+
method: 'DELETE',
|
|
957
|
+
headers: {
|
|
958
|
+
Authorization: `Bearer ${apiKey}`,
|
|
959
|
+
},
|
|
960
|
+
json: true,
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
else if (resource === 'contacts') {
|
|
965
|
+
if (operation === 'create') {
|
|
966
|
+
const email = this.getNodeParameter('email', i);
|
|
967
|
+
const audienceId = this.getNodeParameter('audienceId', i);
|
|
968
|
+
const additionalFields = this.getNodeParameter('additionalFields', i, {});
|
|
969
|
+
const requestBody = {
|
|
970
|
+
email,
|
|
971
|
+
audience_id: audienceId,
|
|
972
|
+
};
|
|
973
|
+
if (additionalFields.first_name)
|
|
974
|
+
requestBody.first_name = additionalFields.first_name;
|
|
975
|
+
if (additionalFields.last_name)
|
|
976
|
+
requestBody.last_name = additionalFields.last_name;
|
|
977
|
+
if (additionalFields.unsubscribed !== undefined)
|
|
978
|
+
requestBody.unsubscribed = additionalFields.unsubscribed;
|
|
979
|
+
response = await this.helpers.httpRequest({
|
|
980
|
+
url: 'https://api.resend.com/contacts',
|
|
981
|
+
method: 'POST',
|
|
982
|
+
headers: {
|
|
983
|
+
Authorization: `Bearer ${apiKey}`,
|
|
984
|
+
'Content-Type': 'application/json',
|
|
985
|
+
},
|
|
986
|
+
body: requestBody,
|
|
987
|
+
json: true,
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
else if (operation === 'get') {
|
|
991
|
+
const contactId = this.getNodeParameter('contactId', i);
|
|
992
|
+
response = await this.helpers.httpRequest({
|
|
993
|
+
url: `https://api.resend.com/contacts/${contactId}`,
|
|
994
|
+
method: 'GET',
|
|
995
|
+
headers: {
|
|
996
|
+
Authorization: `Bearer ${apiKey}`,
|
|
997
|
+
},
|
|
998
|
+
json: true,
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
else if (operation === 'update') {
|
|
1002
|
+
const contactId = this.getNodeParameter('contactId', i);
|
|
1003
|
+
const additionalFields = this.getNodeParameter('additionalFields', i, {});
|
|
1004
|
+
const requestBody = {};
|
|
1005
|
+
if (additionalFields.first_name)
|
|
1006
|
+
requestBody.first_name = additionalFields.first_name;
|
|
1007
|
+
if (additionalFields.last_name)
|
|
1008
|
+
requestBody.last_name = additionalFields.last_name;
|
|
1009
|
+
if (additionalFields.unsubscribed !== undefined)
|
|
1010
|
+
requestBody.unsubscribed = additionalFields.unsubscribed;
|
|
1011
|
+
response = await this.helpers.httpRequest({
|
|
1012
|
+
url: `https://api.resend.com/contacts/${contactId}`,
|
|
1013
|
+
method: 'PATCH',
|
|
1014
|
+
headers: {
|
|
1015
|
+
Authorization: `Bearer ${apiKey}`,
|
|
1016
|
+
'Content-Type': 'application/json',
|
|
1017
|
+
},
|
|
1018
|
+
body: requestBody,
|
|
1019
|
+
json: true,
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
else if (operation === 'list') {
|
|
1023
|
+
const audienceId = this.getNodeParameter('audienceId', i);
|
|
1024
|
+
response = await this.helpers.httpRequest({
|
|
1025
|
+
url: `https://api.resend.com/audiences/${audienceId}/contacts`,
|
|
1026
|
+
method: 'GET',
|
|
1027
|
+
headers: {
|
|
1028
|
+
Authorization: `Bearer ${apiKey}`,
|
|
1029
|
+
},
|
|
1030
|
+
json: true,
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
else if (operation === 'delete') {
|
|
1034
|
+
const contactId = this.getNodeParameter('contactId', i);
|
|
1035
|
+
response = await this.helpers.httpRequest({
|
|
1036
|
+
url: `https://api.resend.com/contacts/${contactId}`,
|
|
1037
|
+
method: 'DELETE',
|
|
1038
|
+
headers: {
|
|
1039
|
+
Authorization: `Bearer ${apiKey}`,
|
|
1040
|
+
},
|
|
1041
|
+
json: true,
|
|
1042
|
+
});
|
|
291
1043
|
}
|
|
292
|
-
const response = await this.helpers.httpRequest({
|
|
293
|
-
url: 'https://api.resend.com/emails',
|
|
294
|
-
method: 'POST',
|
|
295
|
-
headers: {
|
|
296
|
-
Authorization: `Bearer ${apiKey}`,
|
|
297
|
-
'Content-Type': 'application/json',
|
|
298
|
-
},
|
|
299
|
-
body: requestBody,
|
|
300
|
-
json: true,
|
|
301
|
-
});
|
|
302
|
-
returnData.push({ json: response, pairedItem: { item: i } });
|
|
303
1044
|
}
|
|
1045
|
+
returnData.push({ json: response, pairedItem: { item: i } });
|
|
304
1046
|
}
|
|
305
1047
|
catch (error) {
|
|
306
1048
|
if (this.continueOnFail()) {
|