@messagebird/sdk 0.26.0 → 0.27.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
@@ -788,14 +788,14 @@ type EventVerifyVerificationVerifiedData = EventVerifyBase & {
788
788
  */
789
789
  type VerificationChannel$1 = "email" | "sms" | "whatsapp" | (string & {});
790
790
  /**
791
- * The recipient to verify. Provide an `email_address`, 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.
791
+ * 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
792
  *
793
793
  */
794
794
  type VerificationTo = {
795
795
  /**
796
796
  * The recipient's email address. Case does not matter; the address is lowercased before use.
797
797
  */
798
- email_address?: string;
798
+ email?: string;
799
799
  /**
800
800
  * The recipient's phone number in E.164 format, with the leading `+` and country code (for example `+15551234567`). A number in any other format is rejected as an invalid recipient (`422`).
801
801
  */
@@ -4792,6 +4792,17 @@ type SmsBatchSummary = {
4792
4792
  */
4793
4793
  accepted_count: number;
4794
4794
  };
4795
+ /**
4796
+ * The settings Bird applied to this message. Every option is reported, whether you set it on the send or took the default that was in force at the time.
4797
+ *
4798
+ */
4799
+ type SmsMessageEffectiveOptions = {
4800
+ /**
4801
+ * Whether Bird replaced characters outside the GSM-7 alphabet in this message's body with their closest equivalent before sending it. When `true`, `text` is the body as sent and `segments` describes that body.
4802
+ *
4803
+ */
4804
+ smart_encoding: boolean;
4805
+ };
4795
4806
  /**
4796
4807
  * Delivery status. `accepted` (the initial status of an outbound send) means Bird accepted the request and it is awaiting handoff to the carrier network. `sent` means it was handed to the carrier and is awaiting a delivery receipt. `delivered` is confirmed delivery. `undelivered` is a non-permanent non-delivery (handset off or unreachable). `failed` is a terminal permanent failure. `rejected` means Bird refused it before it reached the carrier (for example insufficient balance). `expired` means the validity period elapsed without a terminal receipt. `scheduled` means the message is queued to send at a future time and has not been dispatched yet, and `canceled` means a scheduled message was canceled before it was sent. `received` applies to inbound messages.
4797
4808
  *
@@ -4845,6 +4856,11 @@ type SmsMessage = {
4845
4856
  metadata?: {
4846
4857
  [key: string]: unknown;
4847
4858
  };
4859
+ /**
4860
+ * Settings Bird applied to this message, with any option you omitted filled in with the default that was in force when you sent it. Absent on inbound messages, and on outbound messages sent before Bird began recording these settings.
4861
+ *
4862
+ */
4863
+ readonly options?: SmsMessageEffectiveOptions;
4848
4864
  /**
4849
4865
  * How long, in seconds, Bird keeps trying to deliver before the message transitions to `expired`.
4850
4866
  */
@@ -4901,6 +4917,29 @@ type SmsTemplateSend = unknown & {
4901
4917
  [key: string]: unknown;
4902
4918
  };
4903
4919
  };
4920
+ /**
4921
+ * Settings that change how Bird processes this message. Each option applies to this send only; omit one to use its default.
4922
+ *
4923
+ */
4924
+ type SmsSendOptions = {
4925
+ /**
4926
+ * Replace characters outside the GSM-7 alphabet with their closest GSM-7 equivalent before sending: typically curly quotes, dashes, ellipses, fullwidth forms, and non-breaking spaces.
4927
+ *
4928
+ * One such character forces the whole body into `UCS2`, which more than halves the characters that fit in a segment, so replacing them often lowers the segment count and the cost.
4929
+ *
4930
+ * Disabled by default, because it alters the body you composed. The replacement is all-or-nothing: a body that still holds a character outside the alphabet afterwards, such as an emoji or a non-Latin script, is sent exactly as you supplied it. Read the message back to see what was applied: `text` is the body as sent.
4931
+ *
4932
+ */
4933
+ smart_encoding?: boolean;
4934
+ /**
4935
+ * Preview feature: link click tracking. Defaults to `false`. Currently unavailable; setting this to `true` returns `422 SMSUnsupportedFeature`.
4936
+ */
4937
+ track_clicks?: boolean;
4938
+ /**
4939
+ * Preview feature: per-segment price ceiling. Currently unavailable; supplying this field returns `422 SMSUnsupportedFeature`.
4940
+ */
4941
+ max_price_per_segment?: number;
4942
+ };
4904
4943
  type SmsMessageSendRequest = unknown & {
4905
4944
  /**
4906
4945
  * Recipient phone number in E.164 format (for example `+15551234567`). One recipient per message.
@@ -4938,6 +4977,11 @@ type SmsMessageSendRequest = unknown & {
4938
4977
  metadata?: {
4939
4978
  [key: string]: unknown;
4940
4979
  };
4980
+ /**
4981
+ * What Bird does to this message on its way out, such as `smart_encoding`. The message being relayed stays at the top level: its recipient, sender, content, and the delivery instructions the carrier acts on.
4982
+ *
4983
+ */
4984
+ options?: SmsSendOptions;
4941
4985
  /**
4942
4986
  * Preview feature: multimedia (MMS) attachments. Currently unavailable; supplying this field returns `422 SMSUnsupportedFeature`.
4943
4987
  */
@@ -4975,20 +5019,12 @@ type SmsMessageSendRequest = unknown & {
4975
5019
  * Preview feature: topic-gated sends. Currently unavailable; supplying this field returns `422 SMSUnsupportedFeature`.
4976
5020
  */
4977
5021
  topic_id?: string;
4978
- /**
4979
- * Preview feature: per-segment price ceiling. Currently unavailable; supplying this field returns `422 SMSUnsupportedFeature`.
4980
- */
4981
- max_price_per_segment?: number;
4982
5022
  /**
4983
5023
  * Preview feature: per-recipient substitution for batch sends. Currently unavailable; supplying this field returns `422 SMSUnsupportedFeature`.
4984
5024
  */
4985
5025
  personalization?: {
4986
5026
  [key: string]: unknown;
4987
5027
  };
4988
- /**
4989
- * Preview feature: link click tracking. Defaults to `false`. Currently unavailable; setting this to `true` returns `422 SMSUnsupportedFeature`.
4990
- */
4991
- track_clicks?: boolean;
4992
5028
  };
4993
5029
  /**
4994
5030
  * Whether a message was sent from the workspace (`outbound`) or received by it (`inbound`).
@@ -5032,7 +5068,7 @@ type Contact = {
5032
5068
  /**
5033
5069
  * The contact's phone number in normalized international form (a leading `+` and four to 15 digits), which may differ from the form it was supplied in. Bird normalizes formatting but does not verify the number against numbering-plan metadata. Unique within the workspace. Carriers recycle disconnected numbers, so a long-stored number can come to belong to someone else; `external_id` is the durable key for your own records. Null when the contact has no phone number.
5034
5070
  */
5035
- phone: string | null;
5071
+ phone_number: string | null;
5036
5072
  /**
5037
5073
  * The contact's first name. Available in broadcast templates as `bird.contact.first_name`.
5038
5074
  */
@@ -5164,7 +5200,7 @@ type ContactUpdateRequest = {
5164
5200
  /**
5165
5201
  * New phone number for the contact, in E.164 format with the leading `+` and country code. Spaces and punctuation are accepted and stripped. Stored in its canonical form, which may differ from what you send, and unique within the workspace. Omit to keep the current number; set to null to remove it, as long as the contact keeps at least one identifier. An empty string behaves as null.
5166
5202
  */
5167
- phone?: string | null;
5203
+ phone_number?: string | null;
5168
5204
  /**
5169
5205
  * The contact's first name. Set to null to clear.
5170
5206
  */
@@ -5208,7 +5244,7 @@ type ContactUpsertError = {
5208
5244
  /**
5209
5245
  * Which identifier matched a batch entry to an existing contact. Null when the entry created a new contact.
5210
5246
  */
5211
- type ContactMatchedOn = "email" | "phone" | "external_id" | null;
5247
+ type ContactMatchedOn = "email" | "phone_number" | "external_id" | null;
5212
5248
  /**
5213
5249
  * The identifiers a batch entry supplied, in the normalized form they were matched with, null where the entry carried none. An echo of the request row for correlation, never the contact's current state.
5214
5250
  */
@@ -5220,7 +5256,7 @@ type ContactUpsertEntry = {
5220
5256
  /**
5221
5257
  * Phone number this entry carried, in its normalized international form. Null when the entry carried none. A row rejected for an invalid phone echoes the value as sent, trimmed, since no normalized form exists.
5222
5258
  */
5223
- phone: string | null;
5259
+ phone_number: string | null;
5224
5260
  /**
5225
5261
  * Your own identifier for this entry, when the entry supplied one.
5226
5262
  */
@@ -5268,7 +5304,7 @@ type ContactUpsertRequest = {
5268
5304
  /**
5269
5305
  * A contact identifier a batch entry can be matched on.
5270
5306
  */
5271
- type ContactMatchKey = "email" | "phone" | "external_id";
5307
+ type ContactMatchKey = "email" | "phone_number" | "external_id";
5272
5308
  type ContactCreateRequest = {
5273
5309
  /**
5274
5310
  * The contact's email address. Trimmed and lowercased before it is stored and checked for uniqueness. Unique within the workspace. Supply an email address, a phone number, or both.
@@ -5277,7 +5313,7 @@ type ContactCreateRequest = {
5277
5313
  /**
5278
5314
  * The contact's phone number in E.164 format, including the leading `+` and country code. Spaces and punctuation are accepted and stripped; the number is stored in its canonical form, which may differ from what you send, and is unique within the workspace. An empty string is treated as if the field were omitted. Supply an email address, a phone number, or both.
5279
5315
  */
5280
- phone?: string;
5316
+ phone_number?: string;
5281
5317
  /**
5282
5318
  * The contact's first name.
5283
5319
  */
@@ -5299,9 +5335,9 @@ type ContactCreateRequest = {
5299
5335
  };
5300
5336
  };
5301
5337
  /**
5302
- * Which identifier a contact has on file, `email` for an email address or `phone` for a phone number.
5338
+ * Which identifier a contact has on file, `email` for an email address or `phone_number` for a phone number.
5303
5339
  */
5304
- type ContactIdentifierFilter = "email" | "phone";
5340
+ type ContactIdentifierFilter = "email" | "phone_number";
5305
5341
  type EmailMessageBatchResponse = {
5306
5342
  /**
5307
5343
  * One entry per message in the batch, in submission order.
@@ -6034,7 +6070,7 @@ type ListContactsData = {
6034
6070
  /**
6035
6071
  * 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.
6036
6072
  */
6037
- phone?: string;
6073
+ phone_number?: string;
6038
6074
  /**
6039
6075
  * 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.
6040
6076
  */
package/dist/index.mjs CHANGED
@@ -5238,9 +5238,9 @@ var BirdClient = class {
5238
5238
  this.#headers = {
5239
5239
  ...opts.defaultHeaders,
5240
5240
  Authorization: `Bearer ${opts.apiKey}`,
5241
- "User-Agent": `bird-sdk-js/0.26.0`,
5241
+ "User-Agent": `bird-sdk-js/0.27.0`,
5242
5242
  "Bird-Surface": "sdk-js",
5243
- "Bird-Version": "0.26.0"
5243
+ "Bird-Version": "0.27.0"
5244
5244
  };
5245
5245
  const caller = detectCaller();
5246
5246
  if (caller) this.#headers["Bird-Caller"] = caller;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@messagebird/sdk",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "description": "The official TypeScript SDK for the Bird API: email, SMS, WhatsApp, verification, and Realtime on one typed client.",
5
5
  "license": "MIT",
6
6
  "author": "Bird",