@messagebird/sdk 0.14.0 → 0.16.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
@@ -4251,15 +4251,15 @@ type WhatsAppMessageTemplateComponent = {
4251
4251
  */
4252
4252
  type WhatsAppLanguage = string;
4253
4253
  /**
4254
- * A WhatsApp template's name the stable handle used to reference the template when sending. Lowercase letters, numbers, and underscores.
4254
+ * A template's slug: its permanent, workspace-unique handle and API address. Lowercase letters, numbers, hyphens, and underscores. Fixed at creation, so anything that references it never breaks; the display name is the label to change freely.
4255
4255
  *
4256
4256
  */
4257
- type WhatsAppTemplateName = string;
4257
+ type TemplateSlug = string;
4258
4258
  type WhatsAppTemplateSend = {
4259
4259
  /**
4260
- * The template to send, by its name (for example `bird_otp`).
4260
+ * The template to send, by its slug (for example `bird_otp`).
4261
4261
  */
4262
- name: WhatsAppTemplateName;
4262
+ slug: TemplateSlug;
4263
4263
  /**
4264
4264
  * Language code of the template variant to send (for example `en` or `pt_BR`). May be omitted when the template has a single language; when it is stocked in several, omitting the language returns a `422` that names the available codes. The accepted message echoes the resolved language.
4265
4265
  *
@@ -4296,14 +4296,14 @@ type WhatsAppMessageStatus = "scheduled" | "accepted" | "sent" | "delivered" | "
4296
4296
  */
4297
4297
  type WhatsAppTemplateCategory = string;
4298
4298
  /**
4299
- * The template a message was sent from. On reads `name`, `language`, `category`, and `components` are always present; `components` is an empty array for an authentication template (the filled-in values, for example a verification code, are never returned).
4299
+ * The template a message was sent from. On reads `slug`, `language`, `category`, and `components` are always present; `components` is an empty array for an authentication template (the filled-in values, for example a verification code, are never returned).
4300
4300
  *
4301
4301
  */
4302
4302
  type WhatsAppMessageTemplate = {
4303
4303
  /**
4304
4304
  * The template's stable handle (for example `bird_otp`).
4305
4305
  */
4306
- readonly name: WhatsAppTemplateName;
4306
+ readonly slug: TemplateSlug;
4307
4307
  /**
4308
4308
  * Content classification applied to messages sent from this template.
4309
4309
  */
@@ -5130,11 +5130,6 @@ type EmailMessageBatchRequest = Array<EmailMessageSendRequest>;
5130
5130
  * A language tag in BCP-47 form, for example `en` or `pt-BR`.
5131
5131
  */
5132
5132
  type LanguageTag = string;
5133
- /**
5134
- * A template's slug: its permanent, workspace-unique handle and API address. Lowercase letters, numbers, hyphens, and underscores. Fixed at creation, so anything that references it never breaks; the display name is the label to change freely.
5135
- *
5136
- */
5137
- type TemplateSlug = string;
5138
5133
  type EmailTemplateSend = unknown & {
5139
5134
  /**
5140
5135
  * The template to send, by its id.
@@ -5145,7 +5140,7 @@ type EmailTemplateSend = unknown & {
5145
5140
  */
5146
5141
  slug?: TemplateSlug;
5147
5142
  /**
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.
5143
+ * 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
5144
  *
5150
5145
  */
5151
5146
  language?: LanguageTag;
@@ -5235,6 +5230,10 @@ type EmailMessageSendRequest = {
5235
5230
  *
5236
5231
  */
5237
5232
  ip_pool_id?: string;
5233
+ /**
5234
+ * 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`.
5235
+ *
5236
+ */
5238
5237
  category?: EmailMessageCategory;
5239
5238
  /**
5240
5239
  * 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 +5335,8 @@ type EmailMessage = {
5336
5335
  */
5337
5336
  bcc?: Array<EmailAddress>;
5338
5337
  /**
5339
- * Message subject line.
5338
+ * 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.
5339
+ *
5340
5340
  */
5341
5341
  subject: string;
5342
5342
  category: EmailMessageCategory;
@@ -5411,6 +5411,13 @@ type EmailMessage = {
5411
5411
  metadata?: {
5412
5412
  [key: string]: unknown;
5413
5413
  };
5414
+ /**
5415
+ * 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.
5416
+ *
5417
+ */
5418
+ readonly parameters?: {
5419
+ [key: string]: unknown;
5420
+ } | null;
5414
5421
  /**
5415
5422
  * 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
5423
  */
@@ -7865,6 +7872,241 @@ declare class EmailStatsResource extends Resource {
7865
7872
  byBroadcast(query?: EmailStatsByBroadcastQuery, options?: RequestOptions): APIPromise<EmailStatsByBroadcastResponse>;
7866
7873
  }
7867
7874
  //#endregion
7875
+ //#region src/resources/emailMailboxes.gen.d.ts
7876
+ type EmailMailboxesListQuery = NonNullable<ListMailboxesData["query"]>;
7877
+ type EmailMailboxesCreateParams = NonNullable<CreateMailboxData["body"]>;
7878
+ type EmailMailboxesUpdateParams = NonNullable<UpdateMailboxData["body"]>;
7879
+ type EmailMailboxesUpdateQuery = NonNullable<UpdateMailboxData["query"]>;
7880
+ type EmailMailboxesStatsQuery = NonNullable<GetMailboxStatsData["query"]>;
7881
+ declare class EmailMailboxesResource$1 extends Resource {
7882
+ /**
7883
+ * 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.
7884
+ *
7885
+ * @example List mailboxes
7886
+ * for await (const mailbox of bird.email.mailboxes.list()) {
7887
+ * console.log(mailbox.address);
7888
+ * }
7889
+ */
7890
+ list(query?: EmailMailboxesListQuery, options?: RequestOptions): PaginatedPromise<Mailbox>;
7891
+ /**
7892
+ * Create a mailbox — a durable agent identity that owns an email address, groups mail into threads, and remembers conversations for its retention tier.
7893
+ *
7894
+ * @example Create a mailbox
7895
+ * const mailbox = await bird.email.mailboxes.create({ display_name: "Support" });
7896
+ * console.log(mailbox.address); // "abc123@inbox.ai"
7897
+ */
7898
+ create(params?: EmailMailboxesCreateParams, options?: RequestOptions): APIPromise<Mailbox>;
7899
+ /**
7900
+ * @example Get a mailbox
7901
+ * const mailbox = await bird.email.mailboxes.get("mbx_01abc");
7902
+ * console.log(mailbox.state); // "active"
7903
+ */
7904
+ get(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox>;
7905
+ /**
7906
+ * 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.
7907
+ *
7908
+ * @example Change a mailbox's receive policy
7909
+ * const mailbox = await bird.email.mailboxes.update("mbx_01abc", {
7910
+ * receive_policy: "open",
7911
+ * });
7912
+ * console.log(mailbox.id, mailbox.receive_policy);
7913
+ */
7914
+ update(mailboxId: string, params?: EmailMailboxesUpdateParams, query?: EmailMailboxesUpdateQuery, options?: RequestOptions): APIPromise<Mailbox>;
7915
+ /**
7916
+ * 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.
7917
+ *
7918
+ * @example Delete a mailbox
7919
+ * await bird.email.mailboxes.delete("mbx_01abc");
7920
+ */
7921
+ delete(mailboxId: string, options?: RequestOptions): APIPromise<void>;
7922
+ /**
7923
+ * 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.
7924
+ *
7925
+ * @example Restore a deleted mailbox
7926
+ * const mailbox = await bird.email.mailboxes.restore("mbx_01abc");
7927
+ * console.log(mailbox.deleted_at); // null
7928
+ */
7929
+ restore(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox>;
7930
+ /**
7931
+ * 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.
7932
+ *
7933
+ * @example Resume a suspended mailbox
7934
+ * const mailbox = await bird.email.mailboxes.resume("mbx_01abc");
7935
+ * console.log(mailbox.state); // "active"
7936
+ */
7937
+ resume(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox>;
7938
+ /**
7939
+ * @example Get mailbox stats
7940
+ * const stats = await bird.email.mailboxes.stats("mbx_01abc");
7941
+ * console.log(stats.summary?.sends_accepted);
7942
+ */
7943
+ stats(mailboxId: string, query?: EmailMailboxesStatsQuery, options?: RequestOptions): APIPromise<MailboxStatsResponse>;
7944
+ /**
7945
+ * 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.
7946
+ *
7947
+ * @example List a mailbox's labels
7948
+ * const labels = await bird.email.mailboxes.labels("mbx_01abc");
7949
+ * console.log(labels.data.map((label) => label.name));
7950
+ */
7951
+ labels(mailboxId: string, options?: RequestOptions): APIPromise<EmailMailboxLabelList>;
7952
+ }
7953
+ //#endregion
7954
+ //#region src/resources/emailMailboxesMessages.d.ts
7955
+ /** Parameters for sending a new message from a mailbox. */
7956
+ type EmailMailboxesMessagesCreateParams = EmailMailboxComposeRequest;
7957
+ declare class EmailMailboxesMessagesResource extends Resource {
7958
+ /**
7959
+ * Send a new email from this mailbox, starting a new conversation.
7960
+ *
7961
+ * @example Send from a mailbox
7962
+ * const msg = await bird.email.mailboxes.messages.create("mbx_01abc", {
7963
+ * to: ["customer@example.com"],
7964
+ * subject: "Hello",
7965
+ * text: "Hi there!",
7966
+ * });
7967
+ */
7968
+ create(mailboxId: string, params: EmailMailboxesMessagesCreateParams, options?: RequestOptions): APIPromise<EmailThreadMessage>;
7969
+ }
7970
+ //#endregion
7971
+ //#region src/resources/emailMailboxesReceiveRules.gen.d.ts
7972
+ type EmailMailboxesReceiveRulesListQuery = NonNullable<ListMailboxReceiveRulesData["query"]>;
7973
+ type EmailMailboxesReceiveRulesCreateParams = NonNullable<CreateMailboxReceiveRuleData["body"]>;
7974
+ declare class EmailMailboxesReceiveRulesResource extends Resource {
7975
+ /**
7976
+ * List a mailbox's allow/block receive rules as a cursor page, oldest first. Filter by action.
7977
+ *
7978
+ * @example List a mailbox's receive rules
7979
+ * for await (const rule of bird.email.mailboxes.receiveRules.list("mbx_01abc")) {
7980
+ * console.log(rule.action, rule.entry);
7981
+ * }
7982
+ */
7983
+ list(mailboxId: string, query?: EmailMailboxesReceiveRulesListQuery, options?: RequestOptions): PaginatedPromise<ReceiveRule>;
7984
+ /**
7985
+ * Add an allow or block rule for a sender address or domain to a mailbox. Block always wins; up to 200 rules per mailbox.
7986
+ *
7987
+ * @example Block a domain
7988
+ * const rule = await bird.email.mailboxes.receiveRules.create("mbx_01abc", {
7989
+ * action: "block",
7990
+ * entry: "spam.example.com",
7991
+ * });
7992
+ * console.log(rule.id);
7993
+ */
7994
+ create(mailboxId: string, params: EmailMailboxesReceiveRulesCreateParams, options?: RequestOptions): APIPromise<ReceiveRule>;
7995
+ /**
7996
+ * Remove a receive rule from a mailbox. Delete-and-recreate is how an entry's action is flipped.
7997
+ *
7998
+ * @example Delete a rule
7999
+ * await bird.email.mailboxes.receiveRules.delete("mbx_01abc", "erl_01xyz");
8000
+ */
8001
+ delete(mailboxId: string, ruleId: string, options?: RequestOptions): APIPromise<void>;
8002
+ }
8003
+ //#endregion
8004
+ //#region src/resources/emailMailboxes.d.ts
8005
+ declare class EmailMailboxesResource extends EmailMailboxesResource$1 {
8006
+ /** Messages sent from the mailbox's own address — `bird.email.mailboxes.messages.create(...)`. */
8007
+ readonly messages: EmailMailboxesMessagesResource;
8008
+ /** Per-sender allow/block rules — `bird.email.mailboxes.receiveRules.create(...)`, `.list(...)`, `.delete(...)`. */
8009
+ readonly receiveRules: EmailMailboxesReceiveRulesResource;
8010
+ constructor(...args: ConstructorParameters<typeof Resource>);
8011
+ }
8012
+ //#endregion
8013
+ //#region src/resources/emailThreads.gen.d.ts
8014
+ type EmailThreadsListQuery = NonNullable<ListEmailThreadsData["query"]>;
8015
+ type EmailThreadsUpdateParams = NonNullable<UpdateEmailThreadData["body"]>;
8016
+ type EmailThreadsDeleteQuery = NonNullable<DeleteEmailThreadData["query"]>;
8017
+ declare class EmailThreadsResource$1 extends Resource {
8018
+ /**
8019
+ * 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.
8020
+ *
8021
+ * @example List conversation threads
8022
+ * for await (const thread of bird.email.threads.list({ mailbox_id: "mbx_01abc" })) {
8023
+ * console.log(thread.id, thread.subject);
8024
+ * }
8025
+ */
8026
+ list(query?: EmailThreadsListQuery, options?: RequestOptions): PaginatedPromise<EmailThread>;
8027
+ /**
8028
+ * Get one conversation: participants, counts, labels, read state. Fetch its messages with the thread messages endpoint.
8029
+ *
8030
+ * @example Get a thread
8031
+ * const thread = await bird.email.threads.get("thr_01abc");
8032
+ * console.log(thread.subject);
8033
+ */
8034
+ get(threadId: string, options?: RequestOptions): APIPromise<EmailThread>;
8035
+ /**
8036
+ * 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.
8037
+ *
8038
+ * @example Apply label changes to a thread
8039
+ * const thread = await bird.email.threads.update("thr_01abc", {
8040
+ * labels: { add: ["archive"] },
8041
+ * });
8042
+ * console.log(thread.id);
8043
+ */
8044
+ update(threadId: string, params?: EmailThreadsUpdateParams, options?: RequestOptions): APIPromise<EmailThread>;
8045
+ /**
8046
+ * Move a conversation and all its messages to trash (purged after 30 days), or delete permanently with ?permanent=true.
8047
+ *
8048
+ * @example Delete a thread
8049
+ * await bird.email.threads.delete("thr_01abc", { permanent: true });
8050
+ */
8051
+ delete(threadId: string, query?: EmailThreadsDeleteQuery, options?: RequestOptions): APIPromise<void>;
8052
+ }
8053
+ //#endregion
8054
+ //#region src/resources/emailThreadsMessages.gen.d.ts
8055
+ type EmailThreadsMessagesListQuery = NonNullable<ListEmailThreadMessagesData["query"]>;
8056
+ type EmailThreadsMessagesReplyParams = NonNullable<ReplyEmailThreadMessageData["body"]>;
8057
+ declare class EmailThreadsMessagesResource extends Resource {
8058
+ /**
8059
+ * 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.
8060
+ *
8061
+ * @example List a thread's messages
8062
+ * for await (const msg of bird.email.threads.messages.list("thr_01abc")) {
8063
+ * console.log(msg.id, msg.direction);
8064
+ * }
8065
+ */
8066
+ list(threadId: string, query?: EmailThreadsMessagesListQuery, options?: RequestOptions): PaginatedPromise<EmailThreadMessage>;
8067
+ /**
8068
+ * Get one conversation message with its extracted plain text — readable for the mailbox's full retention period, no MIME parsing needed.
8069
+ *
8070
+ * @example Get a message
8071
+ * const msg = await bird.email.threads.messages.get("thr_01abc", "rem_01xyz");
8072
+ * console.log(msg.direction); // "inbound"
8073
+ */
8074
+ get(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessage>;
8075
+ /**
8076
+ * Get the original rendered HTML and plain-text body of a conversation message. Available 30 days; after that use the message's extracted_text.
8077
+ *
8078
+ * @example Get a message body
8079
+ * const body = await bird.email.threads.messages.body("thr_01abc", "rem_01xyz");
8080
+ * console.log(body.text);
8081
+ */
8082
+ body(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessageBody>;
8083
+ /**
8084
+ * 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.
8085
+ *
8086
+ * @example Reply to a message
8087
+ * const reply = await bird.email.threads.messages.reply("thr_01abc", "rem_01xyz", {
8088
+ * text: "Thanks for reaching out!",
8089
+ * });
8090
+ * console.log(reply.id);
8091
+ */
8092
+ reply(threadId: string, messageId: string, params?: EmailThreadsMessagesReplyParams, options?: RequestOptions): APIPromise<EmailThreadMessage>;
8093
+ /**
8094
+ * List the attachments on a conversation message. Bytes are downloadable for 30 days; the metadata also rides the message's attachment_manifest durably.
8095
+ *
8096
+ * @example List a message's attachments
8097
+ * const atts = await bird.email.threads.messages.attachments("thr_01abc", "rem_01xyz");
8098
+ * console.log(atts.data.map((a) => a.filename));
8099
+ */
8100
+ attachments(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessageAttachmentList>;
8101
+ }
8102
+ //#endregion
8103
+ //#region src/resources/emailThreads.d.ts
8104
+ declare class EmailThreadsResource extends EmailThreadsResource$1 {
8105
+ /** Messages in a conversation — `bird.email.threads.messages.list(...)`, `.reply(...)`, … */
8106
+ readonly messages: EmailThreadsMessagesResource;
8107
+ constructor(...args: ConstructorParameters<typeof Resource>);
8108
+ }
8109
+ //#endregion
7868
8110
  //#region src/resources/email.d.ts
7869
8111
  /** Body for `bird.email.send`. */
7870
8112
  type EmailSendParams = EmailMessageSendRequest;
@@ -7889,6 +8131,10 @@ declare class EmailResource<D extends EmailChannelDefaults | undefined = undefin
7889
8131
  #private;
7890
8132
  /** Email statistics — `bird.email.stats.summary(...)`, `.daily(...)`, `.byTag(...)`, … */
7891
8133
  readonly stats: EmailStatsResource;
8134
+ /** Durable agent mailboxes — `bird.email.mailboxes.list(...)`, `.create(...)`, … */
8135
+ readonly mailboxes: EmailMailboxesResource;
8136
+ /** Conversations across every mailbox — `bird.email.threads.list(...)`, `.get(...)`, … */
8137
+ readonly threads: EmailThreadsResource;
7892
8138
  constructor(core: ConstructorParameters<typeof Resource>[0], client: ConstructorParameters<typeof Resource>[1], defaults?: D);
7893
8139
  /**
7894
8140
  * Send an email message. Resolves once the message is accepted for delivery
@@ -8374,7 +8620,7 @@ declare class WhatsappResource extends WhatsappResourceBase {
8374
8620
  * const msg = await bird.whatsapp.send({
8375
8621
  * to: "+15551234567",
8376
8622
  * template: {
8377
- * name: "bird_otp",
8623
+ * slug: "bird_otp",
8378
8624
  * components: [
8379
8625
  * { type: "body", parameters: [{ type: "text", text: "123456" }] },
8380
8626
  * ],
@@ -8473,225 +8719,6 @@ declare class WebhooksResource {
8473
8719
  unwrap(payload: string, headers: WebhookHeaders, options?: WebhookOptions): BirdWebhookEvent;
8474
8720
  }
8475
8721
  //#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
8722
  //#region src/resources/realtime.d.ts
8696
8723
  /** Body for `bird.realtime.publish` — one event to one or more channels. */
8697
8724
  type RealtimePublishParams = RealtimePublish;
@@ -8932,14 +8959,6 @@ declare class BirdClient<const O extends BirdClientOptions = BirdClientOptions>
8932
8959
  readonly domains: DomainsResource;
8933
8960
  /** Webhooks — `bird.webhooks.unwrap(payload, headers)` verifies an inbound delivery. */
8934
8961
  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
8962
  /** Realtime — `bird.realtime.publish(...)`, `.channels.list(...)`, `.members.disconnect(...)`, … */
8944
8963
  readonly realtime: RealtimeResource;
8945
8964
  constructor(options: O);
@@ -9024,5 +9043,5 @@ declare const WebhookEventType: {
9024
9043
  /** A known webhook event type value. */
9025
9044
  type WebhookEventTypeValue = (typeof WebhookEventType)[keyof typeof WebhookEventType];
9026
9045
  //#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 };
9046
+ 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
9047
  //# sourceMappingURL=index.d.mts.map