mailchannels-sdk 0.3.7 → 0.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.
- package/README.md +55 -39
- package/dist/mailchannels.d.mts +6 -4
- package/dist/mailchannels.d.ts +6 -4
- package/dist/mailchannels.mjs +7 -3
- package/dist/modules.d.mts +1 -1
- package/dist/modules.d.ts +1 -1
- package/dist/modules.mjs +592 -95
- package/dist/shared/{mailchannels-sdk.BDB65ygx.d.mts → mailchannels-sdk.DUD1k4jz.d.mts} +587 -113
- package/dist/shared/{mailchannels-sdk.BDB65ygx.d.ts → mailchannels-sdk.DUD1k4jz.d.ts} +587 -113
- package/package.json +16 -17
|
@@ -55,6 +55,10 @@ interface EmailsSendOptionsBase {
|
|
|
55
55
|
* An array of attachments to be sent with the email.
|
|
56
56
|
*/
|
|
57
57
|
attachments?: EmailsSendAttachment[];
|
|
58
|
+
/**
|
|
59
|
+
* 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.
|
|
60
|
+
*/
|
|
61
|
+
campaignId?: string;
|
|
58
62
|
/**
|
|
59
63
|
* 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.
|
|
60
64
|
* @example
|
|
@@ -162,6 +166,13 @@ interface EmailsSendOptionsBase {
|
|
|
162
166
|
* - map, whose keys must be strings, and whose values are all of permitted types
|
|
163
167
|
*/
|
|
164
168
|
mustaches?: Record<string, unknown>;
|
|
169
|
+
/**
|
|
170
|
+
* 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:
|
|
171
|
+
*
|
|
172
|
+
* List-Unsubscribe headers will be added.
|
|
173
|
+
* @default true
|
|
174
|
+
*/
|
|
175
|
+
transactional?: boolean;
|
|
165
176
|
}
|
|
166
177
|
|
|
167
178
|
type EmailsSendOptions = EmailsSendOptionsBase & (
|
|
@@ -332,12 +343,46 @@ interface WebhooksSigningKeyResponse {
|
|
|
332
343
|
error: string | null;
|
|
333
344
|
}
|
|
334
345
|
|
|
346
|
+
interface WebhooksValidateResponse {
|
|
347
|
+
/**
|
|
348
|
+
* Indicates whether all webhook validations passed
|
|
349
|
+
*/
|
|
350
|
+
allPassed: boolean;
|
|
351
|
+
/**
|
|
352
|
+
* Detailed results for each tested webhook, including whether it returned a 2xx status code, along with its response status code and body.
|
|
353
|
+
*/
|
|
354
|
+
results: {
|
|
355
|
+
/**
|
|
356
|
+
* Indicates whether the webhook responded with a 2xx HTTP status code
|
|
357
|
+
*/
|
|
358
|
+
result: "passed" | "failed";
|
|
359
|
+
/**
|
|
360
|
+
* The webhook that was validated
|
|
361
|
+
*/
|
|
362
|
+
webhook: string;
|
|
363
|
+
/**
|
|
364
|
+
* 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.
|
|
365
|
+
*/
|
|
366
|
+
response: {
|
|
367
|
+
/**
|
|
368
|
+
* Response body from webhook. Returns an error if unprocessable or too large.
|
|
369
|
+
*/
|
|
370
|
+
body?: string;
|
|
371
|
+
/**
|
|
372
|
+
* HTTP status code returned by the webhook
|
|
373
|
+
*/
|
|
374
|
+
status: number;
|
|
375
|
+
} | null;
|
|
376
|
+
}[];
|
|
377
|
+
error: string | null;
|
|
378
|
+
}
|
|
379
|
+
|
|
335
380
|
declare class Webhooks {
|
|
336
381
|
protected mailchannels: MailChannelsClient;
|
|
337
382
|
constructor(mailchannels: MailChannelsClient);
|
|
338
383
|
/**
|
|
339
384
|
* Enrolls the customer to receive event notifications via webhooks.
|
|
340
|
-
* @param endpoint - The URL to receive event notifications.
|
|
385
|
+
* @param endpoint - The URL to receive event notifications. Must be no longer than `8000` characters.
|
|
341
386
|
* @example
|
|
342
387
|
* ```ts
|
|
343
388
|
* const mailchannels = new MailChannels('your-api-key')
|
|
@@ -373,9 +418,23 @@ declare class Webhooks {
|
|
|
373
418
|
* ```
|
|
374
419
|
*/
|
|
375
420
|
getSigningKey(id: string): Promise<WebhooksSigningKeyResponse>;
|
|
421
|
+
/**
|
|
422
|
+
* 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.
|
|
423
|
+
* @param requestId - Optional identifier in the webhook payload. If not provided, a value will be automatically generated. Must not exceed 28 characters.
|
|
424
|
+
* @example
|
|
425
|
+
* ```ts
|
|
426
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
427
|
+
* const { allPassed, results } = await mailchannels.webhooks.validate('optional-request-id')
|
|
428
|
+
* ```
|
|
429
|
+
*/
|
|
430
|
+
validate(requestId?: string): Promise<WebhooksValidateResponse>;
|
|
376
431
|
}
|
|
377
432
|
|
|
378
433
|
interface SubAccountsAccount {
|
|
434
|
+
/**
|
|
435
|
+
* The name of the company associated with the sub-account.
|
|
436
|
+
*/
|
|
437
|
+
companyName: string;
|
|
379
438
|
/**
|
|
380
439
|
* If the sub-account is enabled.
|
|
381
440
|
*/
|
|
@@ -455,20 +514,53 @@ interface SubAccountsListSmtpPasswordResponse {
|
|
|
455
514
|
error: string | null;
|
|
456
515
|
}
|
|
457
516
|
|
|
517
|
+
interface SubAccountsLimit {
|
|
518
|
+
sends: number;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
interface SubAccountsLimitResponse {
|
|
522
|
+
limit: SubAccountsLimit | null;
|
|
523
|
+
error: string | null;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
interface SubAccountsUsage {
|
|
527
|
+
/**
|
|
528
|
+
* The end date of the current billing period (ISO 8601 format).
|
|
529
|
+
* @example "2025-04-11"
|
|
530
|
+
*/
|
|
531
|
+
endDate?: string;
|
|
532
|
+
/**
|
|
533
|
+
* The start date of the current billing period (ISO 8601 format).
|
|
534
|
+
* @example "2025-03-12"
|
|
535
|
+
*/
|
|
536
|
+
startDate?: string;
|
|
537
|
+
/**
|
|
538
|
+
* The total usage for the current billing period.
|
|
539
|
+
*/
|
|
540
|
+
total: number;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
interface SubAccountsUsageResponse {
|
|
544
|
+
usage: SubAccountsUsage | null;
|
|
545
|
+
error: string | null;
|
|
546
|
+
}
|
|
547
|
+
|
|
458
548
|
declare class SubAccounts {
|
|
459
549
|
protected mailchannels: MailChannelsClient;
|
|
550
|
+
private static readonly COMPANY_PATTERN;
|
|
460
551
|
private static readonly HANDLE_PATTERN;
|
|
461
552
|
constructor(mailchannels: MailChannelsClient);
|
|
462
553
|
/**
|
|
463
|
-
* 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.
|
|
464
|
-
* @param
|
|
554
|
+
* 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. Note that Sub-accounts are only available to parent accounts on 100K and higher plans.
|
|
555
|
+
* @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.
|
|
556
|
+
* @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.
|
|
465
557
|
* @example
|
|
466
558
|
* ```ts
|
|
467
559
|
* const mailchannels = new MailChannels('your-api-key')
|
|
468
|
-
* const { account } = await mailchannels.subAccounts.create('validhandle123')
|
|
560
|
+
* const { account } = await mailchannels.subAccounts.create('My Company', 'validhandle123')
|
|
469
561
|
* ```
|
|
470
562
|
*/
|
|
471
|
-
create(handle?: string): Promise<SubAccountsCreateResponse>;
|
|
563
|
+
create(companyName: string, handle?: string): Promise<SubAccountsCreateResponse>;
|
|
472
564
|
/**
|
|
473
565
|
* 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.
|
|
474
566
|
* @param options - The options to filter the list of sub-accounts.
|
|
@@ -570,104 +662,343 @@ declare class SubAccounts {
|
|
|
570
662
|
* ```
|
|
571
663
|
*/
|
|
572
664
|
deleteSmtpPassword(handle: string, id: number): Promise<SuccessResponse>;
|
|
665
|
+
/**
|
|
666
|
+
* 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.
|
|
667
|
+
* @param handle - Handle of the sub-account to retrieve the limit for.
|
|
668
|
+
* @example
|
|
669
|
+
* ```ts
|
|
670
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
671
|
+
* const { limit } = await mailchannels.subAccounts.getLimit('validhandle123')
|
|
672
|
+
* ```
|
|
673
|
+
*/
|
|
674
|
+
getLimit(handle: string): Promise<SubAccountsLimitResponse>;
|
|
675
|
+
/**
|
|
676
|
+
* Sets the limit for the specified sub-account.
|
|
677
|
+
* @param handle - Handle of the sub-account to set limit for.
|
|
678
|
+
* @param limit - The limits to set for the sub-account. The minimum allowed sends is `0`
|
|
679
|
+
* @example
|
|
680
|
+
* ```ts
|
|
681
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
682
|
+
* const { success } = await mailchannels.subAccounts.setLimit('validhandle123', { sends: 1000 })
|
|
683
|
+
* ```
|
|
684
|
+
*/
|
|
685
|
+
setLimit(handle: string, limit: SubAccountsLimit): Promise<SuccessResponse>;
|
|
686
|
+
/**
|
|
687
|
+
* 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.
|
|
688
|
+
* @param handle - Handle of the sub-account to delete limit for.
|
|
689
|
+
* @example
|
|
690
|
+
* ```ts
|
|
691
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
692
|
+
* const { success } = await mailchannels.subAccounts.deleteLimit('validhandle123')
|
|
693
|
+
* ```
|
|
694
|
+
*/
|
|
695
|
+
deleteLimit(handle: string): Promise<SuccessResponse>;
|
|
696
|
+
/**
|
|
697
|
+
* Retrieves usage statistics for the specified sub-account during the current billing period.
|
|
698
|
+
* @param handle - Handle of the sub-account to query usage stats for.
|
|
699
|
+
* @example
|
|
700
|
+
* ```ts
|
|
701
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
702
|
+
* const { usage } = await mailchannels.subAccounts.getUsage('validhandle123')
|
|
703
|
+
* ```
|
|
704
|
+
*/
|
|
705
|
+
getUsage(handle: string): Promise<SubAccountsUsageResponse>;
|
|
573
706
|
}
|
|
574
707
|
|
|
575
|
-
interface
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
708
|
+
interface MetricsEngagement {
|
|
709
|
+
buckets: {
|
|
710
|
+
click: MetricsBucket[];
|
|
711
|
+
clickTrackingDelivered: MetricsBucket[];
|
|
712
|
+
open: MetricsBucket[];
|
|
713
|
+
openTrackingDelivered: MetricsBucket[];
|
|
714
|
+
};
|
|
715
|
+
click: number;
|
|
716
|
+
clickTrackingDelivered: number;
|
|
717
|
+
endTime: string;
|
|
718
|
+
open: number;
|
|
719
|
+
openTrackingDelivered: number;
|
|
720
|
+
startTime: string;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
interface MetricsEngagementResponse {
|
|
724
|
+
engagement: MetricsEngagement | null;
|
|
589
725
|
error: string | null;
|
|
590
726
|
}
|
|
591
727
|
|
|
592
|
-
interface
|
|
728
|
+
interface MetricsPerformance {
|
|
593
729
|
/**
|
|
594
|
-
*
|
|
730
|
+
* Count of messages bounced during the specified time range.
|
|
595
731
|
*/
|
|
596
|
-
|
|
732
|
+
bounced: number;
|
|
733
|
+
buckets: {
|
|
734
|
+
bounced: MetricsBucket[];
|
|
735
|
+
delivered: MetricsBucket[];
|
|
736
|
+
processed: MetricsBucket[];
|
|
737
|
+
};
|
|
597
738
|
/**
|
|
598
|
-
*
|
|
739
|
+
* Count of messages delivered during the specified time range.
|
|
599
740
|
*/
|
|
600
|
-
|
|
741
|
+
delivered: number;
|
|
601
742
|
/**
|
|
602
|
-
* The
|
|
743
|
+
* The end of the time range for retrieving message performance metrics (exclusive).
|
|
603
744
|
*/
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
745
|
+
endTime: string;
|
|
746
|
+
/**
|
|
747
|
+
* Count of messages processed during the specified time range.
|
|
748
|
+
*/
|
|
749
|
+
processed: number;
|
|
750
|
+
/**
|
|
751
|
+
* The beginning of the time range for retrieving message performance metrics (inclusive).
|
|
752
|
+
*/
|
|
753
|
+
startTime: string;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
interface MetricsPerformanceResponse {
|
|
757
|
+
performance: MetricsPerformance | null;
|
|
758
|
+
error: string | null;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
interface MetricsRecipientBehaviour {
|
|
762
|
+
buckets: {
|
|
763
|
+
unsubscribeDelivered: MetricsBucket[];
|
|
764
|
+
unsubscribed: MetricsBucket[];
|
|
608
765
|
};
|
|
609
766
|
/**
|
|
610
|
-
* The
|
|
767
|
+
* The end of the time range for retrieving recipient behaviour metrics (exclusive).
|
|
611
768
|
*/
|
|
612
|
-
|
|
613
|
-
|
|
769
|
+
endTime: string;
|
|
770
|
+
/**
|
|
771
|
+
* The beginning of the time range for retrieving recipient behaviour metrics (inclusive).
|
|
772
|
+
*/
|
|
773
|
+
startTime: string;
|
|
774
|
+
/**
|
|
775
|
+
* 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.
|
|
776
|
+
*/
|
|
777
|
+
unsubscribeDelivered: number;
|
|
778
|
+
/**
|
|
779
|
+
* Count of unsubscribed events by recipients.
|
|
780
|
+
*/
|
|
781
|
+
unsubscribed: number;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
interface MetricsRecipientBehaviourResponse {
|
|
785
|
+
behaviour: MetricsRecipientBehaviour | null;
|
|
786
|
+
error: string | null;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
interface MetricsVolume {
|
|
790
|
+
buckets: {
|
|
791
|
+
delivered: MetricsBucket[];
|
|
792
|
+
dropped: MetricsBucket[];
|
|
793
|
+
processed: MetricsBucket[];
|
|
614
794
|
};
|
|
795
|
+
/**
|
|
796
|
+
* Count of messages delivered during the specified time range.
|
|
797
|
+
*/
|
|
798
|
+
delivered: number;
|
|
799
|
+
/**
|
|
800
|
+
* Count of messages dropped during the specified time range.
|
|
801
|
+
*/
|
|
802
|
+
dropped: number;
|
|
803
|
+
/**
|
|
804
|
+
* The end of the time range for retrieving message volume metrics (exclusive).
|
|
805
|
+
*/
|
|
806
|
+
endTime: string;
|
|
807
|
+
/**
|
|
808
|
+
* Count of messages processed during the specified time range.
|
|
809
|
+
*/
|
|
810
|
+
processed: number;
|
|
811
|
+
/**
|
|
812
|
+
* The beginning of the time range for retrieving message volume metrics (inclusive).
|
|
813
|
+
*/
|
|
814
|
+
startTime: string;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
interface MetricsVolumeResponse {
|
|
818
|
+
volume: MetricsVolume | null;
|
|
819
|
+
error: string | null;
|
|
615
820
|
}
|
|
616
821
|
|
|
617
|
-
|
|
822
|
+
interface MetricsUsageResponse {
|
|
823
|
+
usage: {
|
|
824
|
+
/**
|
|
825
|
+
* The end date of the current billing period (ISO 8601 format).
|
|
826
|
+
* @example "2025-04-11"
|
|
827
|
+
*/
|
|
828
|
+
endDate: string;
|
|
829
|
+
/**
|
|
830
|
+
* The start date of the current billing period (ISO 8601 format).
|
|
831
|
+
* @example "2025-03-12"
|
|
832
|
+
*/
|
|
833
|
+
startDate: string;
|
|
834
|
+
/**
|
|
835
|
+
* The total usage for the current billing period.
|
|
836
|
+
*/
|
|
837
|
+
total: number;
|
|
838
|
+
} | null;
|
|
839
|
+
error: string | null;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
interface MetricsBucket {
|
|
843
|
+
/**
|
|
844
|
+
* The number of events or occurrences aggregated within this time period.
|
|
845
|
+
*/
|
|
846
|
+
count: number;
|
|
847
|
+
/**
|
|
848
|
+
* The starting date and time of the time period this bucket represents.
|
|
849
|
+
*/
|
|
850
|
+
periodStart: string;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
interface MetricsOptions {
|
|
854
|
+
/**
|
|
855
|
+
* The beginning of the time range for retrieving message metrics (inclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`. Defaults to one month ago if not provided.
|
|
856
|
+
* @example "2025-05-26"
|
|
857
|
+
*/
|
|
858
|
+
startTime?: string;
|
|
859
|
+
/**
|
|
860
|
+
* The end of the time range for retrieving message metrics (exclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`. Defaults to the current time if not provided.
|
|
861
|
+
* @example "2025-05-31T15:16:17Z"
|
|
862
|
+
*/
|
|
863
|
+
endTime?: string;
|
|
864
|
+
/**
|
|
865
|
+
* The ID of the campaign to filter metrics by. If not provided, metrics for all campaigns will be returned.
|
|
866
|
+
*/
|
|
867
|
+
campaignId?: string;
|
|
868
|
+
/**
|
|
869
|
+
* The interval for aggregating metrics data.
|
|
870
|
+
* @default "day"
|
|
871
|
+
*/
|
|
872
|
+
interval?: "hour" | "day" | "week" | "month";
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
declare class Metrics {
|
|
618
876
|
protected mailchannels: MailChannelsClient;
|
|
619
877
|
constructor(mailchannels: MailChannelsClient);
|
|
620
878
|
/**
|
|
621
|
-
* Retrieve
|
|
879
|
+
* 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.
|
|
880
|
+
* @param options - Options to filter and customize the engagement metrics retrieval.
|
|
622
881
|
* @example
|
|
623
882
|
* ```ts
|
|
624
883
|
* const mailchannels = new MailChannels('your-api-key')
|
|
625
|
-
* const {
|
|
884
|
+
* const { engagement } = await mailchannels.metrics.engagement()
|
|
626
885
|
* ```
|
|
627
886
|
*/
|
|
628
|
-
|
|
887
|
+
engagement(options?: MetricsOptions): Promise<MetricsEngagementResponse>;
|
|
629
888
|
/**
|
|
630
|
-
*
|
|
889
|
+
* Retrieve performance metrics for messages sent from your account, including counts of processed, delivered, hard-bounced events. Supports optional filters for time range, and campaign ID.
|
|
890
|
+
* @param options - Options to filter and customize the performance metrics retrieval.
|
|
631
891
|
* @example
|
|
632
892
|
* ```ts
|
|
633
893
|
* const mailchannels = new MailChannels('your-api-key')
|
|
634
|
-
* const {
|
|
894
|
+
* const { performance } = await mailchannels.metrics.performance()
|
|
635
895
|
* ```
|
|
636
896
|
*/
|
|
637
|
-
|
|
897
|
+
performance(options?: MetricsOptions): Promise<MetricsPerformanceResponse>;
|
|
638
898
|
/**
|
|
639
|
-
*
|
|
640
|
-
* @param options -
|
|
899
|
+
* Retrieve recipient behaviour metrics for messages sent from your account, including counts of unsubscribed events. Supports optional filters for time range, and campaign ID.
|
|
900
|
+
* @param options - Options to filter and customize the recipient behaviour metrics retrieval.
|
|
901
|
+
* @example
|
|
902
|
+
* ```ts
|
|
903
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
904
|
+
* const { behaviour } = await mailchannels.metrics.recipientBehaviour()
|
|
905
|
+
* ```
|
|
641
906
|
*/
|
|
642
|
-
|
|
907
|
+
recipientBehaviour(options?: MetricsOptions): Promise<MetricsRecipientBehaviourResponse>;
|
|
908
|
+
/**
|
|
909
|
+
* 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.
|
|
910
|
+
* @param options - Options to filter and customize the volume metrics retrieval.
|
|
911
|
+
* @example
|
|
912
|
+
* ```ts
|
|
913
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
914
|
+
* const { volume } = await mailchannels.metrics.volume()
|
|
915
|
+
* ```
|
|
916
|
+
*/
|
|
917
|
+
volume(options?: MetricsOptions): Promise<MetricsVolumeResponse>;
|
|
918
|
+
/**
|
|
919
|
+
* Retrieves usage statistics during the current billing period.
|
|
920
|
+
* @example
|
|
921
|
+
* ```ts
|
|
922
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
923
|
+
* const { usage } = await mailchannels.metrics.usage()
|
|
924
|
+
* ```
|
|
925
|
+
*/
|
|
926
|
+
usage(): Promise<MetricsUsageResponse>;
|
|
643
927
|
}
|
|
644
928
|
|
|
645
|
-
type
|
|
929
|
+
type SuppressionsTypes = "transactional" | "non-transactional";
|
|
646
930
|
|
|
647
|
-
interface
|
|
931
|
+
interface SuppressionsCreateOptions {
|
|
648
932
|
/**
|
|
649
|
-
* This
|
|
933
|
+
* 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.
|
|
934
|
+
* @default false
|
|
650
935
|
*/
|
|
651
|
-
|
|
936
|
+
addToSubAccounts?: boolean;
|
|
652
937
|
/**
|
|
653
|
-
*
|
|
938
|
+
* The total number of suppression entries to create, for the parent and/or its sub-accounts, must not exceed `1000`.
|
|
654
939
|
*/
|
|
655
|
-
|
|
656
|
-
|
|
940
|
+
entries: {
|
|
941
|
+
/**
|
|
942
|
+
* Must be less than `1024` characters.
|
|
943
|
+
*/
|
|
944
|
+
notes?: string;
|
|
945
|
+
/**
|
|
946
|
+
* The email address to suppress. Must be a valid email address format and less than `255` characters.
|
|
947
|
+
*/
|
|
948
|
+
recipient: string;
|
|
949
|
+
/**
|
|
950
|
+
* An array of types of suppression to apply to the recipient.
|
|
951
|
+
* @default ["non-transactional"]
|
|
952
|
+
*/
|
|
953
|
+
types?: SuppressionsTypes[];
|
|
954
|
+
}[];
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
type SuppressionsSource = "api" | "unsubscribe_link" | "list_unsubscribe" | "hard_bounce" | "spam_complaint" | "all";
|
|
657
958
|
|
|
658
|
-
interface
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
959
|
+
interface SuppressionsListOptions {
|
|
960
|
+
/**
|
|
961
|
+
* 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.
|
|
962
|
+
*/
|
|
963
|
+
recipient?: string;
|
|
964
|
+
/**
|
|
965
|
+
* The source of the suppression entries to filter by. If not provided, suppression entries from all sources will be returned.
|
|
966
|
+
*/
|
|
967
|
+
source?: Exclude<SuppressionsSource, "all">;
|
|
968
|
+
/**
|
|
969
|
+
* The date and/or time before which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`
|
|
970
|
+
*/
|
|
971
|
+
createdBefore?: string;
|
|
972
|
+
/**
|
|
973
|
+
* The date and/or time after which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`
|
|
974
|
+
*/
|
|
975
|
+
createdAfter?: string;
|
|
976
|
+
/**
|
|
977
|
+
* The maximum number of suppression entries to return. Must be between `1` and `1000`.
|
|
978
|
+
* @default 1000
|
|
979
|
+
*/
|
|
980
|
+
limit?: number;
|
|
981
|
+
/**
|
|
982
|
+
* The number of suppression entries to skip before returning results.
|
|
983
|
+
* @default 0
|
|
984
|
+
*/
|
|
985
|
+
offset?: number;
|
|
662
986
|
}
|
|
663
987
|
|
|
664
|
-
interface
|
|
665
|
-
|
|
666
|
-
|
|
988
|
+
interface SuppressionsListEntry {
|
|
989
|
+
createdAt: string;
|
|
990
|
+
notes?: string;
|
|
991
|
+
/**
|
|
992
|
+
* The email address that is suppressed.
|
|
993
|
+
*/
|
|
994
|
+
recipient: string;
|
|
995
|
+
sender?: string;
|
|
996
|
+
source: SuppressionsSource;
|
|
997
|
+
types: SuppressionsTypes[];
|
|
667
998
|
}
|
|
668
999
|
|
|
669
|
-
interface
|
|
670
|
-
|
|
1000
|
+
interface SuppressionsListResponse {
|
|
1001
|
+
list: SuppressionsListEntry[];
|
|
671
1002
|
error: string | null;
|
|
672
1003
|
}
|
|
673
1004
|
|
|
@@ -849,6 +1180,151 @@ interface DomainsListDownstreamAddressesResponse {
|
|
|
849
1180
|
error: string | null;
|
|
850
1181
|
}
|
|
851
1182
|
|
|
1183
|
+
type ListNames = "blocklist" | "safelist" | "blacklist" | "whitelist";
|
|
1184
|
+
|
|
1185
|
+
interface ListEntryOptions {
|
|
1186
|
+
/**
|
|
1187
|
+
* This can be a `blocklist`, `safelist`, `blacklist`, or `whitelist`.
|
|
1188
|
+
*/
|
|
1189
|
+
listName: ListNames;
|
|
1190
|
+
/**
|
|
1191
|
+
* This can be a domain, email address, or IP address. The type of the entry is automatically determined based on the value.
|
|
1192
|
+
*/
|
|
1193
|
+
item: string;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
interface ListEntry {
|
|
1197
|
+
action: Extract<ListNames, "blocklist" | "safelist">;
|
|
1198
|
+
item: string;
|
|
1199
|
+
type: "domain" | "email_address" | "ip_address";
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
interface ListEntryResponse {
|
|
1203
|
+
entry: ListEntry | null;
|
|
1204
|
+
error: string | null;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
interface ListEntriesResponse {
|
|
1208
|
+
entries: ListEntry[];
|
|
1209
|
+
error: string | null;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
interface UsersCreateOptions {
|
|
1213
|
+
/**
|
|
1214
|
+
* Flag to indicate if the user is a domain admin or a regular user
|
|
1215
|
+
* @default false
|
|
1216
|
+
*/
|
|
1217
|
+
admin?: boolean;
|
|
1218
|
+
/**
|
|
1219
|
+
* Whether or not to filter mail for this recipient. There are three valid values.
|
|
1220
|
+
* - `false` - Filtering policy will be applied to messages intended for this recipient. If this would exceed the protected-addresses limit, return an error.
|
|
1221
|
+
* - `true` - Filtering policy will not be applied to messages intended for this recipient.
|
|
1222
|
+
* - `compute` - Filtering policy will be applied to messages intended for this recipient. If this would exceed the protected-addresses limit, filtering policy will not be applied, and no error will be returned.
|
|
1223
|
+
* @default 'compute'
|
|
1224
|
+
*/
|
|
1225
|
+
filter?: boolean | "compute";
|
|
1226
|
+
/**
|
|
1227
|
+
* safelist and blocklist entries to be added
|
|
1228
|
+
*/
|
|
1229
|
+
listEntries?: {
|
|
1230
|
+
blocklist?: string[];
|
|
1231
|
+
safelist?: string[];
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
interface UsersCreateResponse {
|
|
1236
|
+
user: {
|
|
1237
|
+
email: string;
|
|
1238
|
+
roles: string[];
|
|
1239
|
+
filter?: boolean;
|
|
1240
|
+
listEntries: {
|
|
1241
|
+
item: string;
|
|
1242
|
+
type: "domain" | "email_address" | "ip_address";
|
|
1243
|
+
action: "safelist" | "blocklist";
|
|
1244
|
+
}[];
|
|
1245
|
+
} | null;
|
|
1246
|
+
error: string | null;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
interface ServiceSubscriptionsResponse {
|
|
1250
|
+
subscriptions: {
|
|
1251
|
+
active: boolean;
|
|
1252
|
+
activeAccountsCount: number;
|
|
1253
|
+
handle: string;
|
|
1254
|
+
limits: {
|
|
1255
|
+
featureHandle: string;
|
|
1256
|
+
value: string;
|
|
1257
|
+
}[];
|
|
1258
|
+
plan: {
|
|
1259
|
+
handle: string;
|
|
1260
|
+
name: string;
|
|
1261
|
+
};
|
|
1262
|
+
}[];
|
|
1263
|
+
error: string | null;
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
interface ServiceReportOptions {
|
|
1267
|
+
/**
|
|
1268
|
+
* The report type. It can be either `false_negative` or `false_positive`.
|
|
1269
|
+
*/
|
|
1270
|
+
type: "false_negative" | "false_positive";
|
|
1271
|
+
/**
|
|
1272
|
+
* The full, unaltered message content in accordance with the RFC 2822 specifications without dot stuffing.
|
|
1273
|
+
*/
|
|
1274
|
+
messageContent: string;
|
|
1275
|
+
/**
|
|
1276
|
+
* The SMTP envelope information
|
|
1277
|
+
*/
|
|
1278
|
+
smtpEnvelopeInformation?: {
|
|
1279
|
+
ehlo: string;
|
|
1280
|
+
mailFrom: string;
|
|
1281
|
+
rcptTo: string;
|
|
1282
|
+
};
|
|
1283
|
+
/**
|
|
1284
|
+
* The sending host information.
|
|
1285
|
+
*/
|
|
1286
|
+
sendingHostInformation?: {
|
|
1287
|
+
name: string;
|
|
1288
|
+
};
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
declare class Suppressions {
|
|
1292
|
+
protected mailchannels: MailChannelsClient;
|
|
1293
|
+
constructor(mailchannels: MailChannelsClient);
|
|
1294
|
+
/**
|
|
1295
|
+
* 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.
|
|
1296
|
+
* @param options - The details of the suppression entries to create.
|
|
1297
|
+
* @example
|
|
1298
|
+
* ```ts
|
|
1299
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1300
|
+
* const response = await mailchannels.suppressions.create({
|
|
1301
|
+
* // ...
|
|
1302
|
+
* });
|
|
1303
|
+
*/
|
|
1304
|
+
create(options: SuppressionsCreateOptions): Promise<SuccessResponse>;
|
|
1305
|
+
/**
|
|
1306
|
+
* Deletes suppression entry associated with the account based on the specified recipient and source.
|
|
1307
|
+
* @param recipient - The email address of the suppression entry to delete.
|
|
1308
|
+
* @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.
|
|
1309
|
+
* @example
|
|
1310
|
+
* ```ts
|
|
1311
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1312
|
+
* const response = await mailchannels.suppressions.delete('name@example.com', 'api');
|
|
1313
|
+
* ```
|
|
1314
|
+
*/
|
|
1315
|
+
delete(recipient: string, source?: SuppressionsSource): Promise<SuccessResponse>;
|
|
1316
|
+
/**
|
|
1317
|
+
* 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`.
|
|
1318
|
+
* @example
|
|
1319
|
+
* ```ts
|
|
1320
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1321
|
+
* const response = await mailchannels.suppressions.list();
|
|
1322
|
+
* ```
|
|
1323
|
+
* @param options - Options to filter and customize the suppression entries retrieval.
|
|
1324
|
+
*/
|
|
1325
|
+
list(options?: SuppressionsListOptions): Promise<SuppressionsListResponse>;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
852
1328
|
declare class Domains {
|
|
853
1329
|
protected mailchannels: MailChannelsClient;
|
|
854
1330
|
constructor(mailchannels: MailChannelsClient);
|
|
@@ -997,41 +1473,45 @@ declare class Domains {
|
|
|
997
1473
|
updateApiKey(domain: string, key: string): Promise<SuccessResponse>;
|
|
998
1474
|
}
|
|
999
1475
|
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1476
|
+
declare class Lists {
|
|
1477
|
+
protected mailchannels: MailChannelsClient;
|
|
1478
|
+
constructor(mailchannels: MailChannelsClient);
|
|
1479
|
+
/**
|
|
1480
|
+
* Add item to account-level list
|
|
1481
|
+
* @param options - The options for the list entry to add.
|
|
1482
|
+
* @example
|
|
1483
|
+
* ```ts
|
|
1484
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1485
|
+
* const { entry } = await mailchannels.lists.addListEntry({
|
|
1486
|
+
* listName: 'safelist',
|
|
1487
|
+
* item: 'name@domain.com'
|
|
1488
|
+
* })
|
|
1489
|
+
* ```
|
|
1490
|
+
*/
|
|
1491
|
+
addListEntry(options: ListEntryOptions): Promise<ListEntryResponse>;
|
|
1492
|
+
/**
|
|
1493
|
+
* Get account-level list entries.
|
|
1494
|
+
* @param listName - The name of the list to fetch. This can be a `blocklist`, `safelist`, `blacklist`, or `whitelist`.
|
|
1495
|
+
* @example
|
|
1496
|
+
* ```ts
|
|
1497
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1498
|
+
* const { entries } = await mailchannels.lists.listEntries('safelist')
|
|
1499
|
+
* ```
|
|
1500
|
+
*/
|
|
1501
|
+
listEntries(listName: ListNames): Promise<ListEntriesResponse>;
|
|
1502
|
+
/**
|
|
1503
|
+
* Delete item from account-level list.
|
|
1504
|
+
* @param options - The options for the list entry to delete.
|
|
1505
|
+
* @example
|
|
1506
|
+
* ```ts
|
|
1507
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
1508
|
+
* const { success } = await mailchannels.lists.deleteListEntry({
|
|
1509
|
+
* listName: 'safelist',
|
|
1510
|
+
* item: 'name@domain.com'
|
|
1511
|
+
* })
|
|
1512
|
+
* ```
|
|
1513
|
+
*/
|
|
1514
|
+
deleteListEntry(options: ListEntryOptions): Promise<SuccessResponse>;
|
|
1035
1515
|
}
|
|
1036
1516
|
|
|
1037
1517
|
declare class Users {
|
|
@@ -1091,46 +1571,40 @@ declare class Users {
|
|
|
1091
1571
|
deleteListEntry(email: string, options: ListEntryOptions): Promise<SuccessResponse>;
|
|
1092
1572
|
}
|
|
1093
1573
|
|
|
1094
|
-
declare class
|
|
1574
|
+
declare class Service {
|
|
1095
1575
|
protected mailchannels: MailChannelsClient;
|
|
1096
1576
|
constructor(mailchannels: MailChannelsClient);
|
|
1097
1577
|
/**
|
|
1098
|
-
*
|
|
1099
|
-
* @param options - The options for the list entry to add.
|
|
1578
|
+
* Retrieve the condition of the service
|
|
1100
1579
|
* @example
|
|
1101
1580
|
* ```ts
|
|
1102
1581
|
* const mailchannels = new MailChannels('your-api-key')
|
|
1103
|
-
* const {
|
|
1104
|
-
* listName: 'safelist',
|
|
1105
|
-
* item: 'name@domain.com'
|
|
1106
|
-
* })
|
|
1582
|
+
* const { success } = await mailchannels.service.status()
|
|
1107
1583
|
* ```
|
|
1108
1584
|
*/
|
|
1109
|
-
|
|
1585
|
+
status(): Promise<SuccessResponse>;
|
|
1110
1586
|
/**
|
|
1111
|
-
* Get
|
|
1112
|
-
* @param listName - The name of the list to fetch. This can be a `blocklist`, `safelist`, `blacklist`, or `whitelist`.
|
|
1587
|
+
* Get a list of your subscriptions to MailChannels Inbound
|
|
1113
1588
|
* @example
|
|
1114
1589
|
* ```ts
|
|
1115
1590
|
* const mailchannels = new MailChannels('your-api-key')
|
|
1116
|
-
* const {
|
|
1591
|
+
* const { subscriptions } = await mailchannels.service.subscriptions()
|
|
1117
1592
|
* ```
|
|
1118
1593
|
*/
|
|
1119
|
-
|
|
1594
|
+
subscriptions(): Promise<ServiceSubscriptionsResponse>;
|
|
1120
1595
|
/**
|
|
1121
|
-
*
|
|
1122
|
-
* @param options - The options
|
|
1596
|
+
* Submit a false negative or false positive report.
|
|
1597
|
+
* @param options - The report options
|
|
1123
1598
|
* @example
|
|
1124
1599
|
* ```ts
|
|
1125
1600
|
* const mailchannels = new MailChannels('your-api-key')
|
|
1126
|
-
* const { success } = await mailchannels.
|
|
1127
|
-
*
|
|
1128
|
-
* item: 'name@domain.com'
|
|
1601
|
+
* const { success, error } = await mailchannels.service.report({
|
|
1602
|
+
* // ...
|
|
1129
1603
|
* })
|
|
1130
1604
|
* ```
|
|
1131
1605
|
*/
|
|
1132
|
-
|
|
1606
|
+
report(options: ServiceReportOptions): Promise<SuccessResponse>;
|
|
1133
1607
|
}
|
|
1134
1608
|
|
|
1135
|
-
export { Domains as D, Emails as E, Lists as L, MailChannelsClient as M, SubAccounts as S, Users as U, Webhooks as W,
|
|
1136
|
-
export type {
|
|
1609
|
+
export { Domains as D, Emails as E, Lists as L, MailChannelsClient as M, SubAccounts as S, Users as U, Webhooks as W, Metrics as a, Suppressions as b, Service as c };
|
|
1610
|
+
export type { SuppressionsListResponse as $, SubAccountsLimit as A, SubAccountsLimitResponse as B, SubAccountsUsage as C, SubAccountsUsageResponse as F, MetricsBucket as G, MetricsOptions as H, MetricsEngagement as I, MetricsEngagementResponse as J, MetricsPerformance as K, MetricsPerformanceResponse as N, MetricsRecipientBehaviour as O, MetricsRecipientBehaviourResponse as P, MetricsVolume as Q, MetricsVolumeResponse as R, MetricsUsageResponse as T, SuppressionsTypes as V, SuppressionsCreateOptions as X, SuppressionsSource as Y, SuppressionsListOptions as Z, SuppressionsListEntry as _, DomainsData as a0, DomainsProvisionOptions as a1, DomainsBulkProvisionOptions as a2, DomainsProvisionResponse as a3, DomainsBulkProvisionResponse as a4, DomainsListOptions as a5, DomainsListResponse as a6, DomainsCreateLoginLinkResponse as a7, DomainsListDownstreamAddressesOptions as a8, DomainsDownstreamAddress as a9, DomainsListDownstreamAddressesResponse as aa, ListNames as ab, ListEntryOptions as ac, ListEntry as ad, ListEntryResponse as ae, ListEntriesResponse as af, UsersCreateOptions as ag, UsersCreateResponse as ah, ServiceSubscriptionsResponse as ai, ServiceReportOptions as aj, SuccessResponse as ak, EmailsSendRecipient as d, EmailsSendAttachment as e, EmailsSendTracking as f, EmailsSendOptionsBase as g, EmailsSendOptions as h, EmailsSendResponse as i, EmailsCheckDomainDkim as j, EmailsCheckDomainOptions as k, EmailsCheckDomainVerdict as l, EmailsCheckDomainResponse as m, WebhooksListResponse as n, WebhooksSigningKeyResponse as o, WebhooksValidateResponse as p, SubAccountsAccount as q, SubAccountsCreateResponse as r, SubAccountsListOptions as s, SubAccountsListResponse as t, SubAccountsApiKey as u, SubAccountsCreateApiKeyResponse as v, SubAccountsListApiKeyResponse as w, SubAccountsSmtpPassword as x, SubAccountsCreateSmtpPasswordResponse as y, SubAccountsListSmtpPasswordResponse as z };
|