mailchannels-sdk 1.3.0 → 1.4.0

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.
Files changed (31) hide show
  1. package/.agents/skills/mailchannels-js/SKILL.md +4 -0
  2. package/.agents/skills/mailchannels-js/resources/attachments.md +8 -10
  3. package/.agents/skills/mailchannels-js/resources/clients-and-transport.md +5 -5
  4. package/.agents/skills/mailchannels-js/resources/custom-headers.md +4 -4
  5. package/.agents/skills/mailchannels-js/resources/dkim.md +10 -10
  6. package/.agents/skills/mailchannels-js/resources/domain-checks.md +6 -6
  7. package/.agents/skills/mailchannels-js/resources/error-handling.md +5 -5
  8. package/.agents/skills/mailchannels-js/resources/metrics-and-usage.md +9 -9
  9. package/.agents/skills/mailchannels-js/resources/overview.md +5 -5
  10. package/.agents/skills/mailchannels-js/resources/plugins/nodemailer.md +112 -0
  11. package/.agents/skills/mailchannels-js/resources/sending.md +10 -10
  12. package/.agents/skills/mailchannels-js/resources/sub-accounts.md +7 -9
  13. package/.agents/skills/mailchannels-js/resources/suppressions.md +4 -4
  14. package/.agents/skills/mailchannels-js/resources/templates.md +5 -5
  15. package/.agents/skills/mailchannels-js/resources/testing.md +52 -5
  16. package/.agents/skills/mailchannels-js/resources/unsubscribe.md +3 -3
  17. package/.agents/skills/mailchannels-js/resources/webhooks.md +8 -8
  18. package/README.md +73 -2
  19. package/dist/_chunks/mailchannels.d.mts +2094 -0
  20. package/dist/_chunks/mailchannels.mjs +2201 -0
  21. package/dist/_chunks/simulator.mjs +16 -8
  22. package/dist/cli/index.mjs +268 -0
  23. package/dist/mailchannels.d.mts +1 -2095
  24. package/dist/mailchannels.mjs +1 -2201
  25. package/dist/plugins/nodemailer/index.d.mts +33 -0
  26. package/dist/plugins/nodemailer/index.mjs +145 -0
  27. package/dist/simulator/index.d.mts +20 -0
  28. package/dist/simulator/index.mjs +2 -0
  29. package/package.json +21 -9
  30. package/dist/cli.d.mts +0 -1
  31. package/dist/cli.mjs +0 -50
@@ -0,0 +1,2094 @@
1
+ import { FetchOptions } from "ofetch";
2
+ interface MailChannelsClientOptions {
3
+ /**
4
+ * Override the MailChannels API base URL.
5
+ * Useful for local testing against a simulator.
6
+ * @default "https://api.mailchannels.net"
7
+ */
8
+ baseUrl?: string;
9
+ /**
10
+ * Number of times to retry a request in case of network errors and retryable HTTP responses.
11
+ * Retries are attempted for the following scenarios:
12
+ * - `408` - Request Timeout
13
+ * - `409` - Conflict
14
+ * - `425` - Too Early (Experimental)
15
+ * - `429` - Too Many Requests
16
+ * - `500` - Internal Server Error
17
+ * - `502` - Bad Gateway
18
+ * - `503` - Service Unavailable
19
+ * - `504` - Gateway Timeout
20
+ * @default false
21
+ */
22
+ retry?: number | false;
23
+ /**
24
+ * Request timeout in milliseconds.
25
+ * Set to `false` or `0` to disable timeout handling.
26
+ * @default 120000
27
+ */
28
+ timeout?: number | false;
29
+ /**
30
+ * Abort signal applied to requests made by the client.
31
+ */
32
+ signal?: AbortSignal;
33
+ }
34
+ declare class MailChannelsClient {
35
+ #private;
36
+ private static readonly DEFAULT_BASE_URL;
37
+ private static readonly DEFAULT_TIMEOUT;
38
+ private readonly options;
39
+ constructor(key: string, options?: MailChannelsClientOptions);
40
+ protected _fetch<T>(path: string, options: FetchOptions<"json">): Promise<T>;
41
+ post<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
42
+ get<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
43
+ delete<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
44
+ put<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
45
+ patch<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
46
+ }
47
+ type ErrorType = "invalid_request_error" | "authentication_error" | "permission_error" | "not_found" | "conflict_error" | "payload_too_large_error" | "unprocessable_entity_error" | "rate_limit_error" | "internal_server_error" | "validation_error" | "application_error" | "api_error";
48
+ interface ErrorResponse {
49
+ /**
50
+ * A human-readable description of the error.
51
+ */
52
+ message: string;
53
+ /**
54
+ * The HTTP status code from the API, or `null` if the error is not related to an HTTP request.
55
+ *
56
+ * This field is intended for diagnostic use only and should not be relied upon.
57
+ */
58
+ statusCode: number | null;
59
+ /**
60
+ * A string identifier for the type of error.
61
+ *
62
+ * This field is intended for diagnostic use only and should not be relied upon.
63
+ */
64
+ type: ErrorType;
65
+ /**
66
+ * An object containing the response, if available.
67
+ * This field may be `null` if no response is available or if the error is not related to an HTTP request or if the response is not a JSON object.
68
+ */
69
+ response: Record<string, unknown> | null;
70
+ }
71
+ interface SuccessResponse {
72
+ /**
73
+ * Whether the operation was successful.
74
+ */
75
+ success: boolean;
76
+ /**
77
+ * Error information if the operation failed.
78
+ */
79
+ error: ErrorResponse | null;
80
+ }
81
+ type DataResponse<T> = {
82
+ /**
83
+ * The response data.
84
+ */
85
+ data: T;
86
+ /**
87
+ * Error information if the operation failed.
88
+ */
89
+ error: null;
90
+ } | {
91
+ /**
92
+ * The response data.
93
+ */
94
+ data: null;
95
+ /**
96
+ * Error information if the operation failed.
97
+ */
98
+ error: ErrorResponse;
99
+ };
100
+ interface EmailsSendRecipient {
101
+ /**
102
+ * The email address of the recipient.
103
+ */
104
+ email: string;
105
+ /**
106
+ * The name of the recipient. Display name in raw text, e.g. John Doe, 张三.
107
+ */
108
+ name?: string;
109
+ }
110
+ interface EmailsSendAttachment {
111
+ /**
112
+ * The attachment data, encoded in base64.
113
+ */
114
+ content: string;
115
+ /**
116
+ * The name of the attachment file.
117
+ */
118
+ filename: string;
119
+ /**
120
+ * The MIME type of the attachment.
121
+ */
122
+ type?: string;
123
+ /**
124
+ * A unique identifier for this attachment.
125
+ *
126
+ * When set, the attachment is embedded inline in the message body (`Content-Disposition: inline`) instead of offered as a downloadable attachment, and can be referenced from HTML content via a `cid:` URI, e.g. `<img src="cid:logo123">` refers to an attachment with content_id: `logo123`. (RFC 2392). Must be unique across all attachments in the request. Max length is 255 characters.
127
+ */
128
+ contentId?: string;
129
+ }
130
+ interface EmailsSendTracking {
131
+ /**
132
+ * Track when a recipient clicks a link in your email.
133
+ */
134
+ click?: {
135
+ /**
136
+ * The name of a configured active click tracking domain.
137
+ * When specified, click tracking links will use this domain instead of the default MailChannels domain.
138
+ * The domain must be registered in your account and have an active status.
139
+ */
140
+ customDomainName?: string;
141
+ /**
142
+ * @default false
143
+ */
144
+ enable?: boolean;
145
+ };
146
+ /**
147
+ * Track when a recipient opens your email. Please note that some email clients may not support open tracking.
148
+ */
149
+ open?: {
150
+ /**
151
+ * The name of a configured active open tracking domain.
152
+ * When specified, the open tracking pixel will use this domain instead of the default MailChannels domain.
153
+ * The domain must be registered in your account and have an active status.
154
+ */
155
+ customDomainName?: string;
156
+ /**
157
+ * @default false
158
+ */
159
+ enable?: boolean;
160
+ };
161
+ }
162
+ type EmailsSendTemplateType = "mustache";
163
+ type EmailsSendTemplateValue = string | boolean | number | EmailsSendTemplateValue[] | {
164
+ [key: string]: EmailsSendTemplateValue;
165
+ };
166
+ interface EmailsSendTemplate {
167
+ /**
168
+ * The template type of the content
169
+ */
170
+ type: EmailsSendTemplateType;
171
+ /**
172
+ * Template variables, overridable per-personalization.
173
+ * An object containing key-value pairs of variables to set for template rendering.
174
+ *
175
+ * Keys must be strings, and values can be one of the following types:
176
+ * - string
177
+ * - number
178
+ * - boolean
179
+ * - list, whose values are all of permitted types
180
+ * - map, whose keys must be strings, and whose values are all of permitted types
181
+ */
182
+ data?: Record<string, EmailsSendTemplateValue>;
183
+ }
184
+ interface EmailsSendContent {
185
+ /**
186
+ * The MIME type of the content you are including in your email.
187
+ */
188
+ type: string;
189
+ /**
190
+ * The actual content of the specified MIME type that you are including in the message.
191
+ */
192
+ value: string;
193
+ }
194
+ type EmailsSendRecipientInput = EmailsSendRecipient | string | (EmailsSendRecipient | string)[];
195
+ interface EmailsSendDkim {
196
+ /**
197
+ * Domain used for DKIM signing.
198
+ */
199
+ domain?: string;
200
+ /**
201
+ * DKIM private key encoded in Base64.
202
+ */
203
+ privateKey?: string;
204
+ /**
205
+ * DKIM selector in the domain DNS records.
206
+ */
207
+ selector?: string;
208
+ }
209
+ interface EmailsSendPersonalization {
210
+ /**
211
+ * The BCC recipients for this personalization.
212
+ */
213
+ bcc?: EmailsSendRecipientInput;
214
+ /**
215
+ * The CC recipients for this personalization.
216
+ */
217
+ cc?: EmailsSendRecipientInput;
218
+ /**
219
+ * DKIM settings for this personalization.
220
+ */
221
+ dkim?: EmailsSendDkim;
222
+ /**
223
+ * Optional envelope sender for this personalization.
224
+ */
225
+ envelopeFrom?: EmailsSendRecipient | string;
226
+ /**
227
+ * Optional sender override for this personalization.
228
+ */
229
+ from?: EmailsSendRecipient | string;
230
+ /**
231
+ * Custom headers for this personalization.
232
+ */
233
+ headers?: Record<string, string>;
234
+ /**
235
+ * Reply-to override for this personalization.
236
+ */
237
+ replyTo?: EmailsSendRecipient | string;
238
+ /**
239
+ * Subject override for this personalization.
240
+ */
241
+ subject?: string;
242
+ /**
243
+ * The recipients for this personalization.
244
+ */
245
+ to: EmailsSendRecipientInput;
246
+ /**
247
+ * Per-personalization template data. Merged with (and overrides) root-level `template.data`.
248
+ */
249
+ template?: Required<Omit<EmailsSendTemplate, "type">>;
250
+ }
251
+ interface EmailsSendOptionsBase {
252
+ /**
253
+ * An array of attachments to be sent with the email.
254
+ */
255
+ attachments?: (EmailsSendAttachment | Promise<EmailsSendAttachment>)[];
256
+ /**
257
+ * The campaign identifier. If specified, this ID will be included in all relevant webhooks. It can be up to 48 UTF-8 characters long and must not contain spaces.
258
+ */
259
+ campaignId?: string;
260
+ /**
261
+ * The BCC recipients of the email. Can be an array of email addresses or an array of objects with email and name properties or a single email address string or an object with email and name properties.
262
+ * @example
263
+ * [
264
+ * { email: 'email1@example.com', name: 'Example1' },
265
+ * { email: 'email2@example.com', name: 'Example2' }
266
+ * ]
267
+ * @example
268
+ * { email: 'email@example.com', name: 'Example' }
269
+ * @example
270
+ * ['email1@example.com', 'email2@example.com']
271
+ * @example
272
+ * 'email@example.com'
273
+ * @example
274
+ * 'Name <email@example.com>'
275
+ */
276
+ bcc?: EmailsSendRecipientInput;
277
+ /**
278
+ * The CC recipients of the email. Can be an array of email addresses or an array of objects with email and name properties or a single email address string or an object with email and name properties.
279
+ * @example
280
+ * [
281
+ * { email: 'email1@example.com', name: 'Example1' },
282
+ * { email: 'email2@example.com', name: 'Example2' }
283
+ * ]
284
+ * @example
285
+ * { email: 'email@example.com', name: 'Example' }
286
+ * @example
287
+ * ['email1@example.com', 'email2@example.com']
288
+ * @example
289
+ * 'email@example.com'
290
+ * @example
291
+ * 'Name <email@example.com>'
292
+ */
293
+ cc?: EmailsSendRecipientInput;
294
+ /**
295
+ * The DKIM settings for the email.
296
+ */
297
+ dkim?: EmailsSendDkim;
298
+ /**
299
+ * Optional envelope sender address. If not set, the envelope sender defaults to the `from.email` field. Can be overridden per-personalization. Only the email portion is used; the name field is ignored.
300
+ * @example
301
+ * { email: 'email@example.com', name: 'Example' }
302
+ * @example
303
+ * 'email@example.com'
304
+ * @example
305
+ * 'Name <email@example.com>'
306
+ */
307
+ envelopeFrom?: EmailsSendRecipient | string;
308
+ /**
309
+ * The sender of the email. Can be a string or an object with email and name properties.
310
+ * @example
311
+ * { email: 'email@example.com', name: 'Example' }
312
+ * @example
313
+ * 'email@example.com'
314
+ * @example
315
+ * 'Name <email@example.com>'
316
+ */
317
+ from: EmailsSendRecipient | string;
318
+ /**
319
+ * An object containing key-value pairs, where both keys (header names) and values must be strings. These pairs represent custom headers to be substituted.
320
+ *
321
+ * Please note the following restrictions and behavior:
322
+ * - **Reserved headers**: The following headers cannot be modified: `Authentication-Results`, `BCC`, `CC`, `Content-Transfer-Encoding`, `Content-Type`, `DKIM-Signature`, `From`, `Message-ID`, `Received`, `Reply-To`, `Subject`, `To`.
323
+ * - **Header precedence**: If a header is defined in both the personalizations object and the root headers, the value from personalizations will be used.
324
+ * - **Case sensitivity**: Headers are treated as case-insensitive. If multiple headers differ only by case, only one will be used, with no guarantee of which one.
325
+ */
326
+ headers?: Record<string, string>;
327
+ /**
328
+ * Explicit personalization objects. Use this for advanced MailChannels payloads with multiple recipient groups or per-personalization overrides.
329
+ */
330
+ personalizations?: EmailsSendPersonalization[];
331
+ /**
332
+ * The recipient of the email. Can be an array of email addresses or an array of objects with `email` and `name` properties or a single email address string or an object with `email` and `name` properties.
333
+ * @example
334
+ * [
335
+ * { email: 'email1@example.com', name: 'Example1' },
336
+ * { email: 'email2@example.com', name: 'Example2' },
337
+ * ]
338
+ * @example
339
+ * { email: 'email@example.com', name: 'Example' }
340
+ * @example
341
+ * ['email1@example.com', 'email2@example.com']
342
+ * @example
343
+ * 'email@example.com'
344
+ * @example
345
+ * 'Name <email@example.com>'
346
+ */
347
+ to?: EmailsSendRecipientInput;
348
+ /**
349
+ * Adjust open and click tracking for the message. Please note that enabling tracking for your messages requires a subscription that supports open and click tracking.
350
+ *
351
+ * Only links (`<a>` tags) meeting all of the following conditions are processed for click tracking:
352
+ * - The URL is non-empty.
353
+ * - The URL starts with `http` or `https`.
354
+ * - The link does not have a `clicktracking` attribute set to `off`.
355
+ */
356
+ tracking?: EmailsSendTracking;
357
+ /**
358
+ * A single `replyTo` recipient object, or a single email address.
359
+ * @example
360
+ * { email: 'email@example.com', name: 'Example' }
361
+ * @example
362
+ * 'email@example.com'
363
+ * @example
364
+ * 'Name <email@example.com>'
365
+ */
366
+ replyTo?: EmailsSendRecipient | string;
367
+ /**
368
+ * The subject of the email.
369
+ */
370
+ subject: string;
371
+ /**
372
+ * Template configuration for rendering email content with a template engine.
373
+ */
374
+ template?: EmailsSendTemplate;
375
+ /**
376
+ * Mark these messages as transactional or non-transactional. In order for a message to be marked as non-transactional, it must have exactly one recipient per personalization, and it must be DKIM signed. 400 Bad Request will be returned if there are more than one recipient in any personalization for non-transactional messages. If a message is marked as non-transactional, it changes the sending process as follows:
377
+ *
378
+ * List-Unsubscribe and List-Unsubscribe-Post headers will be added, unless you supply your own List-Unsubscribe header, in which case yours is used and neither is added.
379
+ * @default true
380
+ */
381
+ transactional?: boolean;
382
+ /**
383
+ * Settings to customize the unsubscribe experience for the message.
384
+ */
385
+ unsubscribe?: {
386
+ /**
387
+ * The name of a configured active unsubscribe tracking domain.
388
+ * When specified, unsubscribe links will use this domain instead of the default MailChannels domain.
389
+ * The domain must be registered in your account and have an active status.
390
+ */
391
+ customDomainName?: string;
392
+ };
393
+ }
394
+ type EmailsSendTargetOptions = {
395
+ personalizations: (Omit<EmailsSendPersonalization, "template"> & {
396
+ template?: never;
397
+ })[];
398
+ to?: never;
399
+ cc?: never;
400
+ bcc?: never;
401
+ } | {
402
+ template: EmailsSendTemplate;
403
+ personalizations: EmailsSendPersonalization[];
404
+ to?: never;
405
+ cc?: never;
406
+ bcc?: never;
407
+ } | {
408
+ personalizations?: never;
409
+ to: EmailsSendRecipientInput;
410
+ cc?: EmailsSendRecipientInput;
411
+ bcc?: EmailsSendRecipientInput;
412
+ };
413
+ type EmailsSendOptions = EmailsSendOptionsBase & EmailsSendTargetOptions & ({
414
+ /**
415
+ * The HTML content of the email.
416
+ * @example
417
+ * '<p>Hello World</p>'
418
+ */
419
+ html: string;
420
+ /**
421
+ * The plain text content of the email (optional when `html` is provided).
422
+ * @example
423
+ * 'Hello World'
424
+ */
425
+ text?: string;
426
+ /**
427
+ * Additional content parts. Cannot contain a `text/html` entry when `html` is set, or a `text/plain` entry when `text` is set.
428
+ */
429
+ content?: EmailsSendContent[];
430
+ } | {
431
+ /**
432
+ * The HTML content of the email (optional when `text` is provided).
433
+ * @example
434
+ * '<p>Hello World</p>'
435
+ */
436
+ html?: string;
437
+ /**
438
+ * The plain text content of the email.
439
+ * @example
440
+ * 'Hello World'
441
+ */
442
+ text: string;
443
+ /**
444
+ * Additional content parts. Cannot contain a `text/html` entry when `html` is set, or a `text/plain` entry when `text` is set.
445
+ */
446
+ content?: EmailsSendContent[];
447
+ } | {
448
+ /**
449
+ * The HTML content of the email (optional when `content` is provided).
450
+ * @example
451
+ * '<p>Hello World</p>'
452
+ */
453
+ html?: string;
454
+ /**
455
+ * The plain text content of the email (optional when `content` is provided).
456
+ * @example
457
+ * 'Hello World'
458
+ */
459
+ text?: string;
460
+ /**
461
+ * Send the body of your message in multiple different formats. The recipient's email client will render the message using the content type that best fits their environment. Cannot contain a `text/html` entry when `html` is set, or a `text/plain` entry when `text` is set.
462
+ */
463
+ content: EmailsSendContent[];
464
+ });
465
+ type EmailsSendResponse = DataResponse<{
466
+ /**
467
+ * Fully rendered message if `dryRun` was set to `true`. A string representation of a rendered message, one per personalization in the request.
468
+ */
469
+ rendered?: string[];
470
+ /**
471
+ * The Request ID is a unique identifier generated by the service to track the HTTP request. It will also be included in all webhooks for reference.
472
+ */
473
+ requestId?: string;
474
+ results?: {
475
+ /**
476
+ * The index of the personalization in the request. Starts at 0.
477
+ */
478
+ index?: number;
479
+ /**
480
+ * The Message ID is a unique identifier generated by the service. Each personalization has a distinct Message ID, which is also used in the `Message-Id` header and included in webhooks.
481
+ */
482
+ messageId: string;
483
+ /**
484
+ * A human-readable explanation of the status.
485
+ */
486
+ reason?: string;
487
+ /**
488
+ * The status of the message. Note that 'sent' is a temporary status; the final status will be provided through webhooks, if configured.
489
+ */
490
+ status: "sent" | "failed";
491
+ }[];
492
+ }>;
493
+ type EmailsQueueResponse = DataResponse<{
494
+ /**
495
+ * ISO 8601 timestamp when the request was queued for processing.
496
+ */
497
+ queuedAt: string;
498
+ /**
499
+ * Unique identifier for tracking this async request. Will be included in all webhook events for this request.
500
+ */
501
+ requestId: string;
502
+ }>;
503
+ /** @deprecated Use `EmailsQueueResponse` instead. */
504
+ type EmailsSendAsyncResponse = EmailsQueueResponse;
505
+ declare class Emails {
506
+ protected mailchannels: MailChannelsClient;
507
+ constructor(mailchannels: MailChannelsClient);
508
+ private _sendEmail;
509
+ /**
510
+ * Sends an email message to one or more recipients.
511
+ * @param options - The email options to send.
512
+ * @param dryRun - When set to `true`, the message will not be sent. Instead, the fully rendered message will be returned in the `data` property of the response. The default value is `false`.
513
+ * @example
514
+ * ```ts
515
+ * const mailchannels = new MailChannels('your-api-key')
516
+ * const { data, error } = await mailchannels.emails.send({
517
+ * to: 'to@example.com',
518
+ * from: 'from@example.com',
519
+ * subject: 'Test',
520
+ * html: 'Test'
521
+ * })
522
+ * ```
523
+ */
524
+ send(options: EmailsSendOptions, dryRun?: boolean): Promise<EmailsSendResponse>;
525
+ /**
526
+ * Queues an email message for asynchronous processing and returns immediately with a request ID.
527
+ *
528
+ * The email will be processed in the background, and you'll receive webhook events for all delivery status updates (e.g. `dropped`, `processed`, `delivered`, `hard-bounced`). These webhook events are identical to those sent for the synchronous /send endpoint.
529
+ *
530
+ * Use this endpoint when you need to send emails without waiting for processing to complete. This can improve your application's response time, especially when sending to multiple recipients.
531
+ * @param options - The email options to send.
532
+ * @example
533
+ * ```ts
534
+ * const mailchannels = new MailChannels('your-api-key')
535
+ * const { data, error } = await mailchannels.emails.queue({
536
+ * to: 'to@example.com',
537
+ * from: 'from@example.com',
538
+ * subject: 'Test',
539
+ * html: 'Test'
540
+ * })
541
+ * ```
542
+ */
543
+ queue(options: EmailsSendOptions): Promise<EmailsQueueResponse>;
544
+ /**
545
+ * @deprecated Use `queue` instead.
546
+ */
547
+ sendAsync(options: EmailsSendOptions): Promise<EmailsQueueResponse>;
548
+ }
549
+ interface DomainsDkimCreateOptions {
550
+ /**
551
+ * Algorithm used for the new key pair Currently, only RSA is supported.
552
+ * @default "rsa"
553
+ */
554
+ algorithm?: "rsa";
555
+ /**
556
+ * Key length in bits. For RSA, must be a multiple of 1024. Common values: 1024 or 2048.
557
+ * @default 2048
558
+ */
559
+ length?: 1024 | 2048 | 3072 | 4096;
560
+ /**
561
+ * Selector for the new key pair. Must be a maximum of 63 characters.
562
+ */
563
+ selector: string;
564
+ }
565
+ type DomainsDkimKeyStatus = "active" | "retired" | "revoked" | "rotated";
566
+ interface DomainsDkimKey {
567
+ /**
568
+ * Algorithm used for the key pair.
569
+ */
570
+ algorithm: string;
571
+ /**
572
+ * Timestamp when the key pair was created.
573
+ */
574
+ createdAt?: string;
575
+ /**
576
+ * Suggested DNS records for the DKIM key.
577
+ */
578
+ dnsRecords: {
579
+ name: string;
580
+ type: string;
581
+ value: string;
582
+ }[];
583
+ /**
584
+ * Domain associated with the key pair.
585
+ */
586
+ domain: string;
587
+ /**
588
+ * UTC timestamp after which you can no longer use the rotated key for signing.
589
+ */
590
+ gracePeriodExpiresAt?: string;
591
+ /**
592
+ * Key length in bits.
593
+ */
594
+ length: 1024 | 2048 | 3072 | 4096;
595
+ publicKey: string;
596
+ /**
597
+ * UTC timestamp when a rotated key pair is retired.
598
+ */
599
+ retiresAt?: string;
600
+ /**
601
+ * Selector assigned to the key pair.
602
+ */
603
+ selector: string;
604
+ /**
605
+ * Status of the key.
606
+ */
607
+ status: DomainsDkimKeyStatus;
608
+ /**
609
+ * Timestamp when the key was last modified.
610
+ */
611
+ statusModifiedAt?: string;
612
+ }
613
+ type DomainsDkimCreateResponse = DataResponse<DomainsDkimKey>;
614
+ interface DomainsDkimListOptions {
615
+ /**
616
+ * Selector to filter keys by. Must be a maximum of 63 characters.
617
+ */
618
+ selector?: string;
619
+ /**
620
+ * Status to filter keys by.
621
+ */
622
+ status?: DomainsDkimKey["status"];
623
+ /**
624
+ * Number of keys to skip before returning results.
625
+ * @default 0
626
+ */
627
+ offset?: number;
628
+ /**
629
+ * Maximum number of keys to return. Maximum is `100` and minimum is `1`.
630
+ * @default 10
631
+ */
632
+ limit?: number;
633
+ /**
634
+ * If `true`, includes the suggested DKIM DNS record for each returned key.
635
+ * @default false
636
+ */
637
+ includeDnsRecord?: boolean;
638
+ }
639
+ type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
640
+ type DomainsDkimListResponse = DataResponse<Optional<DomainsDkimKey, "dnsRecords">[]>;
641
+ interface DomainsDkimUpdateStatusOptions {
642
+ /**
643
+ * Selector of the DKIM key pair to update. Must be a maximum of 63 characters.
644
+ */
645
+ selector: string;
646
+ /**
647
+ * New status of the DKIM key pair.
648
+ * - `revoked`: Indicates that the key is compromised and should not be used.
649
+ * - `retired`: Indicates that the key has been rotated and is no longer in use.
650
+ * - `rotated`: Indicates that the key is going through the rotation process. Only active key pairs can be updated to this status, and no new key pair is created. The rotated key can be used to sign emails for 3 days after the status update, and will automatically change to `retired` 2 weeks after update. For a smooth key transition, it is recommended to create and publish a new key pair before signing is disabled for the rotated key.
651
+ */
652
+ status: Exclude<DomainsDkimKey["status"], "active">;
653
+ }
654
+ interface DomainsDkimRotateOptions {
655
+ newKey: {
656
+ /**
657
+ * Selector for the new key pair. Must be a maximum of 63 characters.
658
+ */
659
+ selector: string;
660
+ };
661
+ }
662
+ type DomainsDkimRotateResponse = DataResponse<{
663
+ new: DomainsDkimKey;
664
+ rotated: DomainsDkimKey;
665
+ }>;
666
+ declare class DomainsDkim {
667
+ private mailchannels;
668
+ constructor(mailchannels: MailChannelsClient);
669
+ /**
670
+ * Create a DKIM key pair for a specified domain and selector using the specified algorithm and key length, for the current customer.
671
+ * @param domain - The domain to create the DKIM key for.
672
+ * @param options - DKIM key creation options.
673
+ * @example
674
+ * ```ts
675
+ * const mailchannels = new MailChannels('your-api-key')
676
+ * const { data, error } = await mailchannels.domains.dkim.create('example.com', {
677
+ * selector: 'mailchannels'
678
+ * })
679
+ * ```
680
+ */
681
+ create(domain: string, options: DomainsDkimCreateOptions): Promise<DomainsDkimCreateResponse>;
682
+ /**
683
+ * Search for DKIM keys by domain, with optional filters. If selector is provided, at most one key will be returned.
684
+ * @param domain - The domain to search DKIM keys for.
685
+ * @param options - The options to filter DKIM keys by.
686
+ * @example
687
+ * ```ts
688
+ * const mailchannels = new MailChannels('your-api-key')
689
+ * const { data, error } = await mailchannels.domains.dkim.list('example.com', {
690
+ * includeDnsRecord: true
691
+ * })
692
+ * ```
693
+ */
694
+ list(domain: string, options?: DomainsDkimListOptions): Promise<DomainsDkimListResponse>;
695
+ /**
696
+ * Update fields of an existing DKIM key pair for the specified domain and selector, for the current customer. Currently, only the `status` field can be updated.
697
+ * @param domain - The domain the DKIM key belongs to.
698
+ * @param options - The options to update the DKIM key.
699
+ * @example
700
+ * ```ts
701
+ * const mailchannels = new MailChannels('your-api-key')
702
+ * const { success, error } = await mailchannels.domains.dkim.updateStatus('example.com', {
703
+ * selector: 'mailchannels',
704
+ * status: 'retired'
705
+ * })
706
+ */
707
+ updateStatus(domain: string, options: DomainsDkimUpdateStatusOptions): Promise<SuccessResponse>;
708
+ /**
709
+ * Rotate an active DKIM key pair. Mark the original key as `rotated`, and create a new key pair with the required new key selector, reusing the same algorithm and key length. The rotated key remains valid for signing for a 3-day grace period, and is automatically changed to `retired` 2 weeks after rotation. Publish the new key to its DNS TXT record before rotated key expires for signing as emails sent with an unpublished key will fail DKIM validation by receiving providers. After the grace period, only the new key is valid for signing if published.
710
+ * @param domain - The domain the DKIM key belongs to.
711
+ * @param selector - The selector of the DKIM key to rotate.
712
+ * @param options - The options to rotate the DKIM key.
713
+ * @param options.newKey.selector - The selector for the new key pair. Must be a maximum of 63 characters.
714
+ * @example
715
+ * ```ts
716
+ * const mailchannels = new MailChannels('your-api-key')
717
+ * const { data, error } = await mailchannels.domains.dkim.rotate('example.com', 'mailchannels', {
718
+ * newKey: {
719
+ * selector: 'new-selector'
720
+ * }
721
+ * })
722
+ * ```
723
+ */
724
+ rotate(domain: string, selector: string, options: DomainsDkimRotateOptions): Promise<DomainsDkimRotateResponse>;
725
+ }
726
+ type DomainsCustomTrackingScope = "click" | "open" | "unsubscribe";
727
+ interface DomainsCustomTrackingDomain {
728
+ /**
729
+ * The label for this custom tracking domain.
730
+ */
731
+ name: string;
732
+ /**
733
+ * The registered domain hostname.
734
+ */
735
+ hostname: string;
736
+ /**
737
+ * The event type this domain handles.
738
+ */
739
+ scope: DomainsCustomTrackingScope;
740
+ /**
741
+ * Current status of the custom tracking domain.
742
+ */
743
+ status: "active" | "disabled";
744
+ /**
745
+ * ISO 8601 timestamp when the domain was registered.
746
+ */
747
+ createdAt: string;
748
+ }
749
+ interface DomainsCustomTrackingDnsSetupRequired {
750
+ /**
751
+ * UUID v4 nonce; also the TXT record value to set. Present only when TXT ownership verification is pending.
752
+ * @example "550e8400-e29b-41d4-a716-446655440000"
753
+ */
754
+ token?: string;
755
+ /**
756
+ * Fully-qualified DNS TXT record name to add. Present only when TXT ownership verification is pending.
757
+ * @example "_mailchannels-verify.click.example.com"
758
+ */
759
+ txtRecordName?: string;
760
+ /**
761
+ * Value for the DNS TXT record (same as token). Present only when TXT ownership verification is pending.
762
+ * @example "550e8400-e29b-41d4-a716-446655440000"
763
+ */
764
+ txtRecordValue?: string;
765
+ /**
766
+ * Human-readable guidance for the DNS records that must be in place before retrying.
767
+ */
768
+ instructions?: string;
769
+ }
770
+ type DomainsCustomTrackingWithDnsSetupRequired<T extends 202 | 201 | 200 | undefined = undefined> = T extends undefined ? DomainsCustomTrackingDomain & {
771
+ dnsSetupRequired: false;
772
+ } | DomainsCustomTrackingDnsSetupRequired & {
773
+ dnsSetupRequired: true;
774
+ } : T extends 202 ? DomainsCustomTrackingDnsSetupRequired & {
775
+ dnsSetupRequired: true;
776
+ } : DomainsCustomTrackingDomain & {
777
+ dnsSetupRequired: false;
778
+ };
779
+ type DomainsCustomTrackingCreateResponse = DataResponse<DomainsCustomTrackingWithDnsSetupRequired>;
780
+ interface DomainsCustomTrackingListOptions {
781
+ /**
782
+ * Filter by custom tracking domain label.
783
+ */
784
+ name?: string;
785
+ /**
786
+ * Filter by status.
787
+ */
788
+ status?: "active" | "disabled";
789
+ /**
790
+ * Filter by scope.
791
+ */
792
+ scope?: DomainsCustomTrackingScope;
793
+ /**
794
+ * The maximum number of domains to return. Possible values are `1` to `1000`.
795
+ * @default 100
796
+ */
797
+ limit?: number;
798
+ /**
799
+ * The number of domains to skip before returning results. The default is `0`.
800
+ * @default 0
801
+ */
802
+ offset?: number;
803
+ }
804
+ type DomainsCustomTrackingListResponse = DataResponse<{
805
+ /**
806
+ * List of custom tracking domains matching the filter criteria.
807
+ */
808
+ customTrackingDomains: DomainsCustomTrackingDomain[];
809
+ /**
810
+ * Total number of custom tracking domains.
811
+ */
812
+ total: number;
813
+ }>;
814
+ interface DomainsCustomTrackingUpdateOptions {
815
+ /**
816
+ * New label for this custom tracking domain. Maximum length is `64` characters. Must match the pattern `^[a-z0-9-]+$`.
817
+ */
818
+ name?: string;
819
+ /**
820
+ * New status. Re-activation requires DNS verification — add the TXT record and CNAME record described in the response body, then retry.
821
+ */
822
+ status?: "active" | "disabled";
823
+ }
824
+ type DomainsCustomTrackingUpdateResponse = DataResponse<DomainsCustomTrackingWithDnsSetupRequired>;
825
+ declare class DomainsCustomTracking {
826
+ private mailchannels;
827
+ private static readonly SCOPE_VALUES;
828
+ constructor(mailchannels: MailChannelsClient);
829
+ /**
830
+ * Retrieve all custom tracking domains registered under your account.
831
+ * Optional filters include domain name, status, scope, limit and offset.
832
+ * @param options - Optional filter options.
833
+ * @example
834
+ * ```ts
835
+ * const mailchannels = new MailChannels('your-api-key')
836
+ * const { data, error } = await mailchannels.domains.customTracking.list({
837
+ * status: 'active'
838
+ * })
839
+ * ```
840
+ */
841
+ list(options?: DomainsCustomTrackingListOptions): Promise<DomainsCustomTrackingListResponse>;
842
+ /**
843
+ * Register a custom branded domain for click tracking, open tracking, or unsubscribe handling. By default, MailChannels uses shared domains for these links. Using a custom domain improves brand consistency by replacing shared domains with your own (e.g., `click.example.com`). Once registered, select the domain at send time using its `name`.
844
+ *
845
+ * Before registration completes, two DNS records must be in place:
846
+ * 1. A TXT record at `_mailchannels-verify.<hostname>` containing the verification token (returned when DNS setup is required).
847
+ * 2. A CNAME record at `<hostname>` pointing to `links.mailchannels.net`.
848
+ * @param name - A unique label used to select this domain at message send time. Maximum length is `64` characters. Must match the pattern `^[a-z0-9-]+$`.
849
+ * @param hostname - The hostname to register as a custom tracking domain (e.g., `click.example.com`).
850
+ * @param scope - The event type this domain handles.
851
+ * @example
852
+ * ```ts
853
+ * const mailchannels = new MailChannels('your-api-key')
854
+ * const { data, error } = await mailchannels.domains.customTracking.create(
855
+ * 'clickdemo',
856
+ * 'click.example.com',
857
+ * 'click'
858
+ * )
859
+ * ```
860
+ */
861
+ create(name: string, hostname: string, scope: DomainsCustomTrackingScope): Promise<DomainsCustomTrackingCreateResponse>;
862
+ /**
863
+ * Update an existing custom tracking domain by its hostname and scope. Supports updating the custom tracking domain's name or toggling its active status.
864
+ * @param hostname - The hostname of the custom tracking domain to update.
865
+ * @param scope - The scope of the custom tracking domain to update.
866
+ * @param options - The options for updating the custom tracking domain.
867
+ * @example
868
+ * ```ts
869
+ * const mailchannels = new MailChannels('your-api-key')
870
+ * const { data, error } = await mailchannels.domains.customTracking.update('click.example.com', 'click', {
871
+ * name: 'newclickname',
872
+ * status: 'active'
873
+ * })
874
+ * ```
875
+ */
876
+ update(hostname: string, scope: DomainsCustomTrackingScope, options: DomainsCustomTrackingUpdateOptions): Promise<DomainsCustomTrackingUpdateResponse>;
877
+ /**
878
+ * Permanently delete an existing custom tracking domain for the given hostname and scope. The domain can be re-registered if needed.
879
+ *
880
+ * WARNING: Any tracking links or unsubscribe URLs in previously sent emails using this domain will stop working immediately.
881
+ * @param hostname - The hostname of the custom tracking domain to delete.
882
+ * @param scope - The scope of the custom tracking domain to delete.
883
+ * @example
884
+ * ```ts
885
+ * const mailchannels = new MailChannels('your-api-key')
886
+ * const { success, error } = await mailchannels.domains.customTracking.delete('click.example.com', 'click')
887
+ * ```
888
+ */
889
+ delete(hostname: string, scope: DomainsCustomTrackingScope): Promise<SuccessResponse>;
890
+ }
891
+ interface DomainsCheck {
892
+ /**
893
+ * Domain used for DKIM signing.
894
+ */
895
+ domain?: string;
896
+ /**
897
+ * DKIM private key encoded in Base64.
898
+ */
899
+ privateKey?: string;
900
+ /**
901
+ * DKIM selector in the domain DNS records.
902
+ */
903
+ selector?: string;
904
+ }
905
+ interface DomainsCheckOptions {
906
+ /**
907
+ * Each item may include DKIM `domain`, `selector` and `privateKey`. Up to 10 items are allowed. The absence or presence of these fields affects how DKIM settings are validated:
908
+ * 1. If `domain`, `selector`, and `privateKey` are all present, verify using the provided domain, selector, and key.
909
+ * 2. If `domain` and `selector` are present, use the stored private key for the given domain and selector.
910
+ * 3. If only `domain` is present, use all stored keys for the given domain.
911
+ * 4. If none are present, use all stored keys for the `domain` provided in the domain field of the request.
912
+ * 5. If `privateKey` is present, `selector` must be present.
913
+ * 6. If `selector` is present and `domain` is not, the domain will be taken from the domain field of the request.
914
+ */
915
+ dkim?: DomainsCheck[] | DomainsCheck;
916
+ /**
917
+ * Used exclusively for [Domain Lockdown](https://support.mailchannels.com/hc/en-us/articles/16918954360845-Secure-your-domain-name-against-spoofing-with-Domain-Lockdown) verification. If you're not using senderid to associate your domain with your account, you can disregard this field. The corresponding value is included in the `X-MailChannels-SenderId` header of emails sent via MailChannels.
918
+ */
919
+ senderId?: string;
920
+ }
921
+ type DomainsCheckVerdict = "passed" | "failed" | "soft failed" | "temporary error" | "permanent error" | "neutral" | "none" | "unknown";
922
+ type DomainsCheckResponse = DataResponse<{
923
+ dkim: {
924
+ domain: string;
925
+ /**
926
+ * The human readable status of the DKIM key used for verification.
927
+ */
928
+ keyStatus?: DomainsDkimKey["status"] | "provided";
929
+ selector: string;
930
+ /**
931
+ * A human-readable explanation of DKIM check.
932
+ */
933
+ reason?: string;
934
+ verdict: Extract<DomainsCheckVerdict, "passed" | "failed">;
935
+ }[];
936
+ domainLockdown: {
937
+ /**
938
+ * A human-readable explanation of Domain Lockdown check.
939
+ */
940
+ reason?: string;
941
+ verdict: Extract<DomainsCheckVerdict, "passed" | "failed">;
942
+ };
943
+ /**
944
+ * These results are here to help avoid [SDNF](https://support.mailchannels.com/hc/en-us/articles/203155500-550-5-2-1-SDNF-Sender-Domain-Not-Found) (Sender Domain Not Found) blocks. For messages not to get blocked by SDNF, we require either an MX or A record to exist for the sender domain.
945
+ */
946
+ senderDomain: {
947
+ a: {
948
+ /**
949
+ * A human-readable explanation of A record check.
950
+ */
951
+ reason?: string;
952
+ verdict: Extract<DomainsCheckVerdict, "passed" | "failed">;
953
+ };
954
+ mx: {
955
+ /**
956
+ * A human-readable explanation of MX record check.
957
+ */
958
+ reason?: string;
959
+ verdict: Extract<DomainsCheckVerdict, "passed" | "failed">;
960
+ };
961
+ /**
962
+ * Overall verdict. Passed if either A or MX record check passed.
963
+ */
964
+ verdict: Extract<DomainsCheckVerdict, "passed" | "failed">;
965
+ };
966
+ spf: {
967
+ /**
968
+ * A human-readable explanation of SPF check.
969
+ */
970
+ reason?: string;
971
+ /**
972
+ * The SPF record that was used for the check.
973
+ */
974
+ spfRecord?: string;
975
+ /**
976
+ * Error message if the SPF record lookup failed.
977
+ */
978
+ spfRecordError?: string;
979
+ verdict: DomainsCheckVerdict;
980
+ };
981
+ references?: string[];
982
+ }>;
983
+ declare class Domains {
984
+ protected mailchannels: MailChannelsClient;
985
+ readonly dkim: DomainsDkim;
986
+ readonly customTracking: DomainsCustomTracking;
987
+ constructor(mailchannels: MailChannelsClient);
988
+ /**
989
+ * Validates a domain's email authentication setup by retrieving its DKIM, SPF, and Domain Lockdown status. This endpoint checks whether the domain is properly configured for secure email delivery.
990
+ * @param domain - Domain used for sending emails. If `dkim` settings are not provided, or `dkim` settings are provided with no `domain`, the stored dkim settings for this domain will be used.
991
+ * @param options - The domain options to check.
992
+ * @example
993
+ * ```ts
994
+ * const mailchannels = new MailChannels('your-api-key')
995
+ * const { data, error } = await mailchannels.domains.check('example.com', {
996
+ * dkim: [{
997
+ * domain: 'example.com',
998
+ * privateKey: 'your-private-key',
999
+ * selector: 'mailchannels'
1000
+ * }],
1001
+ * senderId: 'sender-id'
1002
+ * })
1003
+ * ```
1004
+ */
1005
+ check(domain: string, options?: DomainsCheckOptions): Promise<DomainsCheckResponse>;
1006
+ }
1007
+ type WebhooksListResponse = DataResponse<{
1008
+ /**
1009
+ * A customer's webhook that events will be sent to
1010
+ */
1011
+ webhook: string;
1012
+ }[]>;
1013
+ type WebhooksSigningKeyResponse = DataResponse<{
1014
+ /**
1015
+ * The ID of the key.
1016
+ */
1017
+ id: string;
1018
+ /**
1019
+ * The public key used to verify webhook signatures.
1020
+ */
1021
+ key: string;
1022
+ }>;
1023
+ type WebhooksValidateResponse = DataResponse<{
1024
+ /**
1025
+ * Indicates whether all webhook validations passed.
1026
+ */
1027
+ allPassed: boolean;
1028
+ /**
1029
+ * Detailed results for each tested webhook, including whether it returned a 2xx status code, along with its response status code and body.
1030
+ */
1031
+ results: {
1032
+ /**
1033
+ * Indicates whether the webhook responded with a 2xx HTTP status code.
1034
+ */
1035
+ result: "passed" | "failed";
1036
+ /**
1037
+ * The webhook that was validated.
1038
+ */
1039
+ webhook: string;
1040
+ /**
1041
+ * The HTTP response returned by the webhook, including status code and response body. A null value indicates no response was received. Possible reasons include timeouts, connection failures, or other network-related issues.
1042
+ */
1043
+ response: {
1044
+ /**
1045
+ * Response body from webhook. Returns an error if unprocessable or too large.
1046
+ */
1047
+ body?: string;
1048
+ /**
1049
+ * HTTP status code returned by the webhook.
1050
+ */
1051
+ status: number;
1052
+ } | null;
1053
+ }[];
1054
+ }>;
1055
+ type WebhookEventType = "processed" | "delivered" | "open" | "click" | "hard-bounced" | "soft-bounced" | "dropped" | "complained" | "unsubscribed" | "test";
1056
+ interface WebhookEventBase<T extends WebhookEventType> {
1057
+ /**
1058
+ * The sender's email address
1059
+ */
1060
+ email?: string;
1061
+ /**
1062
+ * The MailChannels account ID that generated the webhook.
1063
+ * If the message was sent by a sub-account, this field contains the sub-account handle.
1064
+ */
1065
+ customerHandle: string;
1066
+ /**
1067
+ * The Unix timestamp (in seconds) when the event occurred; the timezone is always UTC
1068
+ */
1069
+ timestamp: number;
1070
+ /**
1071
+ * The Message-Id of the message that generated the event
1072
+ */
1073
+ smtpId?: string;
1074
+ /**
1075
+ * The type of event that occurred
1076
+ */
1077
+ event: T;
1078
+ /**
1079
+ * A unique identifier generated to track the original HTTP request
1080
+ */
1081
+ requestId?: string;
1082
+ /**
1083
+ * The campaign identifier for the message that generated the event
1084
+ */
1085
+ campaignId?: string;
1086
+ /**
1087
+ * The recipients of the message
1088
+ */
1089
+ recipients?: string[];
1090
+ }
1091
+ interface WebhookEventProcessed extends WebhookEventBase<"processed"> {}
1092
+ interface WebhookEventDelivered extends WebhookEventBase<"delivered"> {}
1093
+ interface WebhookEventWithTracking {
1094
+ /**
1095
+ * The User-Agent header given when the recipient opened the message
1096
+ */
1097
+ userAgent?: string;
1098
+ /**
1099
+ * The IP address of the host that made the HTTP request
1100
+ */
1101
+ ip?: string;
1102
+ }
1103
+ interface WebhookEventOpen extends WebhookEventBase<"open">, WebhookEventWithTracking {}
1104
+ interface WebhookEventClick extends WebhookEventBase<"click">, WebhookEventWithTracking {
1105
+ /**
1106
+ * The URL that was clicked by the recipient
1107
+ */
1108
+ url?: string;
1109
+ }
1110
+ interface WebhookEventWithStatus {
1111
+ /**
1112
+ * The SMTP status code that caused the bounce
1113
+ */
1114
+ status?: string;
1115
+ /**
1116
+ * A human-readable explanation of why the message hard-bounced
1117
+ */
1118
+ reason?: string;
1119
+ }
1120
+ interface WebhookEventHardBounced extends WebhookEventBase<"hard-bounced">, WebhookEventWithStatus {}
1121
+ interface WebhookEventSoftBounced extends WebhookEventBase<"soft-bounced">, WebhookEventWithStatus {}
1122
+ interface WebhookEventDropped extends WebhookEventBase<"dropped">, WebhookEventWithStatus {}
1123
+ interface WebhookEventComplained extends WebhookEventBase<"complained"> {}
1124
+ interface WebhookEventUnsubscribed extends WebhookEventBase<"unsubscribed"> {}
1125
+ interface WebhookEventTest extends Omit<WebhookEventBase<"test">, "recipients" | "campaignId"> {}
1126
+ type WebhookEvent = WebhookEventProcessed | WebhookEventDelivered | WebhookEventOpen | WebhookEventClick | WebhookEventHardBounced | WebhookEventSoftBounced | WebhookEventDropped | WebhookEventComplained | WebhookEventUnsubscribed | WebhookEventTest;
1127
+ interface WebhooksVerifyOptions {
1128
+ /**
1129
+ * The raw body of the incoming webhook request as a string. This should be the exact payload received from the webhook, without any modifications or parsing, to ensure accurate signature verification.
1130
+ */
1131
+ payload: string;
1132
+ /**
1133
+ * The headers of the incoming webhook request as a record of key-value pairs. These headers should include `content-digest`, `signature`, and `signature-input` required for validating the authenticity of the webhook request.
1134
+ */
1135
+ headers: Record<string, string> | {
1136
+ "content-digest": string;
1137
+ "signature": string;
1138
+ "signature-input": string;
1139
+ };
1140
+ /**
1141
+ * The public key used to verify the webhook signature. If not provided, the SDK will attempt to retrieve the appropriate public key based on the `keyId` specified in the `signature-input` header.
1142
+ */
1143
+ publicKey?: string;
1144
+ /**
1145
+ * Whether to cache signing keys fetched from the API by their `keyId`. Defaults to `true`.
1146
+ * @default true
1147
+ */
1148
+ cache?: boolean;
1149
+ }
1150
+ type WebhooksVerifyResponse = DataResponse<WebhookEvent[]>;
1151
+ type WebhooksBatchStatus = "1xx" | "2xx" | "3xx" | "4xx" | "5xx" | "no_response";
1152
+ type WebhooksBatchResponseStatus = "1xx_response" | "2xx_response" | "3xx_response" | "4xx_response" | "5xx_response" | "no_response";
1153
+ interface WebhooksBatchesOptions {
1154
+ /**
1155
+ * Inclusive lower bound (UTC) for filtering webhook batches by creation time. Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object.
1156
+ */
1157
+ createdAfter?: string | Date;
1158
+ /**
1159
+ * Exclusive upper bound (UTC) for filtering webhook batches by creation time. Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object.
1160
+ */
1161
+ createdBefore?: string | Date;
1162
+ /**
1163
+ * Filters webhook batches by webhook response status category. If not provided, batches with all categories are returned.
1164
+ */
1165
+ statuses?: WebhooksBatchStatus[];
1166
+ /**
1167
+ * Filters webhook batches by the webhook endpoint to which events in the batch were posted.
1168
+ */
1169
+ webhook?: string;
1170
+ /**
1171
+ * The maximum number of webhook batches to return. Must be between `1` and `500`.
1172
+ * @default 500
1173
+ */
1174
+ limit?: number;
1175
+ /**
1176
+ * The number of webhook batches to skip before starting to collect the result set.
1177
+ * @default 0
1178
+ */
1179
+ offset?: number;
1180
+ }
1181
+ interface WebhooksBatch {
1182
+ /**
1183
+ * Unique identifier for the webhook batch.
1184
+ */
1185
+ batchId: number;
1186
+ /**
1187
+ * Timestamp of when the webhook batch was created.
1188
+ */
1189
+ createdAt: string;
1190
+ /**
1191
+ * Customer handle associated with the webhook batch.
1192
+ */
1193
+ customerHandle: string;
1194
+ /**
1195
+ * Duration of the webhook batch, measured from the time the request was sent to the webhook endpoint until the response was received.
1196
+ */
1197
+ duration?: {
1198
+ unit: "milliseconds";
1199
+ value: number;
1200
+ };
1201
+ /**
1202
+ * Number of events in the webhook batch.
1203
+ */
1204
+ eventCount: number;
1205
+ /**
1206
+ * Status of the webhook batch.
1207
+ */
1208
+ status: WebhooksBatchResponseStatus;
1209
+ /**
1210
+ * HTTP status code returned by the webhook endpoint.
1211
+ */
1212
+ statusCode: number | null;
1213
+ /**
1214
+ * Webhook endpoint to which events in the batch were posted.
1215
+ */
1216
+ webhook: string;
1217
+ }
1218
+ type WebhooksBatchesResponse = DataResponse<WebhooksBatch[]>;
1219
+ interface WebhooksResendBatch {
1220
+ /**
1221
+ * Unique identifier for the webhook batch.
1222
+ */
1223
+ batchId: number;
1224
+ /**
1225
+ * Customer handle associated with the webhook batch.
1226
+ */
1227
+ customerHandle: string;
1228
+ /**
1229
+ * Webhook URL to which events in the batch were posted.
1230
+ */
1231
+ webhook: string;
1232
+ /**
1233
+ * Timestamp of when the webhook batch was created.
1234
+ */
1235
+ createdAt: string;
1236
+ /**
1237
+ * Number of events in the webhook batch.
1238
+ */
1239
+ eventCount: number;
1240
+ /**
1241
+ * Duration of the webhook batch in milliseconds. `null` indicates that no response was returned from the webhook endpoint.
1242
+ */
1243
+ duration: number | null;
1244
+ /**
1245
+ * HTTP status code returned by the webhook endpoint. `null` indicates that no response was returned from the webhook endpoint.
1246
+ */
1247
+ statusCode: number | null;
1248
+ }
1249
+ type WebhooksResendBatchResponse = DataResponse<WebhooksResendBatch>;
1250
+ declare class Webhooks {
1251
+ protected mailchannels: MailChannelsClient;
1252
+ constructor(mailchannels: MailChannelsClient);
1253
+ /**
1254
+ * Enrolls the customer to receive event notifications via webhooks.
1255
+ * @param endpoint - The URL to receive event notifications. Must be no longer than `8000` characters.
1256
+ * @example
1257
+ * ```ts
1258
+ * const mailchannels = new MailChannels('your-api-key')
1259
+ * const { success, error } = await mailchannels.webhooks.create('https://example.com/api/webhooks/mailchannels')
1260
+ * ```
1261
+ */
1262
+ create(endpoint: string): Promise<SuccessResponse>;
1263
+ /**
1264
+ * Retrieves all registered webhook endpoints associated with the customer.
1265
+ * @example
1266
+ * ```ts
1267
+ * const mailchannels = new MailChannels('your-api-key')
1268
+ * const { data, error } = await mailchannels.webhooks.list()
1269
+ * ```
1270
+ */
1271
+ list(): Promise<WebhooksListResponse>;
1272
+ /**
1273
+ * Deletes all registered webhook endpoints for the customer.
1274
+ * @example
1275
+ * ```ts
1276
+ * const mailchannels = new MailChannels('your-api-key')
1277
+ * const { success, error } = await mailchannels.webhooks.deleteAll()
1278
+ * ```
1279
+ */
1280
+ deleteAll(): Promise<SuccessResponse>;
1281
+ /**
1282
+ * Retrieves the public key used to verify signatures on incoming webhook payloads.
1283
+ * @param id - The ID of the key.
1284
+ * @example
1285
+ * ```ts
1286
+ * const mailchannels = new MailChannels('your-api-key')
1287
+ * const { data, error } = await mailchannels.webhooks.getSigningKey('key-id')
1288
+ * ```
1289
+ */
1290
+ getSigningKey(id: string): Promise<WebhooksSigningKeyResponse>;
1291
+ /**
1292
+ * Validates whether your enrolled webhook(s) respond with an HTTP `2xx` status code. Sends a test request to each webhook containing your customer handle, a hardcoded event type (`test`), a hardcoded sender email (`test@mailchannels.com`), a timestamp, a request ID (provided or generated), and an SMTP ID. The response includes the HTTP status code and body returned by each webhook.
1293
+ * @param requestId - Optional identifier in the webhook payload. If not provided, a value will be automatically generated. Must not exceed 28 characters.
1294
+ * @example
1295
+ * ```ts
1296
+ * const mailchannels = new MailChannels('your-api-key')
1297
+ * const { data, error } = await mailchannels.webhooks.validate('optional-request-id')
1298
+ * ```
1299
+ */
1300
+ validate(requestId?: string): Promise<WebhooksValidateResponse>;
1301
+ /**
1302
+ * Verifies the authenticity of incoming webhook requests by validating their signatures using the provided options.
1303
+ * @param options - The options for verifying the webhook.
1304
+ * @example
1305
+ * ```ts
1306
+ * const { data, error } = await Webhooks.verify({ payload: rawBody, headers })
1307
+ * ```
1308
+ */
1309
+ static verify(options: WebhooksVerifyOptions): Promise<WebhooksVerifyResponse>;
1310
+ /**
1311
+ * Verifies the authenticity of incoming webhook requests by validating their signatures using the provided options.
1312
+ * @param options - The options for verifying the webhook.
1313
+ * @example
1314
+ * ```ts
1315
+ * const mailchannels = new MailChannels('your-api-key')
1316
+ * const { data, error } = await mailchannels.webhooks.verify({ payload: rawBody, headers })
1317
+ * ```
1318
+ */
1319
+ verify(options: WebhooksVerifyOptions): Promise<WebhooksVerifyResponse>;
1320
+ /**
1321
+ * Retrieves paged webhook batches associated with the customer. The time range specified by `createdAfter` and `createdBefore` must not exceed 31 days. If neither is specified, the default time range is the last 3 days.
1322
+ * @param options - The options for listing webhook batches.
1323
+ * @example
1324
+ * ```ts
1325
+ * const mailchannels = new MailChannels('your-api-key')
1326
+ * const { data, error } = await mailchannels.webhooks.batches()
1327
+ * ```
1328
+ */
1329
+ batches(options?: WebhooksBatchesOptions): Promise<WebhooksBatchesResponse>;
1330
+ /**
1331
+ * Synchronously resends the webhook batch with the provided `batchId` for the customer. The result is returned in the response.
1332
+ * @param batchId - The ID of the batch to resend.
1333
+ * @example
1334
+ * ```ts
1335
+ * const mailchannels = new MailChannels('your-api-key')
1336
+ * const { data, error } = await mailchannels.webhooks.resendBatch(123)
1337
+ * ```
1338
+ */
1339
+ resendBatch(batchId: number): Promise<WebhooksResendBatchResponse>;
1340
+ }
1341
+ interface SubAccount {
1342
+ /**
1343
+ * The name of the company associated with the sub-account.
1344
+ */
1345
+ companyName: string;
1346
+ /**
1347
+ * If the sub-account is enabled.
1348
+ */
1349
+ enabled: boolean;
1350
+ /**
1351
+ * The handle for the sub-account.
1352
+ */
1353
+ handle: string;
1354
+ }
1355
+ type SubAccountsCreateResponse = DataResponse<SubAccount>;
1356
+ /** @deprecated Use `SubAccount` instead. */
1357
+ type SubAccountsAccount = SubAccount;
1358
+ interface SubAccountsListOptions {
1359
+ /**
1360
+ * Possible values are `1` to `1000`.
1361
+ * @default 1000
1362
+ */
1363
+ limit?: number;
1364
+ /**
1365
+ * The offset for pagination.
1366
+ * @default 0
1367
+ */
1368
+ offset?: number;
1369
+ }
1370
+ type SubAccountsListResponse = DataResponse<SubAccount[]>;
1371
+ interface SubAccountsApiKey {
1372
+ /**
1373
+ * The API key ID for the sub-account.
1374
+ */
1375
+ id: number;
1376
+ /**
1377
+ * API key for the sub-account.
1378
+ */
1379
+ key: string;
1380
+ }
1381
+ type SubAccountsApiKeysCreateResponse = DataResponse<SubAccountsApiKey>;
1382
+ interface SubAccountsApiKeysListOptions {
1383
+ /**
1384
+ * The maximum number of API keys included in the response. Possible values are `1` to `1000`.
1385
+ * @default 100
1386
+ */
1387
+ limit?: number;
1388
+ /**
1389
+ * Offset into the list of API keys to return.
1390
+ * @default 0
1391
+ */
1392
+ offset?: number;
1393
+ }
1394
+ type SubAccountsApiKeysListResponse = DataResponse<SubAccountsApiKey[]>;
1395
+ /** @deprecated Use `SubAccountsApiKeysCreateResponse` instead. */
1396
+ type SubAccountsCreateApiKeyResponse = SubAccountsApiKeysCreateResponse;
1397
+ /** @deprecated Use `SubAccountsApiKeysListOptions` instead. */
1398
+ type SubAccountsListApiKeyOptions = SubAccountsApiKeysListOptions;
1399
+ /** @deprecated Use `SubAccountsApiKeysListResponse` instead. */
1400
+ type SubAccountsListApiKeyResponse = SubAccountsApiKeysListResponse;
1401
+ interface SubAccountsSmtpPassword {
1402
+ /**
1403
+ * Whether the SMTP password is enabled.
1404
+ */
1405
+ enabled: boolean;
1406
+ /**
1407
+ * The SMTP password ID for the sub-account.
1408
+ */
1409
+ id: number;
1410
+ /**
1411
+ * SMTP password for the sub-account.
1412
+ */
1413
+ smtpPassword: string;
1414
+ }
1415
+ type SubAccountsSmtpPasswordsCreateResponse = DataResponse<SubAccountsSmtpPassword>;
1416
+ type SubAccountsSmtpPasswordsListResponse = DataResponse<SubAccountsSmtpPassword[]>;
1417
+ /** @deprecated Use `SubAccountsSmtpPasswordsCreateResponse` instead. */
1418
+ type SubAccountsCreateSmtpPasswordResponse = SubAccountsSmtpPasswordsCreateResponse;
1419
+ /** @deprecated Use `SubAccountsSmtpPasswordsListResponse` instead. */
1420
+ type SubAccountsListSmtpPasswordResponse = SubAccountsSmtpPasswordsListResponse;
1421
+ interface SubAccountsLimit {
1422
+ sends: number;
1423
+ }
1424
+ interface SubAccountsLimitsSetOptions extends SubAccountsLimit {}
1425
+ type SubAccountsLimitsGetResponse = DataResponse<SubAccountsLimit>;
1426
+ /** @deprecated Use `SubAccountsLimitsGetResponse` instead. */
1427
+ type SubAccountsLimitResponse = SubAccountsLimitsGetResponse;
1428
+ interface SubAccountsUsage {
1429
+ /**
1430
+ * The end date of the current billing period (ISO 8601 format).
1431
+ * @example "2025-04-11"
1432
+ */
1433
+ endDate?: string;
1434
+ /**
1435
+ * The start date of the current billing period (ISO 8601 format).
1436
+ * @example "2025-03-12"
1437
+ */
1438
+ startDate?: string;
1439
+ /**
1440
+ * The total usage for the current billing period.
1441
+ * @example 5000
1442
+ */
1443
+ total: number;
1444
+ /**
1445
+ * The effective monthly limit for the current billing period. A limit of zero means the account cannot send any messages.
1446
+ * For sub-accounts with no explicit limit set (i.e., -1), the monthly limit for the parent account is returned.
1447
+ * @example 10000
1448
+ */
1449
+ monthlyLimit: number;
1450
+ }
1451
+ type SubAccountsUsageResponse = DataResponse<SubAccountsUsage>;
1452
+ interface MetricsEngagement {
1453
+ /**
1454
+ * A series of metrics aggregations bucketed by time interval (e.g. hour, day).
1455
+ */
1456
+ buckets: {
1457
+ click: MetricsBucket[];
1458
+ clickTrackingDelivered: MetricsBucket[];
1459
+ open: MetricsBucket[];
1460
+ openTrackingDelivered: MetricsBucket[];
1461
+ uniqueClick?: MetricsBucket[];
1462
+ uniqueClickTrackingDelivered?: MetricsBucket[];
1463
+ uniqueOpen?: MetricsBucket[];
1464
+ uniqueOpenTrackingDelivered?: MetricsBucket[];
1465
+ };
1466
+ /**
1467
+ * Count of click events by recipients.
1468
+ */
1469
+ click: number;
1470
+ /**
1471
+ * Count of recipients of delivered messages with HTML content that contains tracked click URLs, where click tracking is enabled in the send request.
1472
+ */
1473
+ clickTrackingDelivered: number;
1474
+ /**
1475
+ * The end of the time range for retrieving message engagement metrics (exclusive).
1476
+ */
1477
+ endTime: string;
1478
+ /**
1479
+ * Count of open events by recipients.
1480
+ */
1481
+ open: number;
1482
+ /**
1483
+ * Count of recipients of delivered messages with HTML content where open tracking was enabled in the send request.
1484
+ */
1485
+ openTrackingDelivered: number;
1486
+ /**
1487
+ * The beginning of the time range for retrieving message engagement metrics (inclusive).
1488
+ */
1489
+ startTime: string;
1490
+ /**
1491
+ * Count of distinct messages that had at least one click event.
1492
+ * Unlike `click`, each message is counted at most once regardless of how many links were clicked or how many times.
1493
+ * Use this to compute click rates without exceeding 100%.
1494
+ */
1495
+ uniqueClick?: number;
1496
+ /**
1497
+ * Count of distinct messages delivered with click tracking enabled (message-level, not recipient-level).
1498
+ * Use as the denominator when computing unique click rates.
1499
+ */
1500
+ uniqueClickTrackingDelivered?: number;
1501
+ /**
1502
+ * Count of distinct messages that had at least one open event.
1503
+ * Unlike `open`, each message is counted at most once regardless of how many times its tracking pixel was fired.
1504
+ * Use this to compute open rates without exceeding 100%.
1505
+ */
1506
+ uniqueOpen?: number;
1507
+ /**
1508
+ * Count of distinct messages delivered with open tracking enabled (message-level, not recipient-level).
1509
+ * Use as the denominator when computing unique open rates.
1510
+ */
1511
+ uniqueOpenTrackingDelivered?: number;
1512
+ }
1513
+ type MetricsEngagementResponse = DataResponse<MetricsEngagement>;
1514
+ interface MetricsPerformance {
1515
+ /**
1516
+ * Count of messages hard-bounced during the specified time range.
1517
+ */
1518
+ bounced: number;
1519
+ /**
1520
+ * Count of messages complained during the specified time range.
1521
+ */
1522
+ complained: number;
1523
+ /**
1524
+ * A series of metrics aggregations bucketed by time interval (e.g. hour, day).
1525
+ */
1526
+ buckets: {
1527
+ bounced: MetricsBucket[];
1528
+ complained: MetricsBucket[];
1529
+ delivered: MetricsBucket[];
1530
+ processed: MetricsBucket[];
1531
+ };
1532
+ /**
1533
+ * Count of messages delivered during the specified time range.
1534
+ */
1535
+ delivered: number;
1536
+ /**
1537
+ * The end of the time range for retrieving message performance metrics (exclusive).
1538
+ */
1539
+ endTime: string;
1540
+ /**
1541
+ * Count of messages processed during the specified time range.
1542
+ */
1543
+ processed: number;
1544
+ /**
1545
+ * The beginning of the time range for retrieving message performance metrics (inclusive).
1546
+ */
1547
+ startTime: string;
1548
+ }
1549
+ type MetricsPerformanceResponse = DataResponse<MetricsPerformance>;
1550
+ interface MetricsRecipientBehaviour {
1551
+ /**
1552
+ * A series of metrics aggregations bucketed by time interval (e.g. hour, day).
1553
+ */
1554
+ buckets: {
1555
+ unsubscribeDelivered: MetricsBucket[];
1556
+ unsubscribed: MetricsBucket[];
1557
+ };
1558
+ /**
1559
+ * The end of the time range for retrieving recipient behaviour metrics (exclusive).
1560
+ */
1561
+ endTime: string;
1562
+ /**
1563
+ * The beginning of the time range for retrieving recipient behaviour metrics (inclusive).
1564
+ */
1565
+ startTime: string;
1566
+ /**
1567
+ * Count of recipients of delivered messages that include at least one of the unsubscribe link or unsubscribe headers. Since the unsubscribe feature requires exactly one recipient per message, this count also represents the total number of delivered messages.
1568
+ */
1569
+ unsubscribeDelivered: number;
1570
+ /**
1571
+ * Count of unsubscribed events by recipients.
1572
+ */
1573
+ unsubscribed: number;
1574
+ }
1575
+ type MetricsRecipientBehaviourResponse = DataResponse<MetricsRecipientBehaviour>;
1576
+ interface MetricsVolume {
1577
+ /**
1578
+ * A series of metrics aggregations bucketed by time interval (e.g. hour, day).
1579
+ */
1580
+ buckets: {
1581
+ delivered: MetricsBucket[];
1582
+ dropped: MetricsBucket[];
1583
+ processed: MetricsBucket[];
1584
+ };
1585
+ /**
1586
+ * Count of messages delivered during the specified time range.
1587
+ */
1588
+ delivered: number;
1589
+ /**
1590
+ * Count of messages dropped during the specified time range.
1591
+ */
1592
+ dropped: number;
1593
+ /**
1594
+ * The end of the time range for retrieving message volume metrics (exclusive).
1595
+ */
1596
+ endTime: string;
1597
+ /**
1598
+ * Count of messages processed during the specified time range.
1599
+ */
1600
+ processed: number;
1601
+ /**
1602
+ * The beginning of the time range for retrieving message volume metrics (inclusive).
1603
+ */
1604
+ startTime: string;
1605
+ }
1606
+ type MetricsVolumeResponse = DataResponse<MetricsVolume>;
1607
+ type MetricsUsageResponse = DataResponse<{
1608
+ /**
1609
+ * The end date of the current billing period (ISO 8601 format).
1610
+ * @example "2025-04-11"
1611
+ */
1612
+ endDate?: string;
1613
+ /**
1614
+ * The start date of the current billing period (ISO 8601 format).
1615
+ * @example "2025-03-12"
1616
+ */
1617
+ startDate?: string;
1618
+ /**
1619
+ * The total usage for the current billing period.
1620
+ * @example 5000
1621
+ */
1622
+ total: number;
1623
+ /**
1624
+ * The effective monthly limit for the current billing period. A limit of zero means the account cannot send any messages.
1625
+ * For sub-accounts with no explicit limit set (i.e., -1), the monthly limit for the parent account is returned.
1626
+ * @example 10000
1627
+ */
1628
+ monthlyLimit: number;
1629
+ }>;
1630
+ type MetricsSendersType = "sub-accounts" | "campaigns";
1631
+ interface MetricsSendersOptions {
1632
+ /**
1633
+ * The beginning of the time range for retrieving top senders metrics (inclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object. Defaults to one month ago if not provided.
1634
+ * @example "2025-11-02T03:13:35.761763554Z"
1635
+ */
1636
+ startTime?: string | Date;
1637
+ /**
1638
+ * The end of the time range for retrieving top senders metrics (exclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object. Defaults to the current time if not provided.
1639
+ * @example "2025-12-02T03:13:35.761763554Z"
1640
+ */
1641
+ endTime?: string | Date;
1642
+ /**
1643
+ * The maximum number of senders to return. Possible values are 1 to 1000.
1644
+ * @default 10
1645
+ */
1646
+ limit?: number;
1647
+ /**
1648
+ * The number of senders to skip before returning results.
1649
+ * @default 0
1650
+ */
1651
+ offset?: number;
1652
+ /**
1653
+ * The order in which to sort the results, based on total messages (processed + dropped).
1654
+ * @default "desc"
1655
+ */
1656
+ sortOrder?: "asc" | "desc";
1657
+ }
1658
+ interface MetricsSenders {
1659
+ endTime: string;
1660
+ limit: number;
1661
+ offset: number;
1662
+ senders: {
1663
+ bounced: number;
1664
+ delivered: number;
1665
+ dropped: number;
1666
+ /**
1667
+ * Maximum character length: 255
1668
+ */
1669
+ name: string;
1670
+ processed: number;
1671
+ }[];
1672
+ startTime: string;
1673
+ /**
1674
+ * The total number of senders in this category that sent messages in the given time range.
1675
+ */
1676
+ total: number;
1677
+ }
1678
+ type MetricsSendersResponse = DataResponse<MetricsSenders>;
1679
+ interface MetricsBucket {
1680
+ /**
1681
+ * The number of events or occurrences aggregated within this time period.
1682
+ */
1683
+ count: number;
1684
+ /**
1685
+ * The starting date and time of the time period this bucket represents.
1686
+ */
1687
+ periodStart: string;
1688
+ }
1689
+ interface MetricsOptions {
1690
+ /**
1691
+ * The beginning of the time range for retrieving message metrics (inclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object. Defaults to one month ago if not provided.
1692
+ * @example "2025-05-26"
1693
+ */
1694
+ startTime?: string | Date;
1695
+ /**
1696
+ * The end of the time range for retrieving message metrics (exclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object. Defaults to the current time if not provided.
1697
+ * @example "2025-05-31T15:16:17Z"
1698
+ */
1699
+ endTime?: string | Date;
1700
+ /**
1701
+ * The ID of the campaign to filter metrics by. If not provided, metrics for all campaigns will be returned.
1702
+ */
1703
+ campaignId?: string;
1704
+ /**
1705
+ * The interval for aggregating metrics data.
1706
+ * @default "day"
1707
+ */
1708
+ interval?: "hour" | "day" | "week" | "month";
1709
+ }
1710
+ type SuppressionsTypes = "transactional" | "non-transactional";
1711
+ interface SuppressionsCreateEntry {
1712
+ /**
1713
+ * Must be less than `1024` characters.
1714
+ */
1715
+ notes?: string;
1716
+ /**
1717
+ * The email address to suppress. Must be a valid email address format and less than `255` characters.
1718
+ */
1719
+ recipient: string;
1720
+ /**
1721
+ * An array of types of suppression to apply to the recipient.
1722
+ * @default ["non-transactional"]
1723
+ */
1724
+ types?: SuppressionsTypes[];
1725
+ }
1726
+ interface SuppressionsCreateOptions {
1727
+ /**
1728
+ * If true, the parent account creates suppression entries for all associated sub-accounts. This field is only applicable to parent accounts. Sub-accounts cannot create entries for other sub-accounts.
1729
+ * @default false
1730
+ */
1731
+ addToSubAccounts?: boolean;
1732
+ /**
1733
+ * The total number of suppression entries to create, for the parent and/or its sub-accounts, must not exceed `1000`.
1734
+ * @deprecated Use `create(entries, options?)` instead.
1735
+ */
1736
+ entries: SuppressionsCreateEntry[];
1737
+ }
1738
+ type SuppressionsSource = "api" | "unsubscribe_link" | "list_unsubscribe" | "hard_bounce" | "spam_complaint" | "all";
1739
+ interface SuppressionsListOptions {
1740
+ /**
1741
+ * The email address of the suppression entry to search for. If provided, the search will return the suppression entry associated with this recipient. If not provided, the search will return all suppression entries for the account.
1742
+ */
1743
+ recipient?: string;
1744
+ /**
1745
+ * The source of the suppression entries to filter by. If not provided, suppression entries from all sources will be returned.
1746
+ */
1747
+ source?: Exclude<SuppressionsSource, "all">;
1748
+ /**
1749
+ * The date and/or time before which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object.
1750
+ */
1751
+ createdBefore?: string | Date;
1752
+ /**
1753
+ * The date and/or time after which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ` or a `Date` object.
1754
+ */
1755
+ createdAfter?: string | Date;
1756
+ /**
1757
+ * The maximum number of suppression entries to return. Must be between `1` and `1000`.
1758
+ * @default 1000
1759
+ */
1760
+ limit?: number;
1761
+ /**
1762
+ * The number of suppression entries to skip before returning results.
1763
+ * @default 0
1764
+ */
1765
+ offset?: number;
1766
+ }
1767
+ interface SuppressionsListEntry {
1768
+ createdAt: string;
1769
+ notes?: string;
1770
+ /**
1771
+ * The email address that is suppressed.
1772
+ */
1773
+ recipient: string;
1774
+ sender?: string;
1775
+ source: SuppressionsSource;
1776
+ types: SuppressionsTypes[];
1777
+ }
1778
+ type SuppressionsListResponse = DataResponse<SuppressionsListEntry[]>;
1779
+ declare class SubAccountsApiKeys {
1780
+ private mailchannels;
1781
+ constructor(mailchannels: MailChannelsClient);
1782
+ /**
1783
+ * Creates a new API key for the specified sub-account.
1784
+ * @param handle - Handle of the sub-account to create API key for.
1785
+ * @example
1786
+ * ```ts
1787
+ * const mailchannels = new MailChannels('your-api-key')
1788
+ * const { data, error } = await mailchannels.subAccounts.apiKeys.create('validhandle123')
1789
+ * ```
1790
+ */
1791
+ create(handle: string): Promise<SubAccountsApiKeysCreateResponse>;
1792
+ /**
1793
+ * Retrieves details of all API keys associated with the specified sub-account. For security reasons, the full API key is not returned; only the key ID and a partially redacted version are provided.
1794
+ * @param handle - Handle of the sub-account to retrieve the API key for.
1795
+ * @param options - The options to filter the list of API keys.
1796
+ * @example
1797
+ * ```ts
1798
+ * const mailchannels = new MailChannels('your-api-key')
1799
+ * const { data, error } = await mailchannels.subAccounts.apiKeys.list('validhandle123')
1800
+ * ```
1801
+ */
1802
+ list(handle: string, options?: SubAccountsApiKeysListOptions): Promise<SubAccountsApiKeysListResponse>;
1803
+ /**
1804
+ * Deletes the API key identified by its ID for the specified sub-account.
1805
+ * @param handle - Handle of the sub-account for which the API key should be deleted.
1806
+ * @param id - The ID of the API key to delete.
1807
+ * @example
1808
+ * ```ts
1809
+ * const mailchannels = new MailChannels('your-api-key')
1810
+ * const { success, error } = await mailchannels.subAccounts.apiKeys.delete('validhandle123', 1)
1811
+ * ```
1812
+ */
1813
+ delete(handle: string, id: number): Promise<SuccessResponse>;
1814
+ }
1815
+ declare class SubAccountsSmtpPasswords {
1816
+ private mailchannels;
1817
+ constructor(mailchannels: MailChannelsClient);
1818
+ /**
1819
+ * Creates a new SMTP password for the specified sub-account.
1820
+ * @param handle - Handle of the sub-account to create SMTP password for.
1821
+ * @example
1822
+ * ```ts
1823
+ * const mailchannels = new MailChannels('your-api-key')
1824
+ * const { data, error } = await mailchannels.subAccounts.smtpPasswords.create('validhandle123')
1825
+ * ```
1826
+ */
1827
+ create(handle: string): Promise<SubAccountsSmtpPasswordsCreateResponse>;
1828
+ /**
1829
+ * Retrieves details of all SMTP passwords associated with the specified sub-account. For security, the full SMTP password is not returned; only the password ID and a partially redacted version are provided.
1830
+ * @param handle - Handle of the sub-account to retrieve the SMTP password for.
1831
+ * @example
1832
+ * ```ts
1833
+ * const mailchannels = new MailChannels('your-api-key')
1834
+ * const { data, error } = await mailchannels.subAccounts.smtpPasswords.list('validhandle123')
1835
+ * ```
1836
+ */
1837
+ list(handle: string): Promise<SubAccountsSmtpPasswordsListResponse>;
1838
+ /**
1839
+ * Deletes the SMTP password identified by its ID for the specified sub-account.
1840
+ * @param handle - Handle of the sub-account for which the SMTP password should be deleted.
1841
+ * @param id - The ID of the SMTP password to delete.
1842
+ * @example
1843
+ * ```ts
1844
+ * const mailchannels = new MailChannels('your-api-key')
1845
+ * const { success, error } = await mailchannels.subAccounts.smtpPasswords.delete('validhandle123', 1)
1846
+ * ```
1847
+ */
1848
+ delete(handle: string, id: number): Promise<SuccessResponse>;
1849
+ }
1850
+ declare class SubAccountsLimits {
1851
+ private mailchannels;
1852
+ constructor(mailchannels: MailChannelsClient);
1853
+ /**
1854
+ * Retrieves the limit of a specified sub-account. A value of `-1` indicates that the sub-account inherits the parent account's limit, allowing the sub-account to utilize any remaining capacity within the parent account's allocation.
1855
+ * @param handle - Handle of the sub-account to retrieve the limit for.
1856
+ * @example
1857
+ * ```ts
1858
+ * const mailchannels = new MailChannels('your-api-key')
1859
+ * const { data, error } = await mailchannels.subAccounts.limits.get('validhandle123')
1860
+ * ```
1861
+ */
1862
+ get(handle: string): Promise<SubAccountsLimitsGetResponse>;
1863
+ /**
1864
+ * Sets the limit for the specified sub-account.
1865
+ * @param handle - Handle of the sub-account to set limit for.
1866
+ * @param options - The limits to set for the sub-account. The minimum allowed sends is `0`
1867
+ * @example
1868
+ * ```ts
1869
+ * const mailchannels = new MailChannels('your-api-key')
1870
+ * const { success, error } = await mailchannels.subAccounts.limits.set('validhandle123', { sends: 1000 })
1871
+ * ```
1872
+ */
1873
+ set(handle: string, options: SubAccountsLimitsSetOptions): Promise<SuccessResponse>;
1874
+ /**
1875
+ * Deletes the limit for the specified sub-account. After a successful deletion, the specified sub-account will be limited to the parent account's limit.
1876
+ * @param handle - Handle of the sub-account to delete limit for.
1877
+ * @example
1878
+ * ```ts
1879
+ * const mailchannels = new MailChannels('your-api-key')
1880
+ * const { success, error } = await mailchannels.subAccounts.limits.delete('validhandle123')
1881
+ * ```
1882
+ */
1883
+ delete(handle: string): Promise<SuccessResponse>;
1884
+ }
1885
+ declare class SubAccounts {
1886
+ protected mailchannels: MailChannelsClient;
1887
+ private static readonly COMPANY_PATTERN;
1888
+ private static readonly HANDLE_PATTERN;
1889
+ readonly apiKeys: SubAccountsApiKeys;
1890
+ readonly smtpPasswords: SubAccountsSmtpPasswords;
1891
+ readonly limits: SubAccountsLimits;
1892
+ constructor(mailchannels: MailChannelsClient);
1893
+ /**
1894
+ * Creates a new sub-account under the parent account. Each sub-account must have a unique handle composed solely of lowercase alphanumeric characters. If no handle is provided, a random handle will be generated.
1895
+ * @param companyName - The name of the company associated with the sub-account. This name is used for display purposes only and does not affect the functionality of the sub-account. The length must be between 3 and 128 characters.
1896
+ * @param handle - A unique name for the sub-account to be created. The length must be between 3 and 128 characters, and it may contain only lowercase letters and numbers. If not provided, a random handle will be generated.
1897
+ * @example
1898
+ * ```ts
1899
+ * const mailchannels = new MailChannels('your-api-key')
1900
+ * const { data, error } = await mailchannels.subAccounts.create('My Company', 'validhandle123')
1901
+ * ```
1902
+ */
1903
+ create(companyName: string, handle?: string): Promise<SubAccountsCreateResponse>;
1904
+ /**
1905
+ * Retrieves all sub-accounts associated with the parent account. The response is paginated with a default limit of 1000 sub-accounts per page and an offset of 0.
1906
+ * @param options - The options to filter the list of sub-accounts.
1907
+ * @example
1908
+ * ```ts
1909
+ * const mailchannels = new MailChannels('your-api-key')
1910
+ * const { data, error } = await mailchannels.subAccounts.list()
1911
+ * ```
1912
+ */
1913
+ list(options?: SubAccountsListOptions): Promise<SubAccountsListResponse>;
1914
+ /**
1915
+ * Deletes the sub-account identified by its handle.
1916
+ * @param handle - Handle of sub-account to be deleted.
1917
+ * @example
1918
+ * ```ts
1919
+ * const mailchannels = new MailChannels('your-api-key')
1920
+ * const { success, error } = await mailchannels.subAccounts.delete('validhandle123')
1921
+ * ```
1922
+ */
1923
+ delete(handle: string): Promise<SuccessResponse>;
1924
+ /**
1925
+ * Suspends the sub-account identified by its handle. This action disables the account, preventing it from sending any emails until it is reactivated.
1926
+ * @param handle - Handle of sub-account to be suspended.
1927
+ * @example
1928
+ * ```ts
1929
+ * const mailchannels = new MailChannels('your-api-key')
1930
+ * const { success, error } = await mailchannels.subAccounts.suspend('validhandle123')
1931
+ * ```
1932
+ */
1933
+ suspend(handle: string): Promise<SuccessResponse>;
1934
+ /**
1935
+ * Activates a suspended sub-account identified by its handle, restoring its ability to send emails.
1936
+ * @param handle - Handle of sub-account to be activated.
1937
+ * @example
1938
+ * ```ts
1939
+ * const mailchannels = new MailChannels('your-api-key')
1940
+ * const { success, error } = await mailchannels.subAccounts.activate('validhandle123')
1941
+ * ```
1942
+ */
1943
+ activate(handle: string): Promise<SuccessResponse>;
1944
+ /**
1945
+ * Retrieves usage statistics for the specified sub-account during the current billing period.
1946
+ * @param handle - Handle of the sub-account to query usage stats for.
1947
+ * @example
1948
+ * ```ts
1949
+ * const mailchannels = new MailChannels('your-api-key')
1950
+ * const { data, error } = await mailchannels.subAccounts.getUsage('validhandle123')
1951
+ * ```
1952
+ */
1953
+ getUsage(handle: string): Promise<SubAccountsUsageResponse>;
1954
+ /** @deprecated Use `apiKeys.create` instead. */
1955
+ createApiKey(...args: Parameters<SubAccountsApiKeys["create"]>): Promise<SubAccountsApiKeysCreateResponse>;
1956
+ /** @deprecated Use `apiKeys.list` instead. */
1957
+ listApiKeys(...args: Parameters<SubAccountsApiKeys["list"]>): Promise<SubAccountsApiKeysListResponse>;
1958
+ /** @deprecated Use `apiKeys.delete` instead. */
1959
+ deleteApiKey(...args: Parameters<SubAccountsApiKeys["delete"]>): Promise<SuccessResponse>;
1960
+ /** @deprecated Use `smtpPasswords.create` instead. */
1961
+ createSmtpPassword(...args: Parameters<SubAccountsSmtpPasswords["create"]>): Promise<SubAccountsSmtpPasswordsCreateResponse>;
1962
+ /** @deprecated Use `smtpPasswords.list` instead. */
1963
+ listSmtpPasswords(...args: Parameters<SubAccountsSmtpPasswords["list"]>): Promise<SubAccountsSmtpPasswordsListResponse>;
1964
+ /** @deprecated Use `smtpPasswords.delete` instead. */
1965
+ deleteSmtpPassword(...args: Parameters<SubAccountsSmtpPasswords["delete"]>): Promise<SuccessResponse>;
1966
+ /** @deprecated Use `limits.set` instead. */
1967
+ setLimit(...args: Parameters<SubAccountsLimits["set"]>): Promise<SuccessResponse>;
1968
+ /** @deprecated Use `limits.get` instead. */
1969
+ getLimit(...args: Parameters<SubAccountsLimits["get"]>): Promise<SubAccountsLimitsGetResponse>;
1970
+ /** @deprecated Use `limits.delete` instead. */
1971
+ deleteLimit(...args: Parameters<SubAccountsLimits["delete"]>): Promise<SuccessResponse>;
1972
+ }
1973
+ declare class Metrics {
1974
+ protected mailchannels: MailChannelsClient;
1975
+ constructor(mailchannels: MailChannelsClient);
1976
+ /**
1977
+ * Retrieve engagement metrics for messages sent from your account, including counts of open and click events. Supports optional filters for time range, and campaign ID.
1978
+ * @param options - Options to filter and customize the engagement metrics retrieval.
1979
+ * @example
1980
+ * ```ts
1981
+ * const mailchannels = new MailChannels('your-api-key')
1982
+ * const { data, error } = await mailchannels.metrics.engagement()
1983
+ * ```
1984
+ */
1985
+ engagement(options?: MetricsOptions): Promise<MetricsEngagementResponse>;
1986
+ /**
1987
+ * Retrieve performance metrics for messages sent from your account, including counts of processed, delivered, hard-bounced, and complained events. Supports optional filters for time range, and campaign ID.
1988
+ * @param options - Options to filter and customize the performance metrics retrieval.
1989
+ * @example
1990
+ * ```ts
1991
+ * const mailchannels = new MailChannels('your-api-key')
1992
+ * const { data, error } = await mailchannels.metrics.performance()
1993
+ * ```
1994
+ */
1995
+ performance(options?: MetricsOptions): Promise<MetricsPerformanceResponse>;
1996
+ /**
1997
+ * Retrieve recipient behaviour metrics for messages sent from your account, including counts of unsubscribed events. Supports optional filters for time range, and campaign ID.
1998
+ * @param options - Options to filter and customize the recipient behaviour metrics retrieval.
1999
+ * @example
2000
+ * ```ts
2001
+ * const mailchannels = new MailChannels('your-api-key')
2002
+ * const { data, error } = await mailchannels.metrics.recipientBehaviour()
2003
+ * ```
2004
+ */
2005
+ recipientBehaviour(options?: MetricsOptions): Promise<MetricsRecipientBehaviourResponse>;
2006
+ /**
2007
+ * Retrieve volume metrics for messages sent from your account, including counts of processed, delivered and dropped events. Supports optional filters for time range and campaign ID.
2008
+ * @param options - Options to filter and customize the volume metrics retrieval.
2009
+ * @example
2010
+ * ```ts
2011
+ * const mailchannels = new MailChannels('your-api-key')
2012
+ * const { data, error } = await mailchannels.metrics.volume()
2013
+ * ```
2014
+ */
2015
+ volume(options?: MetricsOptions): Promise<MetricsVolumeResponse>;
2016
+ /**
2017
+ * Retrieves usage statistics during the current billing period.
2018
+ * @example
2019
+ * ```ts
2020
+ * const mailchannels = new MailChannels('your-api-key')
2021
+ * const { data, error } = await mailchannels.metrics.usage()
2022
+ * ```
2023
+ */
2024
+ usage(): Promise<MetricsUsageResponse>;
2025
+ /**
2026
+ * Retrieves a list of senders, either sub-accounts or campaigns, with their associated message metrics. Sorted by total # of sent messages (processed + dropped). Supports optional filter for time range, and optional settings for limit, offset, and sort order. Note: senders without any messages in the given time range will not be included in the results. The default time range is from one month ago to now, and the default sort order is descending.
2027
+ * @param type - The type of senders to retrieve metrics for. Can be either `sub-accounts` or `campaigns`.
2028
+ * @param options - Optional filter options for time range, limit, offset, and sort order.
2029
+ * @example
2030
+ * ```ts
2031
+ * const mailchannels = new MailChannels('your-api-key')
2032
+ * const { data, error } = await mailchannels.metrics.senders('campaigns')
2033
+ * ```
2034
+ */
2035
+ senders(type: MetricsSendersType, options?: MetricsSendersOptions): Promise<MetricsSendersResponse>;
2036
+ }
2037
+ declare class Suppressions {
2038
+ protected mailchannels: MailChannelsClient;
2039
+ constructor(mailchannels: MailChannelsClient);
2040
+ /**
2041
+ * Creates suppression entries for the specified account. Parent accounts can create suppression entries for all associated sub-accounts. If `types` is not provided, it defaults to `non-transactional`. The operation is atomic, meaning all entries are successfully added or none are added if an error occurs.
2042
+ * @param entries - The total number of suppression entries to create, for the parent and/or its sub-accounts, must not exceed `1000`.
2043
+ * @param options - The options of the suppression entries to create.
2044
+ * @example
2045
+ * ```ts
2046
+ * const mailchannels = new MailChannels('your-api-key')
2047
+ * const { success, error } = await mailchannels.suppressions.create([
2048
+ * {
2049
+ * notes: "test",
2050
+ * recipient: "name@example.com",
2051
+ * types: ["transactional"]
2052
+ * }
2053
+ * ], { addToSubAccounts: false });
2054
+ */
2055
+ create(entries: SuppressionsCreateEntry[], options?: Omit<SuppressionsCreateOptions, "entries">): Promise<SuccessResponse>;
2056
+ /** @deprecated Use positional params `create(entries, options?)` instead. */
2057
+ create(options: SuppressionsCreateOptions): Promise<SuccessResponse>;
2058
+ /**
2059
+ * Deletes suppression entry associated with the account based on the specified recipient and source.
2060
+ * @param recipient - The email address of the suppression entry to delete.
2061
+ * @param source - The source of the suppression entry to be deleted. If source is not provided, it defaults to `api`. If source is set to `all`, all suppression entries related to the specified recipient will be deleted.
2062
+ * @example
2063
+ * ```ts
2064
+ * const mailchannels = new MailChannels('your-api-key')
2065
+ * const { success, error } = await mailchannels.suppressions.delete('name@example.com', 'api');
2066
+ * ```
2067
+ */
2068
+ delete(recipient: string, source?: SuppressionsSource): Promise<SuccessResponse>;
2069
+ /**
2070
+ * Retrieve suppression entries associated with the specified account. Supports filtering by recipient, source and creation date range. The response is paginated, with a default limit of `1000` entries per page and an offset of `0`.
2071
+ * @param options - Options to filter and customize the suppression entries retrieval.
2072
+ * @example
2073
+ * ```ts
2074
+ * const mailchannels = new MailChannels('your-api-key')
2075
+ * const { data, error } = await mailchannels.suppressions.list();
2076
+ * ```
2077
+ */
2078
+ list(options?: SuppressionsListOptions): Promise<SuppressionsListResponse>;
2079
+ }
2080
+ type AttachmentOptions = Omit<EmailsSendAttachment, "content">;
2081
+ declare class Attachment {
2082
+ static fromBytes(data: ArrayBuffer | Uint8Array, options: AttachmentOptions): EmailsSendAttachment;
2083
+ static fromBlob(blob: Blob, options: AttachmentOptions): Promise<EmailsSendAttachment>;
2084
+ }
2085
+ declare class MailChannels extends MailChannelsClient {
2086
+ readonly emails: Emails;
2087
+ readonly domains: Domains;
2088
+ readonly webhooks: Webhooks;
2089
+ readonly subAccounts: SubAccounts;
2090
+ readonly metrics: Metrics;
2091
+ readonly suppressions: Suppressions;
2092
+ constructor(key: string, options?: MailChannelsClientOptions);
2093
+ }
2094
+ export { Attachment, DataResponse, Domains, DomainsCheckOptions, DomainsCheckResponse, DomainsCheckVerdict, DomainsCustomTrackingCreateResponse, DomainsCustomTrackingDnsSetupRequired, DomainsCustomTrackingDomain, DomainsCustomTrackingListOptions, DomainsCustomTrackingListResponse, DomainsCustomTrackingScope, DomainsCustomTrackingUpdateOptions, DomainsCustomTrackingUpdateResponse, DomainsCustomTrackingWithDnsSetupRequired, DomainsDkimCreateOptions, DomainsDkimCreateResponse, DomainsDkimKey, DomainsDkimKeyStatus, DomainsDkimListOptions, DomainsDkimListResponse, DomainsDkimRotateOptions, DomainsDkimRotateResponse, DomainsDkimUpdateStatusOptions, Emails, EmailsQueueResponse, EmailsSendAsyncResponse, EmailsSendAttachment, EmailsSendContent, EmailsSendDkim, EmailsSendOptions, EmailsSendPersonalization, EmailsSendRecipient, EmailsSendRecipientInput, EmailsSendResponse, EmailsSendTemplate, EmailsSendTemplateType, EmailsSendTemplateValue, EmailsSendTracking, ErrorResponse, ErrorType, MailChannels, MailChannelsClient, MailChannelsClientOptions, Metrics, MetricsBucket, MetricsEngagement, MetricsEngagementResponse, MetricsOptions, MetricsPerformance, MetricsPerformanceResponse, MetricsRecipientBehaviour, MetricsRecipientBehaviourResponse, MetricsSenders, MetricsSendersOptions, MetricsSendersResponse, MetricsSendersType, MetricsUsageResponse, MetricsVolume, MetricsVolumeResponse, SubAccount, SubAccounts, SubAccountsAccount, SubAccountsApiKey, SubAccountsApiKeysCreateResponse, SubAccountsApiKeysListOptions, SubAccountsApiKeysListResponse, SubAccountsCreateApiKeyResponse, SubAccountsCreateResponse, SubAccountsCreateSmtpPasswordResponse, SubAccountsLimit, SubAccountsLimitResponse, SubAccountsLimitsGetResponse, SubAccountsLimitsSetOptions, SubAccountsListApiKeyOptions, SubAccountsListApiKeyResponse, SubAccountsListOptions, SubAccountsListResponse, SubAccountsListSmtpPasswordResponse, SubAccountsSmtpPassword, SubAccountsSmtpPasswordsCreateResponse, SubAccountsSmtpPasswordsListResponse, SubAccountsUsage, SubAccountsUsageResponse, SuccessResponse, Suppressions, SuppressionsCreateEntry, SuppressionsCreateOptions, SuppressionsListEntry, SuppressionsListOptions, SuppressionsListResponse, SuppressionsSource, SuppressionsTypes, WebhookEvent, WebhookEventClick, WebhookEventComplained, WebhookEventDelivered, WebhookEventDropped, WebhookEventHardBounced, WebhookEventOpen, WebhookEventProcessed, WebhookEventSoftBounced, WebhookEventTest, WebhookEventType, WebhookEventUnsubscribed, Webhooks, WebhooksBatch, WebhooksBatchResponseStatus, WebhooksBatchStatus, WebhooksBatchesOptions, WebhooksBatchesResponse, WebhooksListResponse, WebhooksResendBatch, WebhooksResendBatchResponse, WebhooksSigningKeyResponse, WebhooksValidateResponse, WebhooksVerifyOptions, WebhooksVerifyResponse };