@messagebird/sdk 0.28.0 → 0.29.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
@@ -97,14 +97,34 @@ interface ErrorDetail {
97
97
  /** What is wrong with this field. */
98
98
  message: string;
99
99
  }
100
- /** One recovery step: an operation to call to resolve the error. */
101
- interface ErrorNextAction {
102
- /** operationId of the follow-up operation that resolves this error. */
103
- operation: string;
104
- /** Short human-readable label for the recovery step. */
105
- description?: string;
106
- /** Permission scope the recovery operation requires, when it is scoped. */
107
- scope?: string;
100
+ /**
101
+ * One recovery step the server suggests. Read `kind` before `operation`: only an
102
+ * `operation` step carries one.
103
+ */
104
+ interface NextAction {
105
+ /**
106
+ * What to do about this step: `operation` calls the operation named in
107
+ * `operation` and reads again, `external` acts somewhere this API does not
108
+ * reach, `wait` reads again later, `terminal` means nothing resolves this so
109
+ * stop retrying. A value this SDK version does not know is display-only: show
110
+ * `description` and offer no action.
111
+ */
112
+ kind: string;
113
+ /** Short human-readable label for the step, suitable for display. */
114
+ description: string;
115
+ /** operationId to call. Present only when `kind` is `operation`. */
116
+ operation?: string;
117
+ /**
118
+ * Parameters that address `operation`, by name — every parameter the call
119
+ * needs, so it can be made from this step alone. A request body, when the
120
+ * operation takes one, is described by the operation and never appears here.
121
+ */
122
+ params?: Record<string, string>;
123
+ /**
124
+ * A URL to open. Present only when `kind` is `external`, and only when the step
125
+ * has one; an external step with nothing to open is normal.
126
+ */
127
+ url?: string;
108
128
  }
109
129
  /** One verification requirement blocking the action, with the flow that resolves it. */
110
130
  interface UnmetGate {
@@ -137,8 +157,8 @@ interface BirdAPIErrorFields {
137
157
  vendorCode?: string;
138
158
  /** Human recovery line for this error, when a recovery is known. */
139
159
  remediation?: string;
140
- /** Operations that resolve this error, in the order to try them. */
141
- next?: ErrorNextAction[];
160
+ /** Recovery steps for this error, in the order to take them. */
161
+ next?: NextAction[];
142
162
  /** Verification requirements blocking this action, when it is blocked pending verification. */
143
163
  unmetGates?: UnmetGate[];
144
164
  }
@@ -153,7 +173,7 @@ declare class BirdAPIError extends BirdError {
153
173
  readonly param?: string;
154
174
  readonly vendorCode?: string;
155
175
  readonly remediation?: string;
156
- readonly next?: ErrorNextAction[];
176
+ readonly next?: NextAction[];
157
177
  readonly unmetGates?: UnmetGate[];
158
178
  constructor(fields: BirdAPIErrorFields);
159
179
  }
@@ -786,7 +806,7 @@ type EventVerifyVerificationVerifiedData = EventVerifyBase & {
786
806
  /**
787
807
  * The channel a passcode is delivered over. Open enum — new channels may be added over time, so treat any unrecognized value as a future channel rather than an error.
788
808
  */
789
- type VerificationChannel$1 = "email" | "sms" | "whatsapp" | (string & {});
809
+ type VerificationChannel$1 = "email" | "sms" | "whatsapp" | "telegram" | (string & {});
790
810
  /**
791
811
  * The recipient to verify. Provide an `email`, a `phone_number`, or both; at least one is required. The addresses also identify the verification: a check must supply exactly the set used on the create call, so a verification created with both addresses is not found by either one alone.
792
812
  *
@@ -962,11 +982,11 @@ type EventVerifyAttemptDeliveredData = EventVerifyBase & {
962
982
  */
963
983
  address: string;
964
984
  /**
965
- * Carrier that delivered the message, when the carrier network reports it. Always null for email and WhatsApp.
985
+ * Carrier that delivered the message, when the carrier network reports it. Always null for email, WhatsApp, and Telegram.
966
986
  */
967
987
  carrier: string | null;
968
988
  /**
969
- * Mobile country code and mobile network code of the delivering carrier, when reported. Always null for email and WhatsApp.
989
+ * Mobile country code and mobile network code of the delivering carrier, when reported. Always null for email, WhatsApp, and Telegram.
970
990
  */
971
991
  mcc_mnc: string | null;
972
992
  /**
@@ -4426,17 +4446,18 @@ type WhatsAppEventList = {
4426
4446
  */
4427
4447
  data: Array<WhatsAppEvent>;
4428
4448
  };
4449
+ /**
4450
+ * Type of an event in a WhatsApp message's delivery timeline. `whatsapp.accepted`: Bird accepted the request. `whatsapp.sent`: handed to the WhatsApp network. `whatsapp.delivered`: delivery confirmed to the recipient's device. `whatsapp.read`: the recipient opened the message (this does not change the message `status`, which never becomes `read`). `whatsapp.failed`: terminal permanent failure. `whatsapp.rejected`: Bird refused the message before sending it, so it was never charged. `whatsapp.received`: an inbound message arrived from the contact. Open enum, new event types may be added over time, so treat any unrecognized value as a future event rather than an error. The values below are the types known at this version.
4451
+ *
4452
+ */
4453
+ type WhatsAppEventType$1 = "whatsapp.accepted" | "whatsapp.delivered" | "whatsapp.failed" | "whatsapp.read" | "whatsapp.rejected" | "whatsapp.sent" | (string & {});
4429
4454
  type WhatsAppEventId = string;
4430
4455
  type WhatsAppEvent = {
4431
4456
  /**
4432
4457
  * ID of the event (`ev_`-prefixed), unique within the message's timeline.
4433
4458
  */
4434
4459
  readonly id: WhatsAppEventId;
4435
- /**
4436
- * Lifecycle event type. `whatsapp.accepted`: Bird accepted the request. `whatsapp.sent`: handed to the WhatsApp network. `whatsapp.delivered`: delivery confirmed to the recipient's device. `whatsapp.read`: the recipient opened the message (this does not change the message `status`, which never becomes `read`). `whatsapp.failed`: terminal permanent failure. `whatsapp.rejected`: Bird refused the message before sending it, so it was never charged. `whatsapp.received`: an inbound message arrived from the contact. Open enum: new event types may be added over time, so treat any unrecognized value as a future event rather than an error.
4437
- *
4438
- */
4439
- readonly type: string;
4460
+ readonly type: WhatsAppEventType$1;
4440
4461
  /**
4441
4462
  * When this event occurred.
4442
4463
  */
@@ -4556,11 +4577,11 @@ type WhatsAppTemplateSend = unknown & {
4556
4577
  */
4557
4578
  id?: WhatsAppTemplateId;
4558
4579
  /**
4559
- * The template to send, by its slug (for example `bird_otp`).
4580
+ * The template to send, by its slug handle (for example `bird_otp`).
4560
4581
  */
4561
4582
  slug?: TemplateSlug;
4562
4583
  /**
4563
- * Which of the template's languages to send, as a BCP-47 tag (for example `en` or `pt-BR`). Meta's underscore form (`pt_BR`) is accepted and normalized; the accepted message echoes the canonical BCP-47 form. May be omitted, in which case the template's default language is sent. A language the template is not stocked in returns a `422` that names the available tags.
4584
+ * Which of the template's languages to send, as a BCP-47 tag (for example `en` or `pt-BR`); Meta's underscore form (`pt_BR`) is accepted and normalized. 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. The accepted message echoes the canonical BCP-47 form of the language it resolved to.
4564
4585
  *
4565
4586
  */
4566
4587
  language?: LanguageTag;
@@ -5040,7 +5061,7 @@ type LookupNetworkInfo = {
5040
5061
  type CountryCode = string;
5041
5062
  type PhoneNumberLookupRequest = {
5042
5063
  /**
5043
- * The phone number to look up, in E.164 format, which is a leading `+`, the country calling code, then the national number.
5064
+ * The phone number to look up, in international format: the country calling code, then the national number. The leading `+` is optional, and `00` works in its place, so `+31612345678`, `31612345678` and `0031612345678` are all the same number. A number written for dialling inside one country, with no country code, is rejected rather than guessed at.
5044
5065
  */
5045
5066
  phone_number: string;
5046
5067
  /**
@@ -5072,21 +5093,56 @@ type SmsTemplateList = {
5072
5093
  };
5073
5094
  type SmsTemplateVersionId = string;
5074
5095
  /**
5075
- * One variable a template's content uses, filled in from the values you give when you send. Templates on every channel report their variables this way, so this reads the same whether you are looking at an SMS template or an email one.
5096
+ * What a send or a preview does when it asks for a language the template
5097
+ * cannot serve.
5098
+ *
5099
+ * `fallback` serves the closest match instead. It tries a broader form of the
5100
+ * same language first, so a request for `pt-BR` can be served by a stocked
5101
+ * `pt`, and then the template's default language. A send never fails because a
5102
+ * language is missing.
5103
+ *
5104
+ * `fail` rejects the send rather than serving a different language, for content
5105
+ * where sending the wrong language is worse than not sending at all. It matches
5106
+ * the requested tag or a broader form of it and refuses a sibling variant, so
5107
+ * `pt-BR` is never served by `pt-PT`. A send that names no language still uses
5108
+ * the default language.
5109
+ *
5110
+ * The default is per channel and stated on each channel's own field, because
5111
+ * what a wrong-language send costs differs: where every language is separately
5112
+ * reviewed and separately priced, falling back silently would send content the
5113
+ * recipient did not expect at a rate the sender did not choose.
5114
+ *
5115
+ */
5116
+ type TemplateOnMissingLanguage = "fallback" | "fail";
5117
+ /**
5118
+ * Where one language of a template stands, on a channel whose content Bird publishes directly. `live` is what sends serve today. `draft` is a language the draft carries that has never been published. `superseded` is a language a later version replaced. Open enum: treat an unrecognised value as not sendable.
5119
+ *
5120
+ */
5121
+ type TemplateLanguageStatus$1 = "draft" | "live" | "superseded" | (string & {});
5122
+ /**
5123
+ * One language's state on a template: whether it is live for sends. Content is not here; the template carries the body of its default language, and a send resolves the rest.
5124
+ *
5125
+ */
5126
+ type SmsTemplateLanguageState = {
5127
+ status: TemplateLanguageStatus$1;
5128
+ };
5129
+ /**
5130
+ * A single variable slot a template fills in from the values supplied when sending. The same shape on email, SMS and WhatsApp, so reading what a template needs works the same way whichever channel you are sending on.
5076
5131
  *
5077
5132
  */
5078
5133
  type TemplateVariable = {
5079
5134
  /**
5080
- * The variable's name, the key you use for it in `parameters` when you send.
5135
+ * The key this slot is filled by. On email and SMS it is the key you set in the send's `parameters` object. On WhatsApp it is the `name` you repeat on the matching parameter inside `components`, or, for a template whose placeholders are positional, the position itself as `1`, `2` and so on.
5136
+ *
5081
5137
  */
5082
5138
  readonly key: string;
5083
5139
  /**
5084
- * The value type this variable accepts. We can add new types to this list over time, so treat a value you do not recognize as a new type rather than as an error. SMS templates use the typed values, such as `code` and `amount`. Email templates only use `text`.
5140
+ * The value type this slot accepts. SMS templates use the typed slots (`code`, `amount` and the rest), each of which rejects a value that does not match its `constraint`. Email and WhatsApp templates use `text`, which accepts any value. Open enum: treat an unrecognized value as a future type rather than an error.
5085
5141
  *
5086
5142
  */
5087
5143
  readonly type: string;
5088
5144
  /**
5089
- * Whether a value has to be supplied when sending. A send that leaves a required variable unset is rejected.
5145
+ * Whether the slot must be supplied when sending. On SMS and WhatsApp a missing required value is rejected with a `422`. On email it is advisory: a missing value renders as empty rather than rejecting the send.
5090
5146
  *
5091
5147
  */
5092
5148
  readonly required: boolean;
@@ -5095,7 +5151,7 @@ type TemplateVariable = {
5095
5151
  */
5096
5152
  readonly constraint: string;
5097
5153
  /**
5098
- * Whether this variable's value gets redacted before it is stored. When it does, the rendered value never appears in message content you read back through the API: a placeholder is stored in its place instead.
5154
+ * Whether this slot's value is kept out of durable storage. A sensitive slot's rendered value never appears in message content read back through the API: a stand-in placeholder is stored instead.
5099
5155
  *
5100
5156
  */
5101
5157
  readonly sensitive?: boolean;
@@ -5104,70 +5160,135 @@ type TemplateVariable = {
5104
5160
  * Content classification. Tells Bird and carriers why you're sending; per-country compliance rules (opt-out policy, quiet hours) key on it as they roll out.
5105
5161
  */
5106
5162
  type SmsMessageCategory = "transactional" | "marketing" | "authentication" | "service";
5163
+ /**
5164
+ * Where the template stands as a whole. The same five states on every channel.
5165
+ *
5166
+ * - `draft`: nothing has ever gone live.
5167
+ * - `pending`: nothing is live and at least one language is in review.
5168
+ * - `active`: at least one language is live, so something can be sent.
5169
+ * - `rejected`: it was reviewed and every language was refused.
5170
+ * - `inactive`: nothing is live and nothing is in review, so content was withdrawn or was blocked before anything went live.
5171
+ *
5172
+ * This is a summary. It answers whether the template is usable at all, not
5173
+ * whether every language is: a template with one language live is `active` even
5174
+ * while another is still drafted or refused. Read `languages` for per-language
5175
+ * state, which is what says which language is where and why.
5176
+ *
5177
+ * Which of the five a template can reach follows its channel's review model. A
5178
+ * channel whose content a third party reviews reaches all five; one whose
5179
+ * content goes live on publish moves between `draft`, `active` and `inactive`.
5180
+ *
5181
+ * Open enum: treat a value you do not recognize as a new one rather than as
5182
+ * an error.
5183
+ *
5184
+ */
5185
+ type TemplateStatus$1 = "draft" | "pending" | "active" | "rejected" | "inactive" | (string & {});
5107
5186
  /**
5108
5187
  * Whether the template is one of our built-in templates (`system`) or one your workspace created (`workspace`).
5109
5188
  */
5110
5189
  type TemplateScope = "system" | "workspace";
5190
+ type SmsTemplateId = string;
5111
5191
  /**
5112
- * A template's name: the stable handle you send it by, used in place of the template id. It can contain lowercase letters, numbers, hyphens, and underscores, has to start and end with a letter or a number, and can be up to 63 characters long.
5192
+ * A message template: one identity holding a copy of the message per language, resolved to one at send. It declares the variable slots a send fills in, so the parts that change travel with the request and the wording does not.
5113
5193
  *
5114
5194
  */
5115
- type TemplateName = string;
5116
- type SmsTemplateId = string;
5117
5195
  type SmsTemplate = {
5118
5196
  /**
5119
5197
  * Unique identifier for the template.
5120
5198
  */
5121
5199
  readonly id: SmsTemplateId;
5122
5200
  /**
5123
- * The template's stable handle. Pass it (or the id) as the template reference when sending.
5201
+ * The template's permanent handle. Pass it (or the id) as the template reference when sending. Handles beginning with `bird_` are reserved for Bird's built-in templates.
5202
+ *
5203
+ */
5204
+ readonly slug: TemplateSlug;
5205
+ /**
5206
+ * The template's display name, shown wherever the template is listed. Nothing resolves through it, so it is safe to show wherever a human reads the template.
5207
+ *
5124
5208
  */
5125
- readonly name: TemplateName;
5209
+ readonly name: string;
5126
5210
  /**
5127
- * Human-readable description of what the template is for.
5211
+ * What the template is for. Null when unset.
5128
5212
  */
5129
- readonly description: string;
5213
+ readonly description: string | null;
5130
5214
  scope: TemplateScope;
5215
+ status: TemplateStatus$1;
5131
5216
  /**
5132
5217
  * Content classification applied to messages sent from this template.
5133
5218
  */
5134
5219
  readonly category: SmsMessageCategory;
5135
5220
  /**
5136
- * The template body in its default language, shown for preview. Variable placeholders appear inline (for example `{{ code }}`).
5221
+ * The template body in its default language, shown for preview. Variable placeholders appear inline (for example `{{ code }}`). Name a `language` on the send to have another one served.
5137
5222
  *
5138
5223
  */
5139
5224
  readonly body: string;
5140
5225
  /**
5141
- * The typed slots this template fills in from the values you supply when sending.
5226
+ * The typed slots this template fills in from the values you supply in `parameters` when sending. Every language of a template declares the same slots, so this list holds for whichever one a send resolves to.
5227
+ *
5142
5228
  */
5143
5229
  readonly variables: Array<TemplateVariable>;
5144
5230
  /**
5145
- * The languages this template is available in, as BCP-47 tags.
5231
+ * The language a send uses when it names none, and the last resort when `on_missing_language` is `fallback` and the language asked for is not available.
5232
+ *
5233
+ */
5234
+ readonly default_language: LanguageTag;
5235
+ /**
5236
+ * The languages a send can resolve right now, as BCP-47 tags. The set may shrink for reasons other than editing, so read it rather than assuming it matches what you last saw.
5237
+ *
5238
+ */
5239
+ readonly available_languages: Array<LanguageTag>;
5240
+ /**
5241
+ * Where each of the template's languages stands, keyed by BCP-47 language tag. Content is not here: `body` previews the default language, and a send resolves the one it needs.
5242
+ *
5243
+ */
5244
+ readonly languages: {
5245
+ [key: string]: SmsTemplateLanguageState;
5246
+ };
5247
+ /**
5248
+ * What a send does when it asks for a language this template does not carry. Defaults to `fallback` on SMS.
5249
+ *
5146
5250
  */
5147
- readonly available_languages: Array<string>;
5251
+ readonly on_missing_language: TemplateOnMissingLanguage;
5148
5252
  /**
5149
- * The template's lifecycle state. `active` means the template can be sent; every built-in Bird template is `active`. `draft` (being edited), `pending` (submitted for review), `approved` (passed review), and `rejected` (failed review) describe a workspace-authored template's authoring lifecycle; workspace-authored SMS templates are not available yet, so today every template is `active`.
5253
+ * Whether a send has to name a language. When true, a send that names none is rejected instead of being served the default language.
5150
5254
  *
5151
5255
  */
5152
- readonly status: "active" | "draft" | "pending" | "approved" | "rejected";
5256
+ readonly language_source_required: boolean;
5153
5257
  /**
5154
- * The current editable draft version. Always null today: SMS templates are not yet versioned; present for parity with email templates.
5258
+ * The current editable draft version, or null for a built-in `system` template, which has no draft.
5259
+ *
5155
5260
  */
5156
5261
  readonly draft_version_id: SmsTemplateVersionId | null;
5157
5262
  /**
5158
- * The currently published version, or null if the template has never been published. Always null today: SMS templates are not yet versioned; present for parity with email templates.
5263
+ * The version a send resolves to, or null for a built-in `system` template, which Bird ships ready to send rather than versioning.
5264
+ *
5159
5265
  */
5160
- readonly published_version_id?: SmsTemplateVersionId | null;
5266
+ readonly live_version_id: SmsTemplateVersionId | null;
5161
5267
  /**
5162
- * The draft's revision counter. Always null today: SMS templates are not yet versioned; present for parity with email templates.
5268
+ * Deprecated: use `live_version_id` instead, which carries the same value.
5269
+ *
5270
+ *
5271
+ * @deprecated
5272
+ */
5273
+ readonly published_version_id: SmsTemplateVersionId | null;
5274
+ /**
5275
+ * The draft's revision counter. Null for a built-in `system` template, which is unversioned.
5276
+ *
5163
5277
  */
5164
5278
  readonly revision: number | null;
5165
5279
  /**
5166
- * When the template was created. Null for built-in templates.
5280
+ * When this template was last submitted. Null for a built-in `system` template: Bird ships it ready to send, so there is nothing submitted to date.
5281
+ *
5282
+ */
5283
+ readonly last_submitted_at: string | null;
5284
+ /**
5285
+ * When the template was created. Null for a built-in `system` template, which Bird ships rather than stores.
5286
+ *
5167
5287
  */
5168
5288
  readonly created_at: string | null;
5169
5289
  /**
5170
- * When the template was last updated. Null for built-in templates.
5290
+ * When the template was last modified. Null for a built-in `system` template, which Bird ships rather than stores.
5291
+ *
5171
5292
  */
5172
5293
  readonly updated_at: string | null;
5173
5294
  };
@@ -5299,12 +5420,19 @@ type SmsTemplateSend = unknown & {
5299
5420
  */
5300
5421
  id?: SmsTemplateId;
5301
5422
  /**
5302
- * The template to send, by its name handle (for example `bird_otp_verification`). Browse the available templates and their variables with the templates endpoint.
5423
+ * The template to send, by its slug handle (for example `bird_otp_verification`). Browse the available templates and their variables with the templates endpoint.
5303
5424
  *
5304
5425
  */
5305
- name?: TemplateName;
5426
+ slug?: TemplateSlug;
5306
5427
  /**
5307
- * Which of the template's localized bodies to send, as a BCP-47 tag. Falls back to the closest available language, then English, when the exact tag is not stocked. Omit for English.
5428
+ * Deprecated: use `slug` instead. Resolved as a slug first, and only if that finds nothing, matched against the template's display name.
5429
+ *
5430
+ *
5431
+ * @deprecated
5432
+ */
5433
+ name?: string;
5434
+ /**
5435
+ * 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.
5308
5436
  *
5309
5437
  */
5310
5438
  language?: LanguageTag;
@@ -5341,7 +5469,8 @@ type SmsSendOptions = {
5341
5469
  };
5342
5470
  type SmsMessageSendRequest = unknown & {
5343
5471
  /**
5344
- * Recipient phone number in E.164 format (for example `+15551234567`). One recipient per message.
5472
+ * Recipient phone number in E.164 format (for example `+14155550100`). One recipient per message. The number is stored and returned in canonical E.164; a recipient that cannot be routed returns a `422` `SMSInvalidRecipient`.
5473
+ *
5345
5474
  */
5346
5475
  to: string;
5347
5476
  /**
@@ -6467,9 +6596,9 @@ type ListContactsData = {
6467
6596
  */
6468
6597
  email?: string;
6469
6598
  /**
6470
- * Return the contact with exactly this phone number in international E.164 form. Encode the leading plus sign as `%2B` (an unencoded `+` arrives as a space and is rejected). Phone numbers are unique within a workspace, so this matches at most one contact. Non-canonical forms of the same number match the contact they canonicalize to; a value that is not a phone number shape, or an empty value, is a validation error, never an unfiltered page.
6599
+ * Return the contacts with exactly this phone number in international E.164 form. Repeat the parameter to match any of up to 50 numbers, and set `limit` to at least the number of values you pass: `limit` defaults to 25, and a page cut short by it looks exactly like numbers that matched nothing. Different identifier parameters still combine with AND, so `phone_number=a&phone_number=b&email=c` asks for a contact whose phone number is `a` or `b` and whose email is `c`. Encode the leading plus sign as `%2B` (an unencoded `+` arrives as a space and is rejected). Phone numbers are unique within a workspace, so each value matches at most one contact. Non-canonical forms of the same number match the contact they canonicalize to; a value that is not a phone number shape, or an empty value, is a validation error, never an unfiltered page.
6471
6600
  */
6472
- phone_number?: string;
6601
+ phone_number?: Array<string>;
6473
6602
  /**
6474
6603
  * Return the contact with exactly this external_id (your own identifier for the contact). Unique within a workspace, so this matches at most one contact. An empty value is a validation error, never an unfiltered page.
6475
6604
  */
@@ -6857,7 +6986,7 @@ type ListSmsTemplatesData = {
6857
6986
  path?: never;
6858
6987
  query?: {
6859
6988
  /**
6860
- * Keep only templates of this scope: `system` for Bird's built-in templates, `workspace` for templates authored in your workspace. Omit for all. Workspace-authored SMS templates are not available yet, so `workspace` currently matches nothing.
6989
+ * Keep only templates of this scope: `system` for Bird's built-in templates, `workspace` for templates authored in your workspace. Omit for all.
6861
6990
  *
6862
6991
  */
6863
6992
  scope?: TemplateScope;
@@ -6869,7 +6998,7 @@ type ListSmsTemplatesData = {
6869
6998
  * Keep only templates available in this language, as a BCP-47 tag. Matches the template's `available_languages` entries exactly, with no fallback.
6870
6999
  *
6871
7000
  */
6872
- language?: string;
7001
+ language?: LanguageTag;
6873
7002
  };
6874
7003
  url: "/v1/sms/templates";
6875
7004
  };
@@ -7069,7 +7198,7 @@ type ListWhatsAppMessageEventsData = {
7069
7198
  * Keep only events of this exact type (for example `whatsapp.delivered` or `whatsapp.failed`). Omit for the full timeline.
7070
7199
  *
7071
7200
  */
7072
- type?: string;
7201
+ type?: WhatsAppEventType$1;
7073
7202
  };
7074
7203
  url: "/v1/whatsapp/messages/{message_id}/events";
7075
7204
  };
@@ -8196,12 +8325,12 @@ type ListVoiceCallsData = {
8196
8325
  */
8197
8326
  sip_trunk_id?: SipTrunkId;
8198
8327
  /**
8199
- * Return only calls placed from this calling party number, matched as a whole number rather than as a fragment. Give it in international form: `+14155551234`, `14155551234`, and `0014155551234` all select the same calls, because a call record keeps the number exactly as the calling equipment presented it. A number given without a country code matches only calls recorded in that same form, since it names a different number in every country. Use `number` instead to match part of a number, or either side of the call.
8328
+ * Return only calls placed from this calling party number, matched as a whole number rather than as a fragment. Give it in international form: `+14155551234`, `14155551234`, and `0014155551234` all select the same calls. A number given without a country code is read as an international one, so give the country code to be sure of what you are matching. Use `number` instead to match part of a number, or either side of the call.
8200
8329
  *
8201
8330
  */
8202
8331
  from?: string;
8203
8332
  /**
8204
- * Return only calls placed to this called party number, matched as a whole number rather than as a fragment. Give it in international form: `+16505559876`, `16505559876`, and `0016505559876` all select the same calls, because a call record keeps the number exactly as the calling equipment presented it. A number given without a country code matches only calls recorded in that same form, since it names a different number in every country. Use `number` instead to match part of a number, or either side of the call.
8333
+ * Return only calls placed to this called party number, matched as a whole number rather than as a fragment. Give it in international form: `+16505559876`, `16505559876`, and `0016505559876` all select the same calls. A number given without a country code is read as an international one, so give the country code to be sure of what you are matching. Use `number` instead to match part of a number, or either side of the call.
8205
8334
  *
8206
8335
  */
8207
8336
  to?: string;
@@ -9078,6 +9207,29 @@ declare class EmailResource<D extends EmailChannelDefaults | undefined = undefin
9078
9207
  * });
9079
9208
  * console.log(msg.id, msg.status); // "em_…", "accepted"
9080
9209
  *
9210
+ * @example Send a published template instead of inline content
9211
+ * const msg = await bird.email.send({
9212
+ * from: { email: "onboarding@messagebird.dev", name: "Bird" },
9213
+ * to: ["delivered@messagebird.dev"],
9214
+ * category: "transactional",
9215
+ * template: {
9216
+ * slug: "welcome-email",
9217
+ * parameters: { first_name: "Jane" },
9218
+ * },
9219
+ * });
9220
+ * console.log(msg.id, msg.status);
9221
+ *
9222
+ * @example Sending to the sandbox bounce address, which hard-bounces every time
9223
+ * const msg = await bird.email.send({
9224
+ * from: { email: "onboarding@messagebird.dev", name: "Bird" },
9225
+ * to: ["bounce+signup-flow@messagebird.dev"],
9226
+ * subject: "Sandbox bounce test",
9227
+ * html: "<p>This message will hard-bounce.</p>",
9228
+ * tags: [{ name: "flow", value: "signup" }],
9229
+ * metadata: { test_run: "docs-capture-1" },
9230
+ * });
9231
+ * console.log(msg.id, msg.status); // "em_…", "accepted"
9232
+ *
9081
9233
  * @example A richer send — cc/bcc, reply-to, tags, metadata, click-tracking off, and an idempotency key (safe to retry; the server dedupes)
9082
9234
  * await bird.email.send(
9083
9235
  * {
@@ -9357,7 +9509,7 @@ type ContactUpdateParams = NonNullable<UpdateContactData["body"]>;
9357
9509
  type ContactBatchParams = NonNullable<CreateContactBatchData["body"]>;
9358
9510
  declare class ContactsResource extends Resource {
9359
9511
  /**
9360
- * List the workspace's contacts as a cursor page, newest first. Look one up by exact email, phone_number, or external_id, or search by email, name, or phone substring. Pass include_total for a total count.
9512
+ * List the workspace's contacts as a cursor page, newest first. Look one up by exact email, phone_number, or external_id, repeating phone_number to resolve up to 50 numbers in one call (raise limit to match), or search by email, name, or phone substring. Pass include_total for a total count.
9361
9513
  *
9362
9514
  * @example Iterate every contact, or take one page
9363
9515
  * for await (const contact of bird.contacts.list({ q: "acme.com" })) {
@@ -9449,7 +9601,7 @@ type SmsSendBatchResult = SmsMessageBatchResponse;
9449
9601
  declare class SmsResource extends SmsResourceBase {
9450
9602
  /**
9451
9603
  * Send one SMS to a single recipient. Supply either `text` (with a `category`)
9452
- * or a stored `template` (by `id` or `name`, with its `parameters`). The
9604
+ * or a stored `template` (by `id` or `slug`, with its `parameters`). The
9453
9605
  * result is `accepted`, not yet delivered — read it back with `get` to confirm.
9454
9606
  *
9455
9607
  * @example Send free text
@@ -9464,7 +9616,7 @@ declare class SmsResource extends SmsResourceBase {
9464
9616
  * @example Send by template
9465
9617
  * await bird.sms.send({
9466
9618
  * to: "+14155550100",
9467
- * template: { name: "bird_otp_verification", parameters: { code: "123456" } },
9619
+ * template: { slug: "bird_otp_verification", parameters: { code: "123456" } },
9468
9620
  * });
9469
9621
  */
9470
9622
  send(params: SmsSendParams, options?: RequestOptions): APIPromise<SmsMessage>;
@@ -9489,13 +9641,13 @@ declare class SmsTemplatesResource extends Resource {
9489
9641
  *
9490
9642
  * @example List the built-in templates
9491
9643
  * const { data } = await bird.smsTemplates.list({ scope: "system" });
9492
- * for (const tpl of data) console.log(tpl.id, tpl.name);
9644
+ * for (const tpl of data) console.log(tpl.id, tpl.slug);
9493
9645
  */
9494
9646
  list(query?: SmsTemplateListQuery, options?: RequestOptions): APIPromise<SmsTemplateList>;
9495
9647
  /**
9496
- * Get one SMS template by its name or id, including its body and the variables it expects. Fetch it before sms_send to see which parameter keys a template send requires.
9648
+ * Get one SMS template by its slug or id, including its body and the variables it expects. Fetch it before sms_send to see which parameter keys a template send requires.
9497
9649
  *
9498
- * @example Read one template by name or id
9650
+ * @example Read one template by slug or id
9499
9651
  * const tpl = await bird.smsTemplates.get("bird_otp_verification");
9500
9652
  * console.log(tpl.body, tpl.variables);
9501
9653
  */
@@ -9548,9 +9700,7 @@ declare class WhatsappResource extends WhatsappResourceBase {
9548
9700
  * to: "+15551234567",
9549
9701
  * template: {
9550
9702
  * slug: "bird_otp",
9551
- * components: [
9552
- * { type: "body", parameters: [{ type: "text", text: "123456" }] },
9553
- * ],
9703
+ * components: [{ type: "body", parameters: [{ type: "text", text: "123456" }] }],
9554
9704
  * },
9555
9705
  * });
9556
9706
  * console.log(msg.id, msg.status);
@@ -9587,7 +9737,7 @@ type VerifyVerificationsCheckParams = NonNullable<CreateVerificationCheckData["b
9587
9737
  type VerifyVerificationsNextChannelParams = NonNullable<CreateVerificationNextChannelData["body"]>;
9588
9738
  declare class VerifyVerificationsResource extends Resource {
9589
9739
  /**
9590
- * Start a verification: generate a one-time passcode and send it to the recipient in `to` (a phone number over the phone channels enabled for its destination country; an email address over email; or both). It is sent over one channel at a time and fails over to the next in the plan, never over two at once. Calling again for the same recipient reuses the in-progress verification and sends a fresh code after the resend cooldown; it does not start a second one, so use this both to send and to resend. The passcode is never returned; submit what the recipient enters with verify_verifications_check. SMS delivery draws on the workspace's SMS balance.
9740
+ * Start a verification: generate a one-time passcode and send it to the recipient in `to` (a phone number over the phone channels enabled for its destination country; an email address over email; or both). It is sent over one channel at a time and fails over to the next in the plan, never over two at once. Calling again for the same recipient reuses the in-progress verification and sends a fresh code after the resend cooldown; it does not start a second one, so use this both to send and to resend. The passcode is never returned; submit what the recipient enters with verify_verifications_check. SMS, WhatsApp and Telegram delivery all draw on the workspace's balance.
9591
9741
  *
9592
9742
  * @example Start a verification over SMS
9593
9743
  * const verification = await bird.verify.verifications.create({
@@ -10092,6 +10242,32 @@ declare const SMSErrorCode: {
10092
10242
  };
10093
10243
  /** A known SMSErrorCode value. */
10094
10244
  type SMSErrorCodeValue = (typeof SMSErrorCode)[keyof typeof SMSErrorCode];
10245
+ /**
10246
+ * Values of TemplateLanguageStatus known at this SDK version. The wire value is an open
10247
+ * string: a value added by a newer server deserializes unchanged, so switch on
10248
+ * these with a `default` branch rather than treating the set as closed.
10249
+ */
10250
+ declare const TemplateLanguageStatus: {
10251
+ readonly Draft: "draft";
10252
+ readonly Live: "live";
10253
+ readonly Superseded: "superseded";
10254
+ };
10255
+ /** A known TemplateLanguageStatus value. */
10256
+ type TemplateLanguageStatusValue = (typeof TemplateLanguageStatus)[keyof typeof TemplateLanguageStatus];
10257
+ /**
10258
+ * Values of TemplateStatus known at this SDK version. The wire value is an open
10259
+ * string: a value added by a newer server deserializes unchanged, so switch on
10260
+ * these with a `default` branch rather than treating the set as closed.
10261
+ */
10262
+ declare const TemplateStatus: {
10263
+ readonly Active: "active";
10264
+ readonly Draft: "draft";
10265
+ readonly Inactive: "inactive";
10266
+ readonly Pending: "pending";
10267
+ readonly Rejected: "rejected";
10268
+ };
10269
+ /** A known TemplateStatus value. */
10270
+ type TemplateStatusValue = (typeof TemplateStatus)[keyof typeof TemplateStatus];
10095
10271
  /**
10096
10272
  * Values of VerificationAttemptFailureReason known at this SDK version. The wire value is an open
10097
10273
  * string: a value added by a newer server deserializes unchanged, so switch on
@@ -10116,6 +10292,7 @@ type VerificationAttemptFailureReasonValue = (typeof VerificationAttemptFailureR
10116
10292
  declare const VerificationChannel: {
10117
10293
  readonly Email: "email";
10118
10294
  readonly Sms: "sms";
10295
+ readonly Telegram: "telegram";
10119
10296
  readonly Whatsapp: "whatsapp";
10120
10297
  };
10121
10298
  /** A known VerificationChannel value. */
@@ -10147,6 +10324,21 @@ declare const WhatsAppErrorCode: {
10147
10324
  };
10148
10325
  /** A known WhatsAppErrorCode value. */
10149
10326
  type WhatsAppErrorCodeValue = (typeof WhatsAppErrorCode)[keyof typeof WhatsAppErrorCode];
10327
+ /**
10328
+ * Values of WhatsAppEventType known at this SDK version. The wire value is an open
10329
+ * string: a value added by a newer server deserializes unchanged, so switch on
10330
+ * these with a `default` branch rather than treating the set as closed.
10331
+ */
10332
+ declare const WhatsAppEventType: {
10333
+ readonly WhatsappAccepted: "whatsapp.accepted";
10334
+ readonly WhatsappDelivered: "whatsapp.delivered";
10335
+ readonly WhatsappFailed: "whatsapp.failed";
10336
+ readonly WhatsappRead: "whatsapp.read";
10337
+ readonly WhatsappRejected: "whatsapp.rejected";
10338
+ readonly WhatsappSent: "whatsapp.sent";
10339
+ };
10340
+ /** A known WhatsAppEventType value. */
10341
+ type WhatsAppEventTypeValue = (typeof WhatsAppEventType)[keyof typeof WhatsAppEventType];
10150
10342
  /**
10151
10343
  * Values of WhatsAppTemplateCategory known at this SDK version. The wire value is an open
10152
10344
  * string: a value added by a newer server deserializes unchanged, so switch on
@@ -10175,5 +10367,5 @@ declare const WhatsAppTemplateParameterType: {
10175
10367
  /** A known WhatsAppTemplateParameterType value. */
10176
10368
  type WhatsAppTemplateParameterTypeValue = (typeof WhatsAppTemplateParameterType)[keyof typeof WhatsAppTemplateParameterType];
10177
10369
  //#endregion
10178
- 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, EmailEventType, type EmailEventTypeValue, type EmailListQuery, type EmailLookup, EmailLookupFlag, type EmailLookupFlagValue, EmailLookupReason, type EmailLookupReasonValue, EmailLookupResult, type EmailLookupResultValue, 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 LookupEmailParams, LookupFlag, type LookupFlagValue, type LookupPhoneNumberParams, LookupPropertyStatus, type LookupPropertyStatusValue, type Mailbox, type MailboxStatsResponse, type PaginatedPromise, type PhoneNumberLookup, type RealtimeBatchPublishResult, type RealtimeChannelGetQuery, type RealtimeChannelInclude, type RealtimeChannelInfo, type RealtimeChannelListItem, type RealtimeChannelListQuery, type RealtimeChannelMember, type RealtimeChannelMembers, type RealtimeChannelsList, type RealtimeOptions, type RealtimePublishBatchParams, type RealtimePublishParams, type RealtimePublishResult, type ReceiveRule, type RequestOptions, SMSErrorCode, type SMSErrorCodeValue, type SafeResult, type SmsListQuery, type SmsMessage, type SmsSendBatchParams, type SmsSendBatchResult, type SmsSendParams, type SmsTemplate, type SmsTemplateList, type SmsTemplateListQuery, type UnmetGate, type Verification, VerificationAttemptFailureReason, type VerificationAttemptFailureReasonValue, VerificationChannel, type VerificationChannelValue, type VerificationCheckResult, VerificationTerminalReason, type VerificationTerminalReasonValue, type VerifyVerificationsCheckParams, type VerifyVerificationsCreateParams, type VerifyVerificationsNextChannelParams, WebhookEventType, type WebhookEventTypeValue, type WebhookHeaders, type WebhookOptions, WhatsAppErrorCode, type WhatsAppErrorCodeValue, type WhatsAppEventList, type WhatsAppMessage, WhatsAppTemplateCategory, type WhatsAppTemplateCategoryValue, WhatsAppTemplateParameterType, type WhatsAppTemplateParameterTypeValue, type WhatsappListEventsQuery, type WhatsappListQuery, type WhatsappSendParams, baseUrlForRegion, regionFromApiKey };
10370
+ 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, EmailEventType, type EmailEventTypeValue, type EmailListQuery, type EmailLookup, EmailLookupFlag, type EmailLookupFlagValue, EmailLookupReason, type EmailLookupReasonValue, EmailLookupResult, type EmailLookupResultValue, 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 LookupEmailParams, LookupFlag, type LookupFlagValue, type LookupPhoneNumberParams, LookupPropertyStatus, type LookupPropertyStatusValue, type Mailbox, type MailboxStatsResponse, type NextAction, type PaginatedPromise, type PhoneNumberLookup, type RealtimeBatchPublishResult, type RealtimeChannelGetQuery, type RealtimeChannelInclude, type RealtimeChannelInfo, type RealtimeChannelListItem, type RealtimeChannelListQuery, type RealtimeChannelMember, type RealtimeChannelMembers, type RealtimeChannelsList, type RealtimeOptions, type RealtimePublishBatchParams, type RealtimePublishParams, type RealtimePublishResult, type ReceiveRule, type RequestOptions, SMSErrorCode, type SMSErrorCodeValue, type SafeResult, type SmsListQuery, type SmsMessage, type SmsSendBatchParams, type SmsSendBatchResult, type SmsSendParams, type SmsTemplate, type SmsTemplateList, type SmsTemplateListQuery, TemplateLanguageStatus, type TemplateLanguageStatusValue, TemplateStatus, type TemplateStatusValue, type UnmetGate, type Verification, VerificationAttemptFailureReason, type VerificationAttemptFailureReasonValue, VerificationChannel, type VerificationChannelValue, type VerificationCheckResult, VerificationTerminalReason, type VerificationTerminalReasonValue, type VerifyVerificationsCheckParams, type VerifyVerificationsCreateParams, type VerifyVerificationsNextChannelParams, WebhookEventType, type WebhookEventTypeValue, type WebhookHeaders, type WebhookOptions, WhatsAppErrorCode, type WhatsAppErrorCodeValue, type WhatsAppEventList, WhatsAppEventType, type WhatsAppEventTypeValue, type WhatsAppMessage, WhatsAppTemplateCategory, type WhatsAppTemplateCategoryValue, WhatsAppTemplateParameterType, type WhatsAppTemplateParameterTypeValue, type WhatsappListEventsQuery, type WhatsappListQuery, type WhatsappSendParams, baseUrlForRegion, regionFromApiKey };
10179
10371
  //# sourceMappingURL=index.d.mts.map