@messagebird/sdk 0.32.0 → 0.33.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
@@ -376,6 +376,8 @@ type WebhookEvent = ({
376
376
  } & EventVerifyAttemptUndelivered) | ({
377
377
  type: "verify.verification.created";
378
378
  } & EventVerifyVerificationCreated) | ({
379
+ type: "verify.verification.failed";
380
+ } & EventVerifyVerificationFailed) | ({
379
381
  type: "verify.verification.verified";
380
382
  } & EventVerifyVerificationVerified) | ({
381
383
  type: "voice_call.answered";
@@ -3288,9 +3290,9 @@ type EmailLookup = {
3288
3290
  };
3289
3291
  type VerificationId = string;
3290
3292
  /**
3291
- * Why a verification session reached its final state without succeeding: `attempts_exhausted` (too many incorrect passcodes) or `ttl_elapsed` (the time window elapsed before a correct passcode). Open enum: new reasons may be added over time, so treat any unrecognized value as a future reason rather than an error.
3293
+ * Why a verification session reached its final state without succeeding: `attempts_exhausted` (too many incorrect passcodes), `ttl_elapsed` (the time window elapsed before a correct passcode), or `undeliverable` (no planned channel could deliver a passcode, so the recipient never had one to submit). Open enum: new reasons may be added over time, so treat any unrecognized value as a future reason rather than an error.
3292
3294
  */
3293
- type VerificationTerminalReason$1 = "attempts_exhausted" | "ttl_elapsed" | (string & {});
3295
+ type VerificationTerminalReason$1 = "attempts_exhausted" | "ttl_elapsed" | "undeliverable" | (string & {});
3294
3296
  /**
3295
3297
  * 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.
3296
3298
  *
@@ -3325,11 +3327,14 @@ type VerificationChannelEntry = {
3325
3327
  * verification moved to the next channel.
3326
3328
  * - `delivery_timeout`: No delivery confirmation arrived before the channel's
3327
3329
  * timeout, so the verification moved to the next channel.
3330
+ * - `not_billable`: The send could not be charged, so it was never handed to the
3331
+ * channel. Usually the workspace balance is too low to cover it. Topping up
3332
+ * the balance is what clears this.
3328
3333
  *
3329
3334
  * New reasons may be added over time. Treat unrecognized values as reasons added
3330
3335
  * later rather than errors.
3331
3336
  */
3332
- type VerificationAttemptFailureReason$1 = "carrier_rejected" | "hard_bounce" | "soft_bounce" | "undelivered" | "channel_unavailable" | "channel_disabled" | "delivery_timeout" | (string & {});
3337
+ type VerificationAttemptFailureReason$1 = "carrier_rejected" | "hard_bounce" | "soft_bounce" | "undelivered" | "channel_unavailable" | "channel_disabled" | "delivery_timeout" | "not_billable" | (string & {});
3333
3338
  /**
3334
3339
  * Meta's content classification for a template.
3335
3340
  *
@@ -3349,7 +3354,9 @@ type Verification = {
3349
3354
  *
3350
3355
  * - `pending`: Awaiting a correct passcode.
3351
3356
  * - `verified`: A correct passcode was submitted.
3352
- * - `failed`: Too many incorrect attempts were submitted.
3357
+ * - `failed`: The verification cannot be completed. Either too many
3358
+ * incorrect passcodes were submitted, or no planned channel could
3359
+ * deliver one. Read `reason` to tell those apart.
3353
3360
  * - `expired`: The validity window elapsed before a correct passcode.
3354
3361
  * - `canceled`: The verification was canceled before completion.
3355
3362
  * - `blocked`: A fraud or abuse control stopped the verification.
@@ -7498,6 +7505,46 @@ type EventVerifyVerificationCreated = {
7498
7505
  timestamp: string;
7499
7506
  data: EventVerifyVerificationCreatedData;
7500
7507
  };
7508
+ /**
7509
+ * Always `verify.verification.failed` for this event.
7510
+ */
7511
+ type VerifyVerificationFailedEventType = "verify.verification.failed";
7512
+ /**
7513
+ * Payload of the verify.verification.failed event.
7514
+ */
7515
+ type EventVerifyVerificationFailedData = EventVerifyBase & {
7516
+ /**
7517
+ * The verification's state, always `failed`. Open enum for forward compatibility.
7518
+ */
7519
+ status: string;
7520
+ /**
7521
+ * Why the verification ended. Always `undeliverable` on this event: no planned channel delivered a passcode.
7522
+ */
7523
+ reason: VerificationTerminalReason$1;
7524
+ /**
7525
+ * The last channel the verification tried, the one whose failure left it with nowhere else to go. Null when no channel was attributed.
7526
+ */
7527
+ channel: VerificationChannel$1 | null;
7528
+ /**
7529
+ * Why that last send did not deliver. This is the actionable half of the event: `not_billable` means the workspace balance could not cover the send, while the delivery reasons point at the recipient or the channel.
7530
+ */
7531
+ last_attempt_reason: VerificationAttemptFailureReason$1;
7532
+ /**
7533
+ * Time the verification was resolved.
7534
+ */
7535
+ failed_at: string;
7536
+ };
7537
+ /**
7538
+ * The verification ended without the recipient receiving a passcode: every planned channel reported that its send would not arrive.
7539
+ */
7540
+ type EventVerifyVerificationFailed = {
7541
+ type: VerifyVerificationFailedEventType;
7542
+ /**
7543
+ * Time the verification was resolved.
7544
+ */
7545
+ timestamp: string;
7546
+ data: EventVerifyVerificationFailedData;
7547
+ };
7501
7548
  /**
7502
7549
  * Payload of the verify.verification.verified event.
7503
7550
  */
@@ -13229,6 +13276,7 @@ declare const WebhookEventType: {
13229
13276
  readonly VerifyAttemptSent: "verify.attempt.sent";
13230
13277
  readonly VerifyAttemptUndelivered: "verify.attempt.undelivered";
13231
13278
  readonly VerifyVerificationCreated: "verify.verification.created";
13279
+ readonly VerifyVerificationFailed: "verify.verification.failed";
13232
13280
  readonly VerifyVerificationVerified: "verify.verification.verified";
13233
13281
  readonly VoiceCallAnswered: "voice_call.answered";
13234
13282
  readonly VoiceCallEnded: "voice_call.ended";
@@ -13488,6 +13536,7 @@ declare const VerificationAttemptFailureReason: {
13488
13536
  readonly ChannelUnavailable: "channel_unavailable";
13489
13537
  readonly DeliveryTimeout: "delivery_timeout";
13490
13538
  readonly HardBounce: "hard_bounce";
13539
+ readonly NotBillable: "not_billable";
13491
13540
  readonly SoftBounce: "soft_bounce";
13492
13541
  readonly Undelivered: "undelivered";
13493
13542
  };
@@ -13514,6 +13563,7 @@ type VerificationChannelValue = (typeof VerificationChannel)[keyof typeof Verifi
13514
13563
  declare const VerificationTerminalReason: {
13515
13564
  readonly AttemptsExhausted: "attempts_exhausted";
13516
13565
  readonly TtlElapsed: "ttl_elapsed";
13566
+ readonly Undeliverable: "undeliverable";
13517
13567
  };
13518
13568
  /** A known VerificationTerminalReason value. */
13519
13569
  type VerificationTerminalReasonValue = (typeof VerificationTerminalReason)[keyof typeof VerificationTerminalReason];
package/dist/index.mjs CHANGED
@@ -7128,9 +7128,9 @@ var BirdClient = class {
7128
7128
  this.#headers = {
7129
7129
  ...opts.defaultHeaders,
7130
7130
  Authorization: `Bearer ${opts.apiKey}`,
7131
- "User-Agent": `bird-sdk-js/0.32.0`,
7131
+ "User-Agent": `bird-sdk-js/0.33.0`,
7132
7132
  "Bird-Surface": "sdk-js",
7133
- "Bird-Version": "0.32.0"
7133
+ "Bird-Version": "0.33.0"
7134
7134
  };
7135
7135
  const caller = detectCaller();
7136
7136
  if (caller) this.#headers["Bird-Caller"] = caller;
@@ -7266,6 +7266,7 @@ const WebhookEventType = {
7266
7266
  VerifyAttemptSent: "verify.attempt.sent",
7267
7267
  VerifyAttemptUndelivered: "verify.attempt.undelivered",
7268
7268
  VerifyVerificationCreated: "verify.verification.created",
7269
+ VerifyVerificationFailed: "verify.verification.failed",
7269
7270
  VerifyVerificationVerified: "verify.verification.verified",
7270
7271
  VoiceCallAnswered: "voice_call.answered",
7271
7272
  VoiceCallEnded: "voice_call.ended",
@@ -7487,6 +7488,7 @@ const VerificationAttemptFailureReason = {
7487
7488
  ChannelUnavailable: "channel_unavailable",
7488
7489
  DeliveryTimeout: "delivery_timeout",
7489
7490
  HardBounce: "hard_bounce",
7491
+ NotBillable: "not_billable",
7490
7492
  SoftBounce: "soft_bounce",
7491
7493
  Undelivered: "undelivered"
7492
7494
  };
@@ -7508,7 +7510,8 @@ const VerificationChannel = {
7508
7510
  */
7509
7511
  const VerificationTerminalReason = {
7510
7512
  AttemptsExhausted: "attempts_exhausted",
7511
- TtlElapsed: "ttl_elapsed"
7513
+ TtlElapsed: "ttl_elapsed",
7514
+ Undeliverable: "undeliverable"
7512
7515
  };
7513
7516
  /**
7514
7517
  * Values of WhatsAppErrorCode known at this SDK version. The wire value is an open