@messagebird/sdk 0.14.0 → 0.15.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/dist/index.d.mts CHANGED
@@ -5145,7 +5145,7 @@ type EmailTemplateSend = unknown & {
5145
5145
  */
5146
5146
  slug?: TemplateSlug;
5147
5147
  /**
5148
- * Which of the template's languages to send. Omit it to send the template's default language. When the template does not carry the language you ask for, its own `on_missing_language` setting decides whether the closest available language is sent instead or the send is rejected.
5148
+ * Which of the template's languages to send. Omit it to send the template's default language, unless the template sets `language_source_required`, in which case a send naming no language is rejected. When the template does not carry the language you ask for, its own `on_missing_language` setting decides whether the closest available language is sent instead or the send is rejected.
5149
5149
  *
5150
5150
  */
5151
5151
  language?: LanguageTag;
@@ -5235,6 +5235,10 @@ type EmailMessageSendRequest = {
5235
5235
  *
5236
5236
  */
5237
5237
  ip_pool_id?: string;
5238
+ /**
5239
+ * Content classification. Controls suppression policy: `marketing` blocks on all suppression reasons; `transactional` allows delivery through complaint and unsubscribe suppressions, for receipts, password resets, and similar operational mail. When you send with `template` and omit this field, the message takes the template's own classification, so a template created as `transactional` sends as transactional. Set this field to classify a single send differently from its template; it always takes precedence. Sends that carry no template and no category are `marketing`.
5240
+ *
5241
+ */
5238
5242
  category?: EmailMessageCategory;
5239
5243
  /**
5240
5244
  * Preview feature — threaded replies. Currently unavailable; supplying this field returns `422 UnsupportedEmailFeature`. When generally available, sets In-Reply-To and References headers automatically.
@@ -5336,7 +5340,8 @@ type EmailMessage = {
5336
5340
  */
5337
5341
  bcc?: Array<EmailAddress>;
5338
5342
  /**
5339
- * Message subject line.
5343
+ * The subject line as delivered. For a send that used a template, the stored subject is the template's, so this reports it with the send's `parameters` substituted in, which is what the recipient saw.
5344
+ *
5340
5345
  */
5341
5346
  subject: string;
5342
5347
  category: EmailMessageCategory;
@@ -5411,6 +5416,13 @@ type EmailMessage = {
5411
5416
  metadata?: {
5412
5417
  [key: string]: unknown;
5413
5418
  };
5419
+ /**
5420
+ * The substitution values this send supplied, or null for a send that carried its content inline. They are the values applied to `subject` and to the bodies the content endpoint returns, kept so you can see what produced the delivered copy and not only the result.
5421
+ *
5422
+ */
5423
+ readonly parameters?: {
5424
+ [key: string]: unknown;
5425
+ } | null;
5414
5426
  /**
5415
5427
  * Attachment metadata for the send. Empty when no attachments were included. Raw content is not echoed; when content storage is enabled, download an attachment by its `id` via the message's attachment endpoint.
5416
5428
  */
@@ -7865,6 +7877,241 @@ declare class EmailStatsResource extends Resource {
7865
7877
  byBroadcast(query?: EmailStatsByBroadcastQuery, options?: RequestOptions): APIPromise<EmailStatsByBroadcastResponse>;
7866
7878
  }
7867
7879
  //#endregion
7880
+ //#region src/resources/emailMailboxes.gen.d.ts
7881
+ type EmailMailboxesListQuery = NonNullable<ListMailboxesData["query"]>;
7882
+ type EmailMailboxesCreateParams = NonNullable<CreateMailboxData["body"]>;
7883
+ type EmailMailboxesUpdateParams = NonNullable<UpdateMailboxData["body"]>;
7884
+ type EmailMailboxesUpdateQuery = NonNullable<UpdateMailboxData["query"]>;
7885
+ type EmailMailboxesStatsQuery = NonNullable<GetMailboxStatsData["query"]>;
7886
+ declare class EmailMailboxesResource$1 extends Resource {
7887
+ /**
7888
+ * List the workspace's mailboxes as a cursor page, newest first. Search addresses and display names with q, or filter by exact address, state, or domain.
7889
+ *
7890
+ * @example List mailboxes
7891
+ * for await (const mailbox of bird.email.mailboxes.list()) {
7892
+ * console.log(mailbox.address);
7893
+ * }
7894
+ */
7895
+ list(query?: EmailMailboxesListQuery, options?: RequestOptions): PaginatedPromise<Mailbox>;
7896
+ /**
7897
+ * Create a mailbox — a durable agent identity that owns an email address, groups mail into threads, and remembers conversations for its retention tier.
7898
+ *
7899
+ * @example Create a mailbox
7900
+ * const mailbox = await bird.email.mailboxes.create({ display_name: "Support" });
7901
+ * console.log(mailbox.address); // "abc123@inbox.ai"
7902
+ */
7903
+ create(params?: EmailMailboxesCreateParams, options?: RequestOptions): APIPromise<Mailbox>;
7904
+ /**
7905
+ * @example Get a mailbox
7906
+ * const mailbox = await bird.email.mailboxes.get("mbx_01abc");
7907
+ * console.log(mailbox.state); // "active"
7908
+ */
7909
+ get(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox>;
7910
+ /**
7911
+ * Update a mailbox's display name, reply-to, receive policy, retention tier, contact, or metadata. Lowering the retention tier onto remembered messages older than the new horizon requires confirm=true.
7912
+ *
7913
+ * @example Change a mailbox's receive policy
7914
+ * const mailbox = await bird.email.mailboxes.update("mbx_01abc", {
7915
+ * receive_policy: "open",
7916
+ * });
7917
+ * console.log(mailbox.id, mailbox.receive_policy);
7918
+ */
7919
+ update(mailboxId: string, params?: EmailMailboxesUpdateParams, query?: EmailMailboxesUpdateQuery, options?: RequestOptions): APIPromise<Mailbox>;
7920
+ /**
7921
+ * Delete a mailbox. The address stops receiving immediately and is quarantined; the mailbox and its remembered messages stay restorable for 30 days via the restore endpoint, then are permanently deleted.
7922
+ *
7923
+ * @example Delete a mailbox
7924
+ * await bird.email.mailboxes.delete("mbx_01abc");
7925
+ */
7926
+ delete(mailboxId: string, options?: RequestOptions): APIPromise<void>;
7927
+ /**
7928
+ * Restore a mailbox deleted less than 30 days ago: the address starts receiving again and the remembered messages are back. Past the window the mailbox is permanently deleted and returns 404; a mailbox that is not deleted returns 409.
7929
+ *
7930
+ * @example Restore a deleted mailbox
7931
+ * const mailbox = await bird.email.mailboxes.restore("mbx_01abc");
7932
+ * console.log(mailbox.deleted_at); // null
7933
+ */
7934
+ restore(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox>;
7935
+ /**
7936
+ * Reactivate a suspended mailbox so it can send and receive again and its threads become visible. Fails if your plan does not have room for another active mailbox (or another custom inbox.ai handle); delete an active mailbox or upgrade first. A mailbox that is not suspended returns 409.
7937
+ *
7938
+ * @example Resume a suspended mailbox
7939
+ * const mailbox = await bird.email.mailboxes.resume("mbx_01abc");
7940
+ * console.log(mailbox.state); // "active"
7941
+ */
7942
+ resume(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox>;
7943
+ /**
7944
+ * @example Get mailbox stats
7945
+ * const stats = await bird.email.mailboxes.stats("mbx_01abc");
7946
+ * console.log(stats.summary?.sends_accepted);
7947
+ */
7948
+ stats(mailboxId: string, query?: EmailMailboxesStatsQuery, options?: RequestOptions): APIPromise<MailboxStatsResponse>;
7949
+ /**
7950
+ * List the labels available in a mailbox: the built-in system labels (inbox, archive, spam, blocked, sent, trash, unread) plus every custom label in use.
7951
+ *
7952
+ * @example List a mailbox's labels
7953
+ * const labels = await bird.email.mailboxes.labels("mbx_01abc");
7954
+ * console.log(labels.data.map((label) => label.name));
7955
+ */
7956
+ labels(mailboxId: string, options?: RequestOptions): APIPromise<EmailMailboxLabelList>;
7957
+ }
7958
+ //#endregion
7959
+ //#region src/resources/emailMailboxesMessages.d.ts
7960
+ /** Parameters for sending a new message from a mailbox. */
7961
+ type EmailMailboxesMessagesCreateParams = EmailMailboxComposeRequest;
7962
+ declare class EmailMailboxesMessagesResource extends Resource {
7963
+ /**
7964
+ * Send a new email from this mailbox, starting a new conversation.
7965
+ *
7966
+ * @example Send from a mailbox
7967
+ * const msg = await bird.email.mailboxes.messages.create("mbx_01abc", {
7968
+ * to: ["customer@example.com"],
7969
+ * subject: "Hello",
7970
+ * text: "Hi there!",
7971
+ * });
7972
+ */
7973
+ create(mailboxId: string, params: EmailMailboxesMessagesCreateParams, options?: RequestOptions): APIPromise<EmailThreadMessage>;
7974
+ }
7975
+ //#endregion
7976
+ //#region src/resources/emailMailboxesReceiveRules.gen.d.ts
7977
+ type EmailMailboxesReceiveRulesListQuery = NonNullable<ListMailboxReceiveRulesData["query"]>;
7978
+ type EmailMailboxesReceiveRulesCreateParams = NonNullable<CreateMailboxReceiveRuleData["body"]>;
7979
+ declare class EmailMailboxesReceiveRulesResource extends Resource {
7980
+ /**
7981
+ * List a mailbox's allow/block receive rules as a cursor page, oldest first. Filter by action.
7982
+ *
7983
+ * @example List a mailbox's receive rules
7984
+ * for await (const rule of bird.email.mailboxes.receiveRules.list("mbx_01abc")) {
7985
+ * console.log(rule.action, rule.entry);
7986
+ * }
7987
+ */
7988
+ list(mailboxId: string, query?: EmailMailboxesReceiveRulesListQuery, options?: RequestOptions): PaginatedPromise<ReceiveRule>;
7989
+ /**
7990
+ * Add an allow or block rule for a sender address or domain to a mailbox. Block always wins; up to 200 rules per mailbox.
7991
+ *
7992
+ * @example Block a domain
7993
+ * const rule = await bird.email.mailboxes.receiveRules.create("mbx_01abc", {
7994
+ * action: "block",
7995
+ * entry: "spam.example.com",
7996
+ * });
7997
+ * console.log(rule.id);
7998
+ */
7999
+ create(mailboxId: string, params: EmailMailboxesReceiveRulesCreateParams, options?: RequestOptions): APIPromise<ReceiveRule>;
8000
+ /**
8001
+ * Remove a receive rule from a mailbox. Delete-and-recreate is how an entry's action is flipped.
8002
+ *
8003
+ * @example Delete a rule
8004
+ * await bird.email.mailboxes.receiveRules.delete("mbx_01abc", "erl_01xyz");
8005
+ */
8006
+ delete(mailboxId: string, ruleId: string, options?: RequestOptions): APIPromise<void>;
8007
+ }
8008
+ //#endregion
8009
+ //#region src/resources/emailMailboxes.d.ts
8010
+ declare class EmailMailboxesResource extends EmailMailboxesResource$1 {
8011
+ /** Messages sent from the mailbox's own address — `bird.email.mailboxes.messages.create(...)`. */
8012
+ readonly messages: EmailMailboxesMessagesResource;
8013
+ /** Per-sender allow/block rules — `bird.email.mailboxes.receiveRules.create(...)`, `.list(...)`, `.delete(...)`. */
8014
+ readonly receiveRules: EmailMailboxesReceiveRulesResource;
8015
+ constructor(...args: ConstructorParameters<typeof Resource>);
8016
+ }
8017
+ //#endregion
8018
+ //#region src/resources/emailThreads.gen.d.ts
8019
+ type EmailThreadsListQuery = NonNullable<ListEmailThreadsData["query"]>;
8020
+ type EmailThreadsUpdateParams = NonNullable<UpdateEmailThreadData["body"]>;
8021
+ type EmailThreadsDeleteQuery = NonNullable<DeleteEmailThreadData["query"]>;
8022
+ declare class EmailThreadsResource$1 extends Resource {
8023
+ /**
8024
+ * List mailbox conversations as a cursor page, most recently active first. `label` selects the view — inbox (default), archive, spam, blocked, or a custom label. Filter by mailbox, contact, participant address, or subject substring.
8025
+ *
8026
+ * @example List conversation threads
8027
+ * for await (const thread of bird.email.threads.list({ mailbox_id: "mbx_01abc" })) {
8028
+ * console.log(thread.id, thread.subject);
8029
+ * }
8030
+ */
8031
+ list(query?: EmailThreadsListQuery, options?: RequestOptions): PaginatedPromise<EmailThread>;
8032
+ /**
8033
+ * Get one conversation: participants, counts, labels, read state. Fetch its messages with the thread messages endpoint.
8034
+ *
8035
+ * @example Get a thread
8036
+ * const thread = await bird.email.threads.get("thr_01abc");
8037
+ * console.log(thread.subject);
8038
+ */
8039
+ get(threadId: string, options?: RequestOptions): APIPromise<EmailThread>;
8040
+ /**
8041
+ * Add or remove labels on a conversation — adding `spam` files it as spam, adding `archive` clears it out of the inbox, adding `inbox` brings it back — or link/unlink a contact.
8042
+ *
8043
+ * @example Apply label changes to a thread
8044
+ * const thread = await bird.email.threads.update("thr_01abc", {
8045
+ * labels: { add: ["archive"] },
8046
+ * });
8047
+ * console.log(thread.id);
8048
+ */
8049
+ update(threadId: string, params?: EmailThreadsUpdateParams, options?: RequestOptions): APIPromise<EmailThread>;
8050
+ /**
8051
+ * Move a conversation and all its messages to trash (purged after 30 days), or delete permanently with ?permanent=true.
8052
+ *
8053
+ * @example Delete a thread
8054
+ * await bird.email.threads.delete("thr_01abc", { permanent: true });
8055
+ */
8056
+ delete(threadId: string, query?: EmailThreadsDeleteQuery, options?: RequestOptions): APIPromise<void>;
8057
+ }
8058
+ //#endregion
8059
+ //#region src/resources/emailThreadsMessages.gen.d.ts
8060
+ type EmailThreadsMessagesListQuery = NonNullable<ListEmailThreadMessagesData["query"]>;
8061
+ type EmailThreadsMessagesReplyParams = NonNullable<ReplyEmailThreadMessageData["body"]>;
8062
+ declare class EmailThreadsMessagesResource extends Resource {
8063
+ /**
8064
+ * List the messages in a conversation newest first, both directions. Page older messages with starting_after, and pass include=extracted_text to inline each message's durable plain text.
8065
+ *
8066
+ * @example List a thread's messages
8067
+ * for await (const msg of bird.email.threads.messages.list("thr_01abc")) {
8068
+ * console.log(msg.id, msg.direction);
8069
+ * }
8070
+ */
8071
+ list(threadId: string, query?: EmailThreadsMessagesListQuery, options?: RequestOptions): PaginatedPromise<EmailThreadMessage>;
8072
+ /**
8073
+ * Get one conversation message with its extracted plain text — readable for the mailbox's full retention period, no MIME parsing needed.
8074
+ *
8075
+ * @example Get a message
8076
+ * const msg = await bird.email.threads.messages.get("thr_01abc", "rem_01xyz");
8077
+ * console.log(msg.direction); // "inbound"
8078
+ */
8079
+ get(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessage>;
8080
+ /**
8081
+ * Get the original rendered HTML and plain-text body of a conversation message. Available 30 days; after that use the message's extracted_text.
8082
+ *
8083
+ * @example Get a message body
8084
+ * const body = await bird.email.threads.messages.body("thr_01abc", "rem_01xyz");
8085
+ * console.log(body.text);
8086
+ */
8087
+ body(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessageBody>;
8088
+ /**
8089
+ * Reply to a specific conversation message from the mailbox's own address. To reply to a conversation, target its newest received message. Recipients, subject, and threading headers are derived automatically.
8090
+ *
8091
+ * @example Reply to a message
8092
+ * const reply = await bird.email.threads.messages.reply("thr_01abc", "rem_01xyz", {
8093
+ * text: "Thanks for reaching out!",
8094
+ * });
8095
+ * console.log(reply.id);
8096
+ */
8097
+ reply(threadId: string, messageId: string, params?: EmailThreadsMessagesReplyParams, options?: RequestOptions): APIPromise<EmailThreadMessage>;
8098
+ /**
8099
+ * List the attachments on a conversation message. Bytes are downloadable for 30 days; the metadata also rides the message's attachment_manifest durably.
8100
+ *
8101
+ * @example List a message's attachments
8102
+ * const atts = await bird.email.threads.messages.attachments("thr_01abc", "rem_01xyz");
8103
+ * console.log(atts.data.map((a) => a.filename));
8104
+ */
8105
+ attachments(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessageAttachmentList>;
8106
+ }
8107
+ //#endregion
8108
+ //#region src/resources/emailThreads.d.ts
8109
+ declare class EmailThreadsResource extends EmailThreadsResource$1 {
8110
+ /** Messages in a conversation — `bird.email.threads.messages.list(...)`, `.reply(...)`, … */
8111
+ readonly messages: EmailThreadsMessagesResource;
8112
+ constructor(...args: ConstructorParameters<typeof Resource>);
8113
+ }
8114
+ //#endregion
7868
8115
  //#region src/resources/email.d.ts
7869
8116
  /** Body for `bird.email.send`. */
7870
8117
  type EmailSendParams = EmailMessageSendRequest;
@@ -7889,6 +8136,10 @@ declare class EmailResource<D extends EmailChannelDefaults | undefined = undefin
7889
8136
  #private;
7890
8137
  /** Email statistics — `bird.email.stats.summary(...)`, `.daily(...)`, `.byTag(...)`, … */
7891
8138
  readonly stats: EmailStatsResource;
8139
+ /** Durable agent mailboxes — `bird.email.mailboxes.list(...)`, `.create(...)`, … */
8140
+ readonly mailboxes: EmailMailboxesResource;
8141
+ /** Conversations across every mailbox — `bird.email.threads.list(...)`, `.get(...)`, … */
8142
+ readonly threads: EmailThreadsResource;
7892
8143
  constructor(core: ConstructorParameters<typeof Resource>[0], client: ConstructorParameters<typeof Resource>[1], defaults?: D);
7893
8144
  /**
7894
8145
  * Send an email message. Resolves once the message is accepted for delivery
@@ -8473,225 +8724,6 @@ declare class WebhooksResource {
8473
8724
  unwrap(payload: string, headers: WebhookHeaders, options?: WebhookOptions): BirdWebhookEvent;
8474
8725
  }
8475
8726
  //#endregion
8476
- //#region src/resources/mailbox.gen.d.ts
8477
- type MailboxListQuery = NonNullable<ListMailboxesData["query"]>;
8478
- type MailboxCreateParams = NonNullable<CreateMailboxData["body"]>;
8479
- type MailboxUpdateParams = NonNullable<UpdateMailboxData["body"]>;
8480
- type MailboxUpdateQuery = NonNullable<UpdateMailboxData["query"]>;
8481
- type MailboxStatsQuery = NonNullable<GetMailboxStatsData["query"]>;
8482
- declare class MailboxResourceBase extends Resource {
8483
- /**
8484
- * List the workspace's mailboxes as a cursor page, newest first. Search addresses and display names with q, or filter by exact address, state, or domain.
8485
- *
8486
- * @example List mailboxes
8487
- * for await (const mailbox of bird.mailbox.list()) {
8488
- * console.log(mailbox.address);
8489
- * }
8490
- */
8491
- list(query?: MailboxListQuery, options?: RequestOptions): PaginatedPromise<Mailbox>;
8492
- /**
8493
- * Create a mailbox — a durable agent identity that owns an email address, groups mail into threads, and remembers conversations for its retention tier.
8494
- *
8495
- * @example Create a mailbox
8496
- * const mailbox = await bird.mailbox.create({ display_name: "Support" });
8497
- * console.log(mailbox.address); // "abc123@inbox.ai"
8498
- */
8499
- create(params?: MailboxCreateParams, options?: RequestOptions): APIPromise<Mailbox>;
8500
- /**
8501
- * @example Get a mailbox
8502
- * const mailbox = await bird.mailbox.get("mbx_01abc");
8503
- * console.log(mailbox.state); // "active"
8504
- */
8505
- get(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox>;
8506
- /**
8507
- * Update a mailbox's display name, reply-to, receive policy, retention tier, contact, or metadata. Lowering the retention tier onto remembered messages older than the new horizon requires confirm=true.
8508
- *
8509
- * @example Change a mailbox's receive policy
8510
- * const mailbox = await bird.mailbox.update("mbx_01abc", {
8511
- * receive_policy: "open",
8512
- * });
8513
- * console.log(mailbox.id, mailbox.receive_policy);
8514
- */
8515
- update(mailboxId: string, params?: MailboxUpdateParams, query?: MailboxUpdateQuery, options?: RequestOptions): APIPromise<Mailbox>;
8516
- /**
8517
- * Delete a mailbox. The address stops receiving immediately and is quarantined; the mailbox and its remembered messages stay restorable for 30 days via the restore endpoint, then are permanently deleted.
8518
- *
8519
- * @example Delete a mailbox
8520
- * await bird.mailbox.delete("mbx_01abc");
8521
- */
8522
- delete(mailboxId: string, options?: RequestOptions): APIPromise<void>;
8523
- /**
8524
- * Restore a mailbox deleted less than 30 days ago: the address starts receiving again and the remembered messages are back. Past the window the mailbox is permanently deleted and returns 404; a mailbox that is not deleted returns 409.
8525
- *
8526
- * @example Restore a deleted mailbox
8527
- * const mailbox = await bird.mailbox.restore("mbx_01abc");
8528
- * console.log(mailbox.deleted_at); // null
8529
- */
8530
- restore(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox>;
8531
- /**
8532
- * Reactivate a suspended mailbox so it can send and receive again and its threads become visible. Fails if your plan does not have room for another active mailbox (or another custom inbox.ai handle); delete an active mailbox or upgrade first. A mailbox that is not suspended returns 409.
8533
- *
8534
- * @example Resume a suspended mailbox
8535
- * const mailbox = await bird.mailbox.resume("mbx_01abc");
8536
- * console.log(mailbox.state); // "active"
8537
- */
8538
- resume(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox>;
8539
- /**
8540
- * @example Get mailbox stats
8541
- * const stats = await bird.mailbox.stats("mbx_01abc");
8542
- * console.log(stats.summary?.sends_accepted);
8543
- */
8544
- stats(mailboxId: string, query?: MailboxStatsQuery, options?: RequestOptions): APIPromise<MailboxStatsResponse>;
8545
- /**
8546
- * List the labels available in a mailbox: the built-in system labels (inbox, archive, spam, blocked, sent, trash, unread) plus every custom label in use.
8547
- *
8548
- * @example List a mailbox's labels
8549
- * const labels = await bird.mailbox.labels("mbx_01abc");
8550
- * console.log(labels.data.map((label) => label.name));
8551
- */
8552
- labels(mailboxId: string, options?: RequestOptions): APIPromise<EmailMailboxLabelList>;
8553
- }
8554
- //#endregion
8555
- //#region src/resources/mailbox.d.ts
8556
- /** Parameters for composing a new message from a mailbox. */
8557
- type MailboxComposeParams = EmailMailboxComposeRequest;
8558
- declare class MailboxResource extends MailboxResourceBase {
8559
- /**
8560
- * Send a new email from this mailbox, starting a new conversation.
8561
- *
8562
- * @example Send from a mailbox
8563
- * const msg = await bird.mailbox.compose("mbx_01abc", {
8564
- * to: ["customer@example.com"],
8565
- * subject: "Hello",
8566
- * text: "Hi there!",
8567
- * });
8568
- */
8569
- compose(mailboxId: string, params: MailboxComposeParams, options?: RequestOptions): APIPromise<EmailThreadMessage>;
8570
- }
8571
- //#endregion
8572
- //#region src/resources/mailboxReceiveRule.gen.d.ts
8573
- type MailboxReceiveRuleListQuery = NonNullable<ListMailboxReceiveRulesData["query"]>;
8574
- type MailboxReceiveRuleCreateParams = NonNullable<CreateMailboxReceiveRuleData["body"]>;
8575
- declare class MailboxReceiveRuleResource extends Resource {
8576
- /**
8577
- * List a mailbox's allow/block receive rules as a cursor page, oldest first. Filter by action.
8578
- *
8579
- * @example List a mailbox's receive rules
8580
- * for await (const rule of bird.mailboxReceiveRule.list("mbx_01abc")) {
8581
- * console.log(rule.action, rule.entry);
8582
- * }
8583
- */
8584
- list(mailboxId: string, query?: MailboxReceiveRuleListQuery, options?: RequestOptions): PaginatedPromise<ReceiveRule>;
8585
- /**
8586
- * Add an allow or block rule for a sender address or domain to a mailbox. Block always wins; up to 200 rules per mailbox.
8587
- *
8588
- * @example Block a domain
8589
- * const rule = await bird.mailboxReceiveRule.create("mbx_01abc", {
8590
- * action: "block",
8591
- * entry: "spam.example.com",
8592
- * });
8593
- * console.log(rule.id);
8594
- */
8595
- create(mailboxId: string, params: MailboxReceiveRuleCreateParams, options?: RequestOptions): APIPromise<ReceiveRule>;
8596
- /**
8597
- * Remove a receive rule from a mailbox. Delete-and-recreate is how an entry's action is flipped.
8598
- *
8599
- * @example Delete a rule
8600
- * await bird.mailboxReceiveRule.delete("mbx_01abc", "erl_01xyz");
8601
- */
8602
- delete(mailboxId: string, ruleId: string, options?: RequestOptions): APIPromise<void>;
8603
- }
8604
- //#endregion
8605
- //#region src/resources/mailboxThread.gen.d.ts
8606
- type MailboxThreadListQuery = NonNullable<ListEmailThreadsData["query"]>;
8607
- type MailboxThreadUpdateParams = NonNullable<UpdateEmailThreadData["body"]>;
8608
- type MailboxThreadDeleteQuery = NonNullable<DeleteEmailThreadData["query"]>;
8609
- declare class MailboxThreadResource extends Resource {
8610
- /**
8611
- * List mailbox conversations as a cursor page, most recently active first. `label` selects the view — inbox (default), archive, spam, blocked, or a custom label. Filter by mailbox, contact, participant address, or subject substring.
8612
- *
8613
- * @example List conversation threads
8614
- * for await (const thread of bird.mailboxThread.list({ mailbox_id: "mbx_01abc" })) {
8615
- * console.log(thread.id, thread.subject);
8616
- * }
8617
- */
8618
- list(query?: MailboxThreadListQuery, options?: RequestOptions): PaginatedPromise<EmailThread>;
8619
- /**
8620
- * Get one conversation: participants, counts, labels, read state. Fetch its messages with the thread messages endpoint.
8621
- *
8622
- * @example Get a thread
8623
- * const thread = await bird.mailboxThread.get("thr_01abc");
8624
- * console.log(thread.subject);
8625
- */
8626
- get(threadId: string, options?: RequestOptions): APIPromise<EmailThread>;
8627
- /**
8628
- * Add or remove labels on a conversation — adding `spam` files it as spam, adding `archive` clears it out of the inbox, adding `inbox` brings it back — or link/unlink a contact.
8629
- *
8630
- * @example Apply label changes to a thread
8631
- * const thread = await bird.mailboxThread.update("thr_01abc", {
8632
- * labels: { add: ["archive"] },
8633
- * });
8634
- * console.log(thread.id);
8635
- */
8636
- update(threadId: string, params?: MailboxThreadUpdateParams, options?: RequestOptions): APIPromise<EmailThread>;
8637
- /**
8638
- * Move a conversation and all its messages to trash (purged after 30 days), or delete permanently with ?permanent=true.
8639
- *
8640
- * @example Delete a thread
8641
- * await bird.mailboxThread.delete("thr_01abc", { permanent: true });
8642
- */
8643
- delete(threadId: string, query?: MailboxThreadDeleteQuery, options?: RequestOptions): APIPromise<void>;
8644
- }
8645
- //#endregion
8646
- //#region src/resources/mailboxThreadMessage.gen.d.ts
8647
- type MailboxThreadMessageListQuery = NonNullable<ListEmailThreadMessagesData["query"]>;
8648
- type MailboxThreadMessageReplyParams = NonNullable<ReplyEmailThreadMessageData["body"]>;
8649
- declare class MailboxThreadMessageResource extends Resource {
8650
- /**
8651
- * List the messages in a conversation newest first, both directions. Page older messages with starting_after, and pass include=extracted_text to inline each message's durable plain text.
8652
- *
8653
- * @example List a thread's messages
8654
- * for await (const msg of bird.mailboxThreadMessage.list("thr_01abc")) {
8655
- * console.log(msg.id, msg.direction);
8656
- * }
8657
- */
8658
- list(threadId: string, query?: MailboxThreadMessageListQuery, options?: RequestOptions): PaginatedPromise<EmailThreadMessage>;
8659
- /**
8660
- * Get one conversation message with its extracted plain text — readable for the mailbox's full retention period, no MIME parsing needed.
8661
- *
8662
- * @example Get a message
8663
- * const msg = await bird.mailboxThreadMessage.get("thr_01abc", "rem_01xyz");
8664
- * console.log(msg.direction); // "inbound"
8665
- */
8666
- get(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessage>;
8667
- /**
8668
- * Get the original rendered HTML and plain-text body of a conversation message. Available 30 days; after that use the message's extracted_text.
8669
- *
8670
- * @example Get a message body
8671
- * const body = await bird.mailboxThreadMessage.body("thr_01abc", "rem_01xyz");
8672
- * console.log(body.text);
8673
- */
8674
- body(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessageBody>;
8675
- /**
8676
- * Reply to a specific conversation message from the mailbox's own address. To reply to a conversation, target its newest received message. Recipients, subject, and threading headers are derived automatically.
8677
- *
8678
- * @example Reply to a message
8679
- * const reply = await bird.mailboxThreadMessage.reply("thr_01abc", "rem_01xyz", {
8680
- * text: "Thanks for reaching out!",
8681
- * });
8682
- * console.log(reply.id);
8683
- */
8684
- reply(threadId: string, messageId: string, params?: MailboxThreadMessageReplyParams, options?: RequestOptions): APIPromise<EmailThreadMessage>;
8685
- /**
8686
- * List the attachments on a conversation message. Bytes are downloadable for 30 days; the metadata also rides the message's attachment_manifest durably.
8687
- *
8688
- * @example List a message's attachments
8689
- * const atts = await bird.mailboxThreadMessage.attachments("thr_01abc", "rem_01xyz");
8690
- * console.log(atts.data.map((a) => a.filename));
8691
- */
8692
- attachments(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessageAttachmentList>;
8693
- }
8694
- //#endregion
8695
8727
  //#region src/resources/realtime.d.ts
8696
8728
  /** Body for `bird.realtime.publish` — one event to one or more channels. */
8697
8729
  type RealtimePublishParams = RealtimePublish;
@@ -8932,14 +8964,6 @@ declare class BirdClient<const O extends BirdClientOptions = BirdClientOptions>
8932
8964
  readonly domains: DomainsResource;
8933
8965
  /** Webhooks — `bird.webhooks.unwrap(payload, headers)` verifies an inbound delivery. */
8934
8966
  readonly webhooks: WebhooksResource;
8935
- /** Agent mailboxes — `bird.mailbox.create(...)`, `.compose(...)`, `.list(...)`, … */
8936
- readonly mailbox: MailboxResource;
8937
- /** Mailbox receive rules — `bird.mailboxReceiveRule.create(...)`, `.delete(...)`, `.list(...)`. */
8938
- readonly mailboxReceiveRule: MailboxReceiveRuleResource;
8939
- /** Mailbox threads — `bird.mailboxThread.list(...)`, `.get(...)`, `.update(...)`, `.delete(...)`. */
8940
- readonly mailboxThread: MailboxThreadResource;
8941
- /** Thread messages — `bird.mailboxThreadMessage.list(...)`, `.get(...)`, `.reply(...)`, `.body(...)`, … */
8942
- readonly mailboxThreadMessage: MailboxThreadMessageResource;
8943
8967
  /** Realtime — `bird.realtime.publish(...)`, `.channels.list(...)`, `.members.disconnect(...)`, … */
8944
8968
  readonly realtime: RealtimeResource;
8945
8969
  constructor(options: O);
@@ -9024,5 +9048,5 @@ declare const WebhookEventType: {
9024
9048
  /** A known webhook event type value. */
9025
9049
  type WebhookEventTypeValue = (typeof WebhookEventType)[keyof typeof WebhookEventType];
9026
9050
  //#endregion
9027
- export { type APIPromise, type Audience, type AudienceAddContactsParams, type AudienceCreateParams, type AudienceListContactsQuery, type AudienceListQuery, type AudienceMember, type AudienceRemoveContactsParams, type AudienceUpdateParams, BirdAPIError, BirdAuthError, BirdBadRequestError, BirdBillingError, BirdClient, type BirdClientOptions, BirdConflictError, BirdConnectionError, BirdError, BirdInternalError, BirdMisdirectedError, BirdNotFoundError, BirdNotImplementedError, BirdPayloadTooLargeError, BirdPermissionError, BirdPreconditionError, BirdRateLimitError, type BirdRequest, type BirdResponse, BirdServiceUnavailableError, BirdTimeoutError, BirdValidationError, type BirdWebhookEvent, BirdWebhookVerificationError, type Contact, type ContactBatchParams, type ContactCreateParams, type ContactListQuery, type ContactProperty, type ContactPropertyCreateParams, type ContactPropertyListQuery, type ContactPropertyUpdateParams, type ContactUpdateParams, type ContactUpsertResult, type CursorPage, type DnsRecord, type Domain, type DomainCapabilities, type DomainCreateParams, type DomainDkim, type DomainListQuery, type DomainUpdateParams, type EmailChannelDefaults, type EmailListQuery, type EmailMailboxLabelList, type EmailMessage, type EmailSendBatchParams, type EmailSendBatchResult, type EmailSendParams, type EmailStatsByBounceCodeQuery, type EmailStatsByBounceCodeResponse, type EmailStatsByBroadcastQuery, type EmailStatsByBroadcastResponse, type EmailStatsByCategoryQuery, type EmailStatsByCategoryResponse, type EmailStatsByClientQuery, type EmailStatsByClientResponse, type EmailStatsByComplaintTypeQuery, type EmailStatsByComplaintTypeResponse, type EmailStatsByLocationQuery, type EmailStatsByLocationResponse, type EmailStatsByMailboxProviderQuery, type EmailStatsByMailboxProviderRegionQuery, type EmailStatsByMailboxProviderRegionResponse, type EmailStatsByMailboxProviderResponse, type EmailStatsByRecipientDomainQuery, type EmailStatsByRecipientDomainResponse, type EmailStatsBySendingDomainQuery, type EmailStatsBySendingDomainResponse, type EmailStatsBySendingIpQuery, type EmailStatsBySendingIpResponse, type EmailStatsByTagQuery, type EmailStatsByTemplateQuery, type EmailStatsByTemplateResponse, type EmailStatsDailyQuery, type EmailStatsHourlyQuery, type EmailStatsResponse, type EmailStatsSummary, type EmailStatsSummaryQuery, type EmailStatsTagsResponse, type EmailThread, type EmailThreadMessage, type EmailThreadMessageAttachmentList, type EmailThreadMessageBody, type ErrorDetail, type ErrorNextAction, type Mailbox, type MailboxComposeParams, type MailboxCreateParams, type MailboxListQuery, type MailboxReceiveRuleCreateParams, type MailboxReceiveRuleListQuery, type MailboxStatsResponse, type MailboxThreadDeleteQuery, type MailboxThreadListQuery, type MailboxThreadMessageListQuery, type MailboxThreadMessageReplyParams, type MailboxThreadUpdateParams, type MailboxUpdateParams, type PaginatedPromise, type RealtimeBatchPublishParams, type RealtimeBatchPublishResult, type RealtimeChannelGetQuery, type RealtimeChannelInclude, type RealtimeChannelInfo, type RealtimeChannelListItem, type RealtimeChannelMember, type RealtimeChannelMembers, type RealtimeChannelsList, type RealtimeChannelsListQuery, type RealtimeOptions, type RealtimePublishParams, type RealtimePublishResult, type RealtimeRequestOptions, type ReceiveRule, type RequestOptions, type SafeResult, type SmsListQuery, type SmsMessage, type SmsSendBatchParams, type SmsSendBatchResult, type SmsSendParams, type SmsTemplate, type SmsTemplateList, type SmsTemplateListQuery, type UnmetGate, type Verification, type VerificationCheckResult, type VerifyVerificationsCheckParams, type VerifyVerificationsCreateParams, WebhookEventType, type WebhookEventTypeValue, type WebhookHeaders, type WebhookOptions, type WhatsAppEventList, type WhatsAppMessage, type WhatsappListEventsQuery, type WhatsappListQuery, type WhatsappSendParams, baseUrlForRegion, regionFromApiKey };
9051
+ export { type APIPromise, type Audience, type AudienceAddContactsParams, type AudienceCreateParams, type AudienceListContactsQuery, type AudienceListQuery, type AudienceMember, type AudienceRemoveContactsParams, type AudienceUpdateParams, BirdAPIError, BirdAuthError, BirdBadRequestError, BirdBillingError, BirdClient, type BirdClientOptions, BirdConflictError, BirdConnectionError, BirdError, BirdInternalError, BirdMisdirectedError, BirdNotFoundError, BirdNotImplementedError, BirdPayloadTooLargeError, BirdPermissionError, BirdPreconditionError, BirdRateLimitError, type BirdRequest, type BirdResponse, BirdServiceUnavailableError, BirdTimeoutError, BirdValidationError, type BirdWebhookEvent, BirdWebhookVerificationError, type Contact, type ContactBatchParams, type ContactCreateParams, type ContactListQuery, type ContactProperty, type ContactPropertyCreateParams, type ContactPropertyListQuery, type ContactPropertyUpdateParams, type ContactUpdateParams, type ContactUpsertResult, type CursorPage, type DnsRecord, type Domain, type DomainCapabilities, type DomainCreateParams, type DomainDkim, type DomainListQuery, type DomainUpdateParams, type EmailChannelDefaults, type EmailListQuery, type EmailMailboxLabelList, type EmailMailboxesCreateParams, type EmailMailboxesListQuery, type EmailMailboxesMessagesCreateParams, type EmailMailboxesReceiveRulesCreateParams, type EmailMailboxesReceiveRulesListQuery, type EmailMailboxesStatsQuery, type EmailMailboxesUpdateParams, type EmailMailboxesUpdateQuery, type EmailMessage, type EmailSendBatchParams, type EmailSendBatchResult, type EmailSendParams, type EmailStatsByBounceCodeQuery, type EmailStatsByBounceCodeResponse, type EmailStatsByBroadcastQuery, type EmailStatsByBroadcastResponse, type EmailStatsByCategoryQuery, type EmailStatsByCategoryResponse, type EmailStatsByClientQuery, type EmailStatsByClientResponse, type EmailStatsByComplaintTypeQuery, type EmailStatsByComplaintTypeResponse, type EmailStatsByLocationQuery, type EmailStatsByLocationResponse, type EmailStatsByMailboxProviderQuery, type EmailStatsByMailboxProviderRegionQuery, type EmailStatsByMailboxProviderRegionResponse, type EmailStatsByMailboxProviderResponse, type EmailStatsByRecipientDomainQuery, type EmailStatsByRecipientDomainResponse, type EmailStatsBySendingDomainQuery, type EmailStatsBySendingDomainResponse, type EmailStatsBySendingIpQuery, type EmailStatsBySendingIpResponse, type EmailStatsByTagQuery, type EmailStatsByTemplateQuery, type EmailStatsByTemplateResponse, type EmailStatsDailyQuery, type EmailStatsHourlyQuery, type EmailStatsResponse, type EmailStatsSummary, type EmailStatsSummaryQuery, type EmailStatsTagsResponse, type EmailThread, type EmailThreadMessage, type EmailThreadMessageAttachmentList, type EmailThreadMessageBody, type EmailThreadsDeleteQuery, type EmailThreadsListQuery, type EmailThreadsMessagesListQuery, type EmailThreadsMessagesReplyParams, type EmailThreadsUpdateParams, type ErrorDetail, type ErrorNextAction, type Mailbox, type MailboxStatsResponse, type PaginatedPromise, type RealtimeBatchPublishParams, type RealtimeBatchPublishResult, type RealtimeChannelGetQuery, type RealtimeChannelInclude, type RealtimeChannelInfo, type RealtimeChannelListItem, type RealtimeChannelMember, type RealtimeChannelMembers, type RealtimeChannelsList, type RealtimeChannelsListQuery, type RealtimeOptions, type RealtimePublishParams, type RealtimePublishResult, type RealtimeRequestOptions, type ReceiveRule, type RequestOptions, type SafeResult, type SmsListQuery, type SmsMessage, type SmsSendBatchParams, type SmsSendBatchResult, type SmsSendParams, type SmsTemplate, type SmsTemplateList, type SmsTemplateListQuery, type UnmetGate, type Verification, type VerificationCheckResult, type VerifyVerificationsCheckParams, type VerifyVerificationsCreateParams, WebhookEventType, type WebhookEventTypeValue, type WebhookHeaders, type WebhookOptions, type WhatsAppEventList, type WhatsAppMessage, type WhatsappListEventsQuery, type WhatsappListQuery, type WhatsappSendParams, baseUrlForRegion, regionFromApiKey };
9028
9052
  //# sourceMappingURL=index.d.mts.map