millionsend 0.8.0 → 0.9.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/CHANGELOG.md +25 -0
- package/README.md +251 -11
- package/dist/error.d.ts +6 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +3 -2
- package/dist/error.js.map +1 -1
- package/dist/http.d.ts +10 -3
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +59 -7
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/query.d.ts +4 -0
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +8 -0
- package/dist/query.js.map +1 -1
- package/dist/resources/api-keys.d.ts +1 -0
- package/dist/resources/api-keys.d.ts.map +1 -1
- package/dist/resources/api-keys.js +2 -0
- package/dist/resources/api-keys.js.map +1 -1
- package/dist/resources/broadcasts.d.ts +4 -1
- package/dist/resources/broadcasts.d.ts.map +1 -1
- package/dist/resources/broadcasts.js +4 -1
- package/dist/resources/broadcasts.js.map +1 -1
- package/dist/resources/contacts.d.ts +1 -1
- package/dist/resources/contacts.d.ts.map +1 -1
- package/dist/resources/contacts.js +5 -1
- package/dist/resources/contacts.js.map +1 -1
- package/dist/resources/domains.d.ts +9 -2
- package/dist/resources/domains.d.ts.map +1 -1
- package/dist/resources/domains.js +10 -2
- package/dist/resources/domains.js.map +1 -1
- package/dist/resources/emails.d.ts +12 -2
- package/dist/resources/emails.d.ts.map +1 -1
- package/dist/resources/emails.js +13 -2
- package/dist/resources/emails.js.map +1 -1
- package/dist/resources/inboxes.d.ts +115 -0
- package/dist/resources/inboxes.d.ts.map +1 -0
- package/dist/resources/inboxes.js +349 -0
- package/dist/resources/inboxes.js.map +1 -0
- package/dist/resources/receiving.d.ts +57 -0
- package/dist/resources/receiving.d.ts.map +1 -0
- package/dist/resources/receiving.js +115 -0
- package/dist/resources/receiving.js.map +1 -0
- package/dist/resources/templates.d.ts.map +1 -1
- package/dist/resources/templates.js +4 -1
- package/dist/resources/templates.js.map +1 -1
- package/dist/resources/topics.d.ts.map +1 -1
- package/dist/resources/topics.js +5 -1
- package/dist/resources/topics.js.map +1 -1
- package/dist/resources/webhooks.d.ts.map +1 -1
- package/dist/resources/webhooks.js +7 -1
- package/dist/resources/webhooks.js.map +1 -1
- package/dist/types.d.ts +635 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +19 -3
package/dist/types.d.ts
CHANGED
|
@@ -15,10 +15,21 @@ export interface BatchError {
|
|
|
15
15
|
index: number;
|
|
16
16
|
message: string;
|
|
17
17
|
}
|
|
18
|
+
/** A contacts batch failure also names what strict mode would answer for the item. */
|
|
19
|
+
export interface BatchContactError extends BatchError {
|
|
20
|
+
/** Absent on instances before v0.12.0. */
|
|
21
|
+
statusCode?: number;
|
|
22
|
+
/** Absent on instances before v0.12.0. */
|
|
23
|
+
name?: string;
|
|
24
|
+
}
|
|
18
25
|
export interface ListOptions {
|
|
19
26
|
limit?: number;
|
|
20
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Keyset cursor: the last id of a page; returns the next page (older items
|
|
29
|
+
* on the newest-first lists). Mutually exclusive with `before`.
|
|
30
|
+
*/
|
|
21
31
|
after?: string;
|
|
32
|
+
/** The first id of a page; returns the previous page (newer items on the newest-first lists). */
|
|
22
33
|
before?: string;
|
|
23
34
|
}
|
|
24
35
|
export interface List<T> {
|
|
@@ -36,8 +47,11 @@ export interface Attachment {
|
|
|
36
47
|
path?: string;
|
|
37
48
|
}
|
|
38
49
|
export interface SendEmailOptions {
|
|
50
|
+
/** An address on a verified domain, or an inbox's exact address on the shared domain (open mode only). */
|
|
39
51
|
from: string;
|
|
52
|
+
/** An address here or in cc/bcc on a domain that can never receive mail (`example.com`, `.test`, …) answers 422. */
|
|
40
53
|
to: Recipients;
|
|
54
|
+
/** Up to 998 characters. */
|
|
41
55
|
subject: string;
|
|
42
56
|
html?: string;
|
|
43
57
|
text?: string;
|
|
@@ -305,7 +319,7 @@ export interface BatchContactsResponse {
|
|
|
305
319
|
failed: number;
|
|
306
320
|
};
|
|
307
321
|
/** Present in permissive mode: the items that were not written. */
|
|
308
|
-
errors?:
|
|
322
|
+
errors?: BatchContactError[];
|
|
309
323
|
}
|
|
310
324
|
/** Address a contact by id, email or Resend's `contactId` (email wins). */
|
|
311
325
|
export interface ContactSegmentOptions extends ContactAddress {
|
|
@@ -381,7 +395,9 @@ export interface RemoveTopicResponse {
|
|
|
381
395
|
export interface CreateBroadcastOptions {
|
|
382
396
|
name?: string;
|
|
383
397
|
segmentId?: string;
|
|
398
|
+
/** Never the shared domain: sending from it answers 403 `inbox_send_policy`. */
|
|
384
399
|
from: string;
|
|
400
|
+
/** Up to 998 characters. */
|
|
385
401
|
subject: string;
|
|
386
402
|
html?: string;
|
|
387
403
|
text?: string;
|
|
@@ -519,6 +535,8 @@ export interface DomainCapabilities {
|
|
|
519
535
|
sending: string;
|
|
520
536
|
receiving: string;
|
|
521
537
|
}
|
|
538
|
+
/** What the team's addresses on the shared domain may send: start conversations, reply in threads, or nothing. */
|
|
539
|
+
export type DomainSendingMode = "open" | "reply_only" | "receive_only" | (string & {});
|
|
522
540
|
export interface CreateDomainOptions {
|
|
523
541
|
name: string;
|
|
524
542
|
/** Each deployment serves one region and rejects any other; omit to use it. */
|
|
@@ -539,6 +557,11 @@ export interface UpdateDomainOptions {
|
|
|
539
557
|
/** Accepted for Resend payload compatibility; MillionSend ignores them. */
|
|
540
558
|
tls?: "enforced" | "opportunistic";
|
|
541
559
|
capabilities?: Partial<DomainCapabilities>;
|
|
560
|
+
/**
|
|
561
|
+
* Accept mail for addresses that have no inbox (they land in received mail).
|
|
562
|
+
* Off, those addresses are refused. Turning it on needs a paid plan on Cloud.
|
|
563
|
+
*/
|
|
564
|
+
receivingCatchAll?: boolean;
|
|
542
565
|
}
|
|
543
566
|
export interface DomainRecord {
|
|
544
567
|
record: string;
|
|
@@ -559,6 +582,17 @@ export interface DomainListItem {
|
|
|
559
582
|
click_tracking: boolean;
|
|
560
583
|
tracking_subdomain: string | null;
|
|
561
584
|
capabilities: DomainCapabilities;
|
|
585
|
+
/** Whether mail to addresses without an inbox is accepted; absent on instances before inboxes. */
|
|
586
|
+
receiving_catch_all?: boolean;
|
|
587
|
+
/**
|
|
588
|
+
* The team's read-only subdomain of the shared inbox domain, listed last; it
|
|
589
|
+
* sends only from its inboxes' own addresses. Absent before v0.14.0: read it as false.
|
|
590
|
+
*/
|
|
591
|
+
shared?: boolean;
|
|
592
|
+
/** Shared row only. */
|
|
593
|
+
sending_mode?: DomainSendingMode;
|
|
594
|
+
/** Shared row only: what holds sending below `open`; null in open mode. */
|
|
595
|
+
sending_mode_reason?: "plan" | "instance" | (string & {}) | null;
|
|
562
596
|
}
|
|
563
597
|
export interface CreateDomainResponse extends DomainListItem {
|
|
564
598
|
records: DomainRecord[];
|
|
@@ -571,18 +605,22 @@ export interface RemoveDomainResponse {
|
|
|
571
605
|
id: string;
|
|
572
606
|
deleted: true;
|
|
573
607
|
}
|
|
574
|
-
export type WebhookEvent = "email.sent" | "email.delivered" | "email.delivery_delayed" | "email.bounced" | "email.complained" | "email.opened" | "email.clicked" | "deliverability.warning" | "deliverability.paused" | "quota.warning" | "quota.reached" | "quota.paused" | "contact.created" | "contact.updated" | "contact.deleted" | "contact.unsubscribed" | "contact.resubscribed" | "contact.topic_opt_in" | "contact.topic_opt_out" | "suppression.added" | "suppression.removed" | (string & {});
|
|
608
|
+
export type WebhookEvent = "email.sent" | "email.delivered" | "email.delivery_delayed" | "email.bounced" | "email.complained" | "email.opened" | "email.clicked" | "deliverability.warning" | "deliverability.paused" | "quota.warning" | "quota.reached" | "quota.paused" | "contact.created" | "contact.updated" | "contact.deleted" | "contact.unsubscribed" | "contact.resubscribed" | "contact.topic_opt_in" | "contact.topic_opt_out" | "suppression.added" | "suppression.removed" | "email.received" | "inbox.created" | "inbox.updated" | "inbox.deleted" | "inbox.expired" | "inbox.thread.created" | "inbox.thread.folder.updated" | "inbox.thread.labels.updated" | "inbox.email.received" | "inbox.email.sent" | "inbox.email.quarantined" | "inbox.draft.created" | "inbox.draft.updated" | "inbox.draft.sent" | "inbox.draft.deleted" | (string & {});
|
|
575
609
|
export type WebhookStatus = "enabled" | "disabled";
|
|
576
610
|
export interface CreateWebhookOptions {
|
|
577
611
|
endpoint: string;
|
|
578
612
|
events: WebhookEvent[];
|
|
579
613
|
/** Carry over an existing `whsec_…` secret so the receiver keeps verifying unchanged; omit to mint one. */
|
|
580
614
|
signingSecret?: string;
|
|
615
|
+
/** Deliver inbox events and `email.received` only for these inboxes; null or omitted = every inbox. */
|
|
616
|
+
inboxIds?: string[] | null;
|
|
581
617
|
}
|
|
582
618
|
export interface UpdateWebhookOptions {
|
|
583
619
|
endpoint?: string;
|
|
584
620
|
events?: WebhookEvent[];
|
|
585
621
|
status?: WebhookStatus;
|
|
622
|
+
/** null delivers for every inbox again. */
|
|
623
|
+
inboxIds?: string[] | null;
|
|
586
624
|
}
|
|
587
625
|
export interface CreateWebhookResponse {
|
|
588
626
|
object: "webhook";
|
|
@@ -595,6 +633,8 @@ export interface WebhookListItem {
|
|
|
595
633
|
created_at: string;
|
|
596
634
|
status: WebhookStatus;
|
|
597
635
|
events: string[] | null;
|
|
636
|
+
/** The inboxes this endpoint is limited to; null = every inbox. Absent on instances before inboxes. */
|
|
637
|
+
inbox_ids?: string[] | null;
|
|
598
638
|
}
|
|
599
639
|
export interface Webhook extends WebhookListItem {
|
|
600
640
|
object: "webhook";
|
|
@@ -628,10 +668,15 @@ export interface CreateApiKeyOptions {
|
|
|
628
668
|
name: string;
|
|
629
669
|
/** Defaults to full_access. */
|
|
630
670
|
permission?: ApiKeyPermission;
|
|
631
|
-
/** Restrict a sending_access key to one domain. */
|
|
671
|
+
/** Restrict a sending_access key to one domain: a `shared: false` row of `domains.list`. */
|
|
632
672
|
domainId?: string | null;
|
|
633
673
|
/** Resend's spelling of `domainId`; either works. */
|
|
634
674
|
domain_id?: string | null;
|
|
675
|
+
/**
|
|
676
|
+
* Restrict a full_access key to one inbox: it reads that inbox and sends
|
|
677
|
+
* only from its address. Up to 5 per inbox; cannot be combined with a domain.
|
|
678
|
+
*/
|
|
679
|
+
inboxId?: string | null;
|
|
635
680
|
}
|
|
636
681
|
export interface CreateApiKeyResponse {
|
|
637
682
|
id: string;
|
|
@@ -643,6 +688,8 @@ export interface ApiKeyListItem {
|
|
|
643
688
|
name: string;
|
|
644
689
|
created_at: string;
|
|
645
690
|
last_used_at: string | null;
|
|
691
|
+
/** Set on an inbox-scoped key; absent on instances before inboxes. */
|
|
692
|
+
inbox_id?: string | null;
|
|
646
693
|
}
|
|
647
694
|
export interface RemoveApiKeyResponse {
|
|
648
695
|
object: "api_key";
|
|
@@ -712,10 +759,11 @@ export interface Usage {
|
|
|
712
759
|
cloud: boolean;
|
|
713
760
|
/** Effective plan; null when self-hosted. */
|
|
714
761
|
plan: "free" | "pro" | "scale" | null;
|
|
715
|
-
/** null = unlimited or self-hosted. */
|
|
762
|
+
/** null = unlimited or self-hosted. `inboxes` is absent on instances before inboxes. */
|
|
716
763
|
limits: {
|
|
717
764
|
emails_per_day: number | null;
|
|
718
765
|
domains: number | null;
|
|
766
|
+
inboxes?: number | null;
|
|
719
767
|
};
|
|
720
768
|
today: {
|
|
721
769
|
emails_sent: number;
|
|
@@ -728,4 +776,586 @@ export interface Usage {
|
|
|
728
776
|
/** Dashboard origin, for building links; null when unset. */
|
|
729
777
|
app_url: string | null;
|
|
730
778
|
}
|
|
779
|
+
export type SenderTrust = "owner" | "allowlisted" | "known_thread" | "external" | "unauthenticated" | "failed" | (string & {});
|
|
780
|
+
export type ScreeningVerdict = "pending" | "clean" | "suspicious" | "quarantined" | "released" | (string & {});
|
|
781
|
+
export type QuarantineReason = "failed_auth" | "unauthenticated_sender" | "not_allowlisted" | "injection" | "phishing" | "virus" | "unscreened" | "screening_cap" | (string & {});
|
|
782
|
+
export type SpamVerdict = "pass" | "gray" | "fail" | (string & {});
|
|
783
|
+
export type VirusVerdict = "pass" | "fail" | "processing_failed" | (string & {});
|
|
784
|
+
export type ExtractedKind = "code" | "link" | (string & {});
|
|
785
|
+
/** The verdict and the sender's trust tier, as lists carry them. */
|
|
786
|
+
export interface ScreeningSummary {
|
|
787
|
+
verdict: ScreeningVerdict;
|
|
788
|
+
sender_trust: SenderTrust;
|
|
789
|
+
}
|
|
790
|
+
/** How an inbox screened one message. Scores are 0–100, null when it was not judged. */
|
|
791
|
+
export interface Screening extends ScreeningSummary {
|
|
792
|
+
/** Set while quarantined or after a release. */
|
|
793
|
+
quarantine_reason: QuarantineReason | null;
|
|
794
|
+
reasons: string[];
|
|
795
|
+
injection_score: number | null;
|
|
796
|
+
phishing_score: number | null;
|
|
797
|
+
hidden_text_removed: boolean;
|
|
798
|
+
}
|
|
799
|
+
export interface ReceivedEmailAttachment {
|
|
800
|
+
id: string;
|
|
801
|
+
filename: string | null;
|
|
802
|
+
content_type: string;
|
|
803
|
+
content_id: string | null;
|
|
804
|
+
content_disposition: string | null;
|
|
805
|
+
size: number;
|
|
806
|
+
}
|
|
807
|
+
/** One inbox a received message landed in (owner views). */
|
|
808
|
+
export interface ReceivedEmailInbox {
|
|
809
|
+
inbox_id: string;
|
|
810
|
+
thread_id: string;
|
|
811
|
+
verdict: ScreeningVerdict;
|
|
812
|
+
}
|
|
813
|
+
/** Fields after `attachments` are MillionSend extensions, absent on instances before inboxes. */
|
|
814
|
+
export interface ReceivedEmailListItem {
|
|
815
|
+
id: string;
|
|
816
|
+
to: string[];
|
|
817
|
+
/** Bare address; the display name is in the detail's `headers.from`. */
|
|
818
|
+
from: string;
|
|
819
|
+
created_at: string;
|
|
820
|
+
subject: string;
|
|
821
|
+
bcc: string[];
|
|
822
|
+
cc: string[];
|
|
823
|
+
reply_to: string[];
|
|
824
|
+
/** The team's envelope recipients: the addresses the message was delivered to. */
|
|
825
|
+
received_for: string[];
|
|
826
|
+
message_id: string;
|
|
827
|
+
attachments: ReceivedEmailAttachment[];
|
|
828
|
+
inbox_id?: string | null;
|
|
829
|
+
thread_id?: string | null;
|
|
830
|
+
/** Owner views only. */
|
|
831
|
+
inboxes?: ReceivedEmailInbox[];
|
|
832
|
+
screening?: ScreeningSummary | null;
|
|
833
|
+
spam_verdict?: SpamVerdict | null;
|
|
834
|
+
virus_verdict?: VirusVerdict | null;
|
|
835
|
+
extracted?: {
|
|
836
|
+
kinds: ExtractedKind[];
|
|
837
|
+
};
|
|
838
|
+
/** Present with an inbox context. */
|
|
839
|
+
read?: boolean;
|
|
840
|
+
}
|
|
841
|
+
/** A membership held for screening or quarantine; the long-poll reports ids and why only. */
|
|
842
|
+
export interface HeldEmail {
|
|
843
|
+
id: string;
|
|
844
|
+
/** Null for a catch-all copy held for a virus. */
|
|
845
|
+
inbox_id: string | null;
|
|
846
|
+
reason: "pending" | "quarantined";
|
|
847
|
+
/** Why it was quarantined; null while it is still being screened. */
|
|
848
|
+
quarantine_reason: QuarantineReason | null;
|
|
849
|
+
created_at: string;
|
|
850
|
+
}
|
|
851
|
+
export interface ReceivedEmailList extends List<ReceivedEmailListItem> {
|
|
852
|
+
/** Long-poll (`wait`) only: held messages that matched since the cursor. */
|
|
853
|
+
held?: HeldEmail[];
|
|
854
|
+
}
|
|
855
|
+
export interface ListReceivedEmailsOptions extends ListOptions {
|
|
856
|
+
/** Long-poll: hold the request up to this many seconds (0–50) until a matching email arrives. */
|
|
857
|
+
wait?: number;
|
|
858
|
+
/** ISO 8601: only mail received after this instant. */
|
|
859
|
+
since?: string;
|
|
860
|
+
/** An unknown inbox answers 404 `not_found` at once, even with `wait`. */
|
|
861
|
+
inboxId?: string;
|
|
862
|
+
/** An address the message was delivered to (`received_for`). */
|
|
863
|
+
to?: string;
|
|
864
|
+
/** A sender address, or a domain covering its subdomains. */
|
|
865
|
+
from?: string;
|
|
866
|
+
subjectContains?: string;
|
|
867
|
+
/** Needs `inboxId`, except with an inbox-scoped key, which reads its own inbox. */
|
|
868
|
+
unread?: boolean;
|
|
869
|
+
/** Also list held mail (full-access team keys only). */
|
|
870
|
+
includeQuarantined?: boolean;
|
|
871
|
+
/** List only held mail (full-access team keys only). */
|
|
872
|
+
quarantined?: boolean;
|
|
873
|
+
}
|
|
874
|
+
export interface GetReceivedEmailOptions {
|
|
875
|
+
/** `data_uri` (default) inlines `cid:` images; `cid` leaves the references. */
|
|
876
|
+
htmlFormat?: "data_uri" | "cid";
|
|
877
|
+
}
|
|
878
|
+
/** A verification code or sign-in link found in the message (`extract_codes` inboxes). */
|
|
879
|
+
export interface ReceivedExtracted {
|
|
880
|
+
kinds: ExtractedKind[];
|
|
881
|
+
code?: string | null;
|
|
882
|
+
link?: string | null;
|
|
883
|
+
link_domain_matches_sender?: boolean | null;
|
|
884
|
+
ambiguous?: boolean;
|
|
885
|
+
}
|
|
886
|
+
export interface ReceivedEmail extends ReceivedEmailListItem {
|
|
887
|
+
object: "email";
|
|
888
|
+
html: string | null;
|
|
889
|
+
html_format: "data_uri" | "cid";
|
|
890
|
+
/** Invisible characters removed; `html` and `raw` stay byte-faithful. */
|
|
891
|
+
text: string | null;
|
|
892
|
+
headers: Record<string, string> | null;
|
|
893
|
+
authentication: {
|
|
894
|
+
spf: string;
|
|
895
|
+
dkim: string;
|
|
896
|
+
dmarc: string;
|
|
897
|
+
};
|
|
898
|
+
/** Signed link to the original message, valid for one hour; null once purged or when it carries malware. */
|
|
899
|
+
raw: {
|
|
900
|
+
download_url: string;
|
|
901
|
+
expires_at: string;
|
|
902
|
+
} | null;
|
|
903
|
+
screening?: Screening | null;
|
|
904
|
+
spam_score?: number | null;
|
|
905
|
+
virus_signature?: string | null;
|
|
906
|
+
/** The new part of the message as plain text: hidden text, quotes and the signature removed. */
|
|
907
|
+
extracted_text?: string | null;
|
|
908
|
+
extracted?: ReceivedExtracted;
|
|
909
|
+
}
|
|
910
|
+
export interface ReceivedAttachment {
|
|
911
|
+
id: string;
|
|
912
|
+
filename?: string;
|
|
913
|
+
size: number;
|
|
914
|
+
content_type: string;
|
|
915
|
+
content_disposition: "inline" | "attachment";
|
|
916
|
+
content_id?: string;
|
|
917
|
+
/** Signed link to the bytes, valid for one hour; it needs no API key. */
|
|
918
|
+
download_url: string;
|
|
919
|
+
expires_at: string;
|
|
920
|
+
}
|
|
921
|
+
export interface ReceivedAttachmentDetail extends ReceivedAttachment {
|
|
922
|
+
object: "attachment";
|
|
923
|
+
}
|
|
924
|
+
export interface ReplyThreadEmailOptions {
|
|
925
|
+
html?: string;
|
|
926
|
+
text?: string;
|
|
927
|
+
cc?: Recipients;
|
|
928
|
+
bcc?: Recipients;
|
|
929
|
+
/** Defaults to `Re: ` plus the thread subject. */
|
|
930
|
+
subject?: string;
|
|
931
|
+
/** Also copy the message's other recipients. */
|
|
932
|
+
replyAll?: boolean;
|
|
933
|
+
/** Hold it as a draft for a person to approve. */
|
|
934
|
+
requiresApproval?: boolean;
|
|
935
|
+
}
|
|
936
|
+
export interface ReplyReceivedEmailOptions extends ReplyThreadEmailOptions {
|
|
937
|
+
/** An address on a verified team domain; defaults to the inbox the message landed in. */
|
|
938
|
+
from?: string;
|
|
939
|
+
/** Reply as this inbox when the message landed in several. */
|
|
940
|
+
inboxId?: string;
|
|
941
|
+
}
|
|
942
|
+
export interface ForwardThreadEmailOptions {
|
|
943
|
+
to: Recipients;
|
|
944
|
+
cc?: Recipients;
|
|
945
|
+
bcc?: Recipients;
|
|
946
|
+
/** A note above the forwarded message. */
|
|
947
|
+
html?: string;
|
|
948
|
+
text?: string;
|
|
949
|
+
/** Defaults to `Fwd: ` plus the thread subject. */
|
|
950
|
+
subject?: string;
|
|
951
|
+
requiresApproval?: boolean;
|
|
952
|
+
}
|
|
953
|
+
export interface ForwardReceivedEmailOptions extends ForwardThreadEmailOptions {
|
|
954
|
+
from?: string;
|
|
955
|
+
inboxId?: string;
|
|
956
|
+
/** `inline` (default) quotes the message; `attachment` attaches it as `forwarded_message.eml`. */
|
|
957
|
+
mode?: "inline" | "attachment";
|
|
958
|
+
}
|
|
959
|
+
/** What `emails.receiving.reply` / `forward` sent. */
|
|
960
|
+
export interface ReceivedEmailSent {
|
|
961
|
+
object: "email";
|
|
962
|
+
id: string;
|
|
963
|
+
thread_id: string | null;
|
|
964
|
+
inbox_id: string | null;
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* The outcome of a send from an inbox: sent now, or held as a draft that waits
|
|
968
|
+
* for a person (HTTP 202) because the inbox's rules or `requiresApproval` asked.
|
|
969
|
+
*/
|
|
970
|
+
export type InboxSendOutcome<T> = {
|
|
971
|
+
kind: "sent";
|
|
972
|
+
email: T;
|
|
973
|
+
} | {
|
|
974
|
+
kind: "draft";
|
|
975
|
+
draft: Draft;
|
|
976
|
+
};
|
|
977
|
+
export type InboxKind = "agent" | "human" | (string & {});
|
|
978
|
+
/** Fields after `created_at` are MillionSend extensions. */
|
|
979
|
+
export interface Inbox {
|
|
980
|
+
object: "inbox";
|
|
981
|
+
id: string;
|
|
982
|
+
name: string;
|
|
983
|
+
email_address: string;
|
|
984
|
+
/** For an address on the shared domain, the id of the team's `shared: true` row of `domains.list`. */
|
|
985
|
+
domain_id: string;
|
|
986
|
+
receiving_address: string | null;
|
|
987
|
+
from_name: string | null;
|
|
988
|
+
/** Threads with an unread message. */
|
|
989
|
+
unread: number;
|
|
990
|
+
/** Unsent drafts. */
|
|
991
|
+
drafts: number;
|
|
992
|
+
last_received: string | null;
|
|
993
|
+
created_at: string;
|
|
994
|
+
kind: InboxKind;
|
|
995
|
+
/** The address is on the instance's shared domain. */
|
|
996
|
+
shared: boolean;
|
|
997
|
+
expires_at: string | null;
|
|
998
|
+
/** Messages in quarantine, not released. */
|
|
999
|
+
quarantined: number;
|
|
1000
|
+
pending_approval: number;
|
|
1001
|
+
}
|
|
1002
|
+
export interface InboxListItem {
|
|
1003
|
+
id: string;
|
|
1004
|
+
name: string | null;
|
|
1005
|
+
email_address: string;
|
|
1006
|
+
from_name: string | null;
|
|
1007
|
+
unread: number;
|
|
1008
|
+
last_received: string | null;
|
|
1009
|
+
kind: InboxKind;
|
|
1010
|
+
shared: boolean;
|
|
1011
|
+
expires_at: string | null;
|
|
1012
|
+
}
|
|
1013
|
+
/** An inbox's safety rules. */
|
|
1014
|
+
export interface InboxSafety {
|
|
1015
|
+
accept_from: "anyone" | "verified" | "allowlist" | (string & {});
|
|
1016
|
+
/** `local@domain` (exact) or `*@domain` (the domain and its subdomains). */
|
|
1017
|
+
allowlist: string[];
|
|
1018
|
+
/** Owners besides the team members' login addresses; on the shared domain they are not trusted senders. */
|
|
1019
|
+
owner_addresses: string[];
|
|
1020
|
+
/** Score external and unauthenticated mail for prompt injection (agent inboxes). */
|
|
1021
|
+
screening: boolean;
|
|
1022
|
+
extract_codes: boolean;
|
|
1023
|
+
send_policy: "reply_only" | "allowlist" | "open" | (string & {});
|
|
1024
|
+
require_approval: boolean;
|
|
1025
|
+
private_codes: boolean;
|
|
1026
|
+
/** Recipients per UTC day sent without approval; null = no inbox cap. */
|
|
1027
|
+
send_cap: number | null;
|
|
1028
|
+
forward_to: string[];
|
|
1029
|
+
}
|
|
1030
|
+
export interface InboxSafetyResponse extends InboxSafety {
|
|
1031
|
+
object: "inbox_safety";
|
|
1032
|
+
inbox_id: string;
|
|
1033
|
+
}
|
|
1034
|
+
/** A change to an inbox's safety rules; omitted fields keep their value. */
|
|
1035
|
+
export interface InboxSafetyOptions {
|
|
1036
|
+
acceptFrom?: InboxSafety["accept_from"];
|
|
1037
|
+
allowlist?: string[];
|
|
1038
|
+
ownerAddresses?: string[];
|
|
1039
|
+
screening?: boolean;
|
|
1040
|
+
extractCodes?: boolean;
|
|
1041
|
+
/** On the shared domain, `allowlist` answers 422, and so does `open` unless the domain's `sending_mode` is `open`. */
|
|
1042
|
+
sendPolicy?: InboxSafety["send_policy"];
|
|
1043
|
+
requireApproval?: boolean;
|
|
1044
|
+
privateCodes?: boolean;
|
|
1045
|
+
sendCap?: number | null;
|
|
1046
|
+
/** Team members' login addresses or `ownerAddresses` only; on the shared domain, members only. */
|
|
1047
|
+
forwardTo?: string[];
|
|
1048
|
+
}
|
|
1049
|
+
export interface CreateInboxOptions {
|
|
1050
|
+
/** An address on a verified domain; omit it for an address on the instance's shared domain. */
|
|
1051
|
+
emailAddress?: string;
|
|
1052
|
+
/**
|
|
1053
|
+
* Instead of `emailAddress`, the id of a `domains.list` row: the `shared: true`
|
|
1054
|
+
* row works like omitting both; one of your domains needs `username`.
|
|
1055
|
+
*/
|
|
1056
|
+
domainId?: string;
|
|
1057
|
+
/**
|
|
1058
|
+
* The part before the @. On the shared domain it is optional (random when
|
|
1059
|
+
* omitted): 1–64 of `a-z 0-9 . _ -`, starting and ending with a letter or
|
|
1060
|
+
* digit; reserved names and brand look-alikes answer 422, one in use 409.
|
|
1061
|
+
* Required with the `domainId` of one of your domains.
|
|
1062
|
+
*/
|
|
1063
|
+
username?: string;
|
|
1064
|
+
/** 1–320 characters. */
|
|
1065
|
+
name?: string;
|
|
1066
|
+
/** Display name for sending; a plain name, not `Name <email>`. Reviewed on the shared domain. */
|
|
1067
|
+
fromName?: string;
|
|
1068
|
+
/** Receive at a generated `receiving_address` on the shared domain instead of the domain's MX. */
|
|
1069
|
+
forwarding?: boolean;
|
|
1070
|
+
/** Defaults to "agent". */
|
|
1071
|
+
kind?: "agent" | "human";
|
|
1072
|
+
/**
|
|
1073
|
+
* `"1h"` to `"365d"`; omitted or null, the inbox never expires. A shared-domain
|
|
1074
|
+
* inbox unused for 90 days is deleted either way.
|
|
1075
|
+
*/
|
|
1076
|
+
expiresIn?: string | null;
|
|
1077
|
+
/** Starting safety rules on top of the kind's defaults. */
|
|
1078
|
+
safety?: InboxSafetyOptions;
|
|
1079
|
+
}
|
|
1080
|
+
export interface UpdateInboxOptions {
|
|
1081
|
+
/** 1–320 characters. */
|
|
1082
|
+
name?: string;
|
|
1083
|
+
/** "" removes it. Reviewed on the shared domain. */
|
|
1084
|
+
fromName?: string;
|
|
1085
|
+
/** A new lifetime counted from now, `"1h"` to `"365d"`; null never expires. */
|
|
1086
|
+
expiresIn?: string | null;
|
|
1087
|
+
}
|
|
1088
|
+
export interface ListInboxesOptions extends ListOptions {
|
|
1089
|
+
kind?: InboxKind;
|
|
1090
|
+
}
|
|
1091
|
+
export interface RemoveInboxResponse {
|
|
1092
|
+
object: "inbox";
|
|
1093
|
+
id: string;
|
|
1094
|
+
deleted: true;
|
|
1095
|
+
}
|
|
1096
|
+
export interface LatestCodeOptions {
|
|
1097
|
+
/** A sender address, or a domain covering its subdomains. */
|
|
1098
|
+
from?: string;
|
|
1099
|
+
/** Long-poll up to this many seconds (0–50) for a code to arrive. */
|
|
1100
|
+
wait?: number;
|
|
1101
|
+
/** Oldest message to consider, in seconds since delivery or release (60–86400; the API defaults to 600). */
|
|
1102
|
+
maxAge?: number;
|
|
1103
|
+
/**
|
|
1104
|
+
* ISO 8601 with an offset: only mail received after this instant. Pass the
|
|
1105
|
+
* previous code's `received_at` so a second sign-in waits for its own code.
|
|
1106
|
+
*/
|
|
1107
|
+
since?: string;
|
|
1108
|
+
}
|
|
1109
|
+
export interface VerificationCode {
|
|
1110
|
+
object: "verification_code";
|
|
1111
|
+
/** `timeout` only when `wait` ran out with nothing new. */
|
|
1112
|
+
status: "found" | "none" | "ambiguous" | "timeout" | (string & {});
|
|
1113
|
+
kind: "otp" | "link" | null;
|
|
1114
|
+
code: string | null;
|
|
1115
|
+
url: string | null;
|
|
1116
|
+
link_domain_matches_sender: boolean | null;
|
|
1117
|
+
email_id: string | null;
|
|
1118
|
+
from: string | null;
|
|
1119
|
+
received_at: string | null;
|
|
1120
|
+
sender_trust: SenderTrust | null;
|
|
1121
|
+
}
|
|
1122
|
+
export interface QuarantinedEmail {
|
|
1123
|
+
id: string;
|
|
1124
|
+
/** Null for a catch-all copy held for a virus, which belongs to no inbox. */
|
|
1125
|
+
thread_id: string | null;
|
|
1126
|
+
from: string;
|
|
1127
|
+
subject: string | null;
|
|
1128
|
+
received_at: string;
|
|
1129
|
+
quarantine_reason: QuarantineReason;
|
|
1130
|
+
sender_trust: SenderTrust;
|
|
1131
|
+
injection_score: number | null;
|
|
1132
|
+
phishing_score: number | null;
|
|
1133
|
+
virus_signature: string | null;
|
|
1134
|
+
}
|
|
1135
|
+
export interface ReleaseQuarantinedOptions {
|
|
1136
|
+
/** Also add the sender to the inbox's allowlist. */
|
|
1137
|
+
trustSender?: boolean;
|
|
1138
|
+
}
|
|
1139
|
+
export interface QuarantineRelease {
|
|
1140
|
+
object: "inbox_release";
|
|
1141
|
+
inbox_id: string;
|
|
1142
|
+
email_id: string;
|
|
1143
|
+
released_at: string;
|
|
1144
|
+
/** The address added to the allowlist, or null. */
|
|
1145
|
+
trusted_sender: string | null;
|
|
1146
|
+
}
|
|
1147
|
+
export interface ThreadLabel {
|
|
1148
|
+
id: string;
|
|
1149
|
+
name: string;
|
|
1150
|
+
/** `#RRGGBB`, uppercase. */
|
|
1151
|
+
color: string;
|
|
1152
|
+
}
|
|
1153
|
+
export interface Label extends ThreadLabel {
|
|
1154
|
+
created_at: string;
|
|
1155
|
+
}
|
|
1156
|
+
/** Labels are not paginated: every label of the inbox, oldest first. */
|
|
1157
|
+
export interface LabelList {
|
|
1158
|
+
object: "list";
|
|
1159
|
+
data: Label[];
|
|
1160
|
+
}
|
|
1161
|
+
/** What creating or updating a label answers: the whole label. */
|
|
1162
|
+
export interface LabelAck extends Label {
|
|
1163
|
+
object: "inbox_label";
|
|
1164
|
+
}
|
|
1165
|
+
export interface CreateLabelOptions {
|
|
1166
|
+
name: string;
|
|
1167
|
+
/** `#RRGGBB`; random when omitted. */
|
|
1168
|
+
color?: string;
|
|
1169
|
+
}
|
|
1170
|
+
export interface UpdateLabelOptions {
|
|
1171
|
+
name?: string;
|
|
1172
|
+
color?: string;
|
|
1173
|
+
}
|
|
1174
|
+
export interface RemoveLabelResponse {
|
|
1175
|
+
object: "inbox_label";
|
|
1176
|
+
id: string;
|
|
1177
|
+
deleted: true;
|
|
1178
|
+
}
|
|
1179
|
+
export type ThreadFolder = "inbox" | "archive" | "spam" | "sent" | "trash";
|
|
1180
|
+
/** `sent` is assigned by the API and cannot be set. */
|
|
1181
|
+
export type MoveThreadFolder = "inbox" | "archive" | "spam" | "trash";
|
|
1182
|
+
export interface ThreadSummary {
|
|
1183
|
+
object: "inbox_thread";
|
|
1184
|
+
id: string;
|
|
1185
|
+
subject: string | null;
|
|
1186
|
+
folder: ThreadFolder;
|
|
1187
|
+
labels: ThreadLabel[];
|
|
1188
|
+
read: boolean;
|
|
1189
|
+
/** MillionSend extension: held messages (owner views; 0 for agent views). */
|
|
1190
|
+
quarantined: number;
|
|
1191
|
+
}
|
|
1192
|
+
export interface ThreadListItem {
|
|
1193
|
+
id: string;
|
|
1194
|
+
subject: string | null;
|
|
1195
|
+
/** The latest inbound sender (`Name <address>`), or the inbox address for outbound-only threads. */
|
|
1196
|
+
from: string | null;
|
|
1197
|
+
to: string[];
|
|
1198
|
+
cc: string[];
|
|
1199
|
+
bcc: string[];
|
|
1200
|
+
labels: ThreadLabel[];
|
|
1201
|
+
message_count: number;
|
|
1202
|
+
has_attachment: boolean;
|
|
1203
|
+
has_draft: boolean;
|
|
1204
|
+
read: boolean;
|
|
1205
|
+
/** With `includeQuarantined` in owner views: messages in quarantine, not released. */
|
|
1206
|
+
quarantined?: number;
|
|
1207
|
+
/** Last activity; the sort key. */
|
|
1208
|
+
received_at: string;
|
|
1209
|
+
folder: ThreadFolder;
|
|
1210
|
+
}
|
|
1211
|
+
export interface ThreadSearchResult extends ThreadListItem {
|
|
1212
|
+
matched_email_id: string | null;
|
|
1213
|
+
/** Only the keys that matched, each a list of fragments with `**match**` markers. */
|
|
1214
|
+
highlights: Partial<Record<"subject" | "from" | "to" | "cc" | "bcc" | (string & {}), string[]>>;
|
|
1215
|
+
}
|
|
1216
|
+
export interface GetThreadEmailOptions {
|
|
1217
|
+
/** Owner views: also read a held message (full-access team keys only). */
|
|
1218
|
+
includeQuarantined?: boolean;
|
|
1219
|
+
}
|
|
1220
|
+
export interface ListThreadEmailsOptions extends ListOptions, GetThreadEmailOptions {
|
|
1221
|
+
}
|
|
1222
|
+
export interface ListThreadsOptions extends ListOptions {
|
|
1223
|
+
/** Defaults to `inbox` (`inbox`, `archive`, `sent` with `labels`). */
|
|
1224
|
+
folders?: ThreadFolder[];
|
|
1225
|
+
/** Label ids, any-match (up to 50). */
|
|
1226
|
+
labels?: string[];
|
|
1227
|
+
read?: boolean;
|
|
1228
|
+
/** Owner views: also list threads whose messages are all held. */
|
|
1229
|
+
includeQuarantined?: boolean;
|
|
1230
|
+
}
|
|
1231
|
+
export interface SearchThreadsOptions extends ListThreadsOptions {
|
|
1232
|
+
/** Every word must match subject, sender or recipients; `"phrase"`, `-word`. */
|
|
1233
|
+
query?: string;
|
|
1234
|
+
/** Substrings of the address or name, any-match (up to 20 each). */
|
|
1235
|
+
from?: string[];
|
|
1236
|
+
to?: string[];
|
|
1237
|
+
cc?: string[];
|
|
1238
|
+
bcc?: string[];
|
|
1239
|
+
hasAttachment?: boolean;
|
|
1240
|
+
/** `YYYY-MM-DD` (the whole day) or ISO 8601. */
|
|
1241
|
+
startDate?: string;
|
|
1242
|
+
endDate?: string;
|
|
1243
|
+
}
|
|
1244
|
+
export interface UpdateThreadOptions {
|
|
1245
|
+
/** Marks every message. */
|
|
1246
|
+
read?: boolean;
|
|
1247
|
+
folder?: MoveThreadFolder;
|
|
1248
|
+
/** Applies a label; labels cannot be removed through the API. */
|
|
1249
|
+
labelId?: string;
|
|
1250
|
+
}
|
|
1251
|
+
export interface RemoveThreadResponse {
|
|
1252
|
+
object: "inbox_thread";
|
|
1253
|
+
id: string;
|
|
1254
|
+
/** False when the thread was already in trash. */
|
|
1255
|
+
deleted: boolean;
|
|
1256
|
+
}
|
|
1257
|
+
export interface ThreadEmailAttachment {
|
|
1258
|
+
/** A UUID on received mail; the position ("0", "1", …) on mail the inbox sent. */
|
|
1259
|
+
id: string;
|
|
1260
|
+
filename: string | null;
|
|
1261
|
+
size: number | null;
|
|
1262
|
+
}
|
|
1263
|
+
/** Fields after `received_at` are MillionSend extensions. */
|
|
1264
|
+
export interface ThreadEmail {
|
|
1265
|
+
id: string;
|
|
1266
|
+
direction: "inbound" | "outbound";
|
|
1267
|
+
/** `Name <address>` when the sender has a display name. */
|
|
1268
|
+
from: string;
|
|
1269
|
+
to: string[];
|
|
1270
|
+
cc: string[];
|
|
1271
|
+
bcc: string[];
|
|
1272
|
+
reply_to: string[];
|
|
1273
|
+
subject: string | null;
|
|
1274
|
+
message_id: string | null;
|
|
1275
|
+
html: string | null;
|
|
1276
|
+
text: string | null;
|
|
1277
|
+
attachments: ThreadEmailAttachment[];
|
|
1278
|
+
read: boolean;
|
|
1279
|
+
received_at: string;
|
|
1280
|
+
/** Inbound only. */
|
|
1281
|
+
extracted_text?: string | null;
|
|
1282
|
+
screening?: Screening;
|
|
1283
|
+
spam_verdict?: SpamVerdict | null;
|
|
1284
|
+
virus_verdict?: VirusVerdict | null;
|
|
1285
|
+
/** Outbound only: the email's last delivery event. */
|
|
1286
|
+
status?: string;
|
|
1287
|
+
}
|
|
1288
|
+
export interface SentEmail extends ThreadEmail {
|
|
1289
|
+
email_id: string;
|
|
1290
|
+
thread_id: string | null;
|
|
1291
|
+
inbox_id: string | null;
|
|
1292
|
+
}
|
|
1293
|
+
export type DraftStatus = "draft" | "pending_approval" | "sent" | "rejected" | "expired" | (string & {});
|
|
1294
|
+
/** Fields after `updated_at` are MillionSend extensions. */
|
|
1295
|
+
export interface Draft {
|
|
1296
|
+
object: "inbox_draft";
|
|
1297
|
+
id: string;
|
|
1298
|
+
type: "standalone" | "reply";
|
|
1299
|
+
to: string[] | null;
|
|
1300
|
+
cc: string[];
|
|
1301
|
+
bcc: string[];
|
|
1302
|
+
subject: string | null;
|
|
1303
|
+
html: string | null;
|
|
1304
|
+
text: string | null;
|
|
1305
|
+
thread_id: string | null;
|
|
1306
|
+
reply_to_email_id: string | null;
|
|
1307
|
+
/** Set once sent. */
|
|
1308
|
+
email_id: string | null;
|
|
1309
|
+
created_at: string;
|
|
1310
|
+
updated_at: string;
|
|
1311
|
+
status: DraftStatus;
|
|
1312
|
+
/** Why it waits for a person, e.g. `send_policy`, `ramp`, `approval_required`, `reply_to_redirect`. */
|
|
1313
|
+
approval_reasons: string[];
|
|
1314
|
+
forward: boolean;
|
|
1315
|
+
decided_by: string | null;
|
|
1316
|
+
decided_at: string | null;
|
|
1317
|
+
expires_at: string | null;
|
|
1318
|
+
}
|
|
1319
|
+
export interface DraftListItem {
|
|
1320
|
+
id: string;
|
|
1321
|
+
type: "standalone" | "reply";
|
|
1322
|
+
to: string[] | null;
|
|
1323
|
+
cc: string[];
|
|
1324
|
+
bcc: string[];
|
|
1325
|
+
subject: string | null;
|
|
1326
|
+
snippet: string | null;
|
|
1327
|
+
thread_id: string | null;
|
|
1328
|
+
reply_to_email_id: string | null;
|
|
1329
|
+
updated_at: string;
|
|
1330
|
+
status: DraftStatus;
|
|
1331
|
+
approval_reasons: string[];
|
|
1332
|
+
}
|
|
1333
|
+
export interface UpdateDraftOptions {
|
|
1334
|
+
/** null clears. */
|
|
1335
|
+
to?: Recipients | null;
|
|
1336
|
+
/** null or [] clears. */
|
|
1337
|
+
cc?: Recipients | null;
|
|
1338
|
+
bcc?: Recipients | null;
|
|
1339
|
+
subject?: string | null;
|
|
1340
|
+
/** Setting `html` or `text` replaces the whole body; the part you omit becomes null. */
|
|
1341
|
+
html?: string | null;
|
|
1342
|
+
text?: string | null;
|
|
1343
|
+
}
|
|
1344
|
+
export interface CreateDraftOptions extends UpdateDraftOptions {
|
|
1345
|
+
/** A reply draft names both the thread and the email it answers, or neither. */
|
|
1346
|
+
threadId?: string;
|
|
1347
|
+
replyToEmailId?: string;
|
|
1348
|
+
}
|
|
1349
|
+
export interface RemoveDraftResponse {
|
|
1350
|
+
object: "inbox_draft";
|
|
1351
|
+
id: string;
|
|
1352
|
+
deleted: true;
|
|
1353
|
+
}
|
|
1354
|
+
/** What `drafts.send` sent. */
|
|
1355
|
+
export interface SentDraft {
|
|
1356
|
+
object: "inbox_draft";
|
|
1357
|
+
id: string;
|
|
1358
|
+
thread_id: string | null;
|
|
1359
|
+
email_id: string;
|
|
1360
|
+
}
|
|
731
1361
|
//# sourceMappingURL=types.d.ts.map
|