@messagebird/sdk 0.32.0 → 0.33.1

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.
@@ -5510,6 +5517,21 @@ type DomainUpdate = {
5510
5517
  inbound?: DomainInboundConfig;
5511
5518
  };
5512
5519
  type SuppressionId = string;
5520
+ type Actor = {
5521
+ /**
5522
+ * Actor identifier.
5523
+ */
5524
+ id: string;
5525
+ /**
5526
+ * Who or what performed the action: `user` for a member's own session, `oauth_token` for a token issued to a caller on a member's behalf, `api_key` for a workspace API key, `system` for our own automation, `sso` for an organization's SSO connection, and `service_account` for a workspace's connected Integration acting with no member behind it. Open enum: new actor types may be added over time, so treat any unrecognized value as a future type rather than an error.
5527
+ */
5528
+ type: string;
5529
+ /**
5530
+ * The label the actor is shown under: typically a member's name or email address, or the API key's name. Null when it could not be resolved.
5531
+ *
5532
+ */
5533
+ readonly display_name?: string | null;
5534
+ };
5513
5535
  type InboundAddressId = string;
5514
5536
  type InboundEmailMessageId = string;
5515
5537
  type MailboxId = string;
@@ -7498,6 +7520,46 @@ type EventVerifyVerificationCreated = {
7498
7520
  timestamp: string;
7499
7521
  data: EventVerifyVerificationCreatedData;
7500
7522
  };
7523
+ /**
7524
+ * Always `verify.verification.failed` for this event.
7525
+ */
7526
+ type VerifyVerificationFailedEventType = "verify.verification.failed";
7527
+ /**
7528
+ * Payload of the verify.verification.failed event.
7529
+ */
7530
+ type EventVerifyVerificationFailedData = EventVerifyBase & {
7531
+ /**
7532
+ * The verification's state, always `failed`. Open enum for forward compatibility.
7533
+ */
7534
+ status: string;
7535
+ /**
7536
+ * Why the verification ended. Always `undeliverable` on this event: no planned channel delivered a passcode.
7537
+ */
7538
+ reason: VerificationTerminalReason$1;
7539
+ /**
7540
+ * The last channel the verification tried, the one whose failure left it with nowhere else to go. Null when no channel was attributed.
7541
+ */
7542
+ channel: VerificationChannel$1 | null;
7543
+ /**
7544
+ * 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.
7545
+ */
7546
+ last_attempt_reason: VerificationAttemptFailureReason$1;
7547
+ /**
7548
+ * Time the verification was resolved.
7549
+ */
7550
+ failed_at: string;
7551
+ };
7552
+ /**
7553
+ * The verification ended without the recipient receiving a passcode: every planned channel reported that its send would not arrive.
7554
+ */
7555
+ type EventVerifyVerificationFailed = {
7556
+ type: VerifyVerificationFailedEventType;
7557
+ /**
7558
+ * Time the verification was resolved.
7559
+ */
7560
+ timestamp: string;
7561
+ data: EventVerifyVerificationFailedData;
7562
+ };
7501
7563
  /**
7502
7564
  * Payload of the verify.verification.verified event.
7503
7565
  */
@@ -7863,21 +7925,6 @@ type EventWhatsAppSent = {
7863
7925
  timestamp: string;
7864
7926
  data: EventWhatsAppSentData;
7865
7927
  };
7866
- type AuditLogActor = {
7867
- /**
7868
- * ID of the user, API key, integration, or system process that performed the action.
7869
- */
7870
- id: string;
7871
- /**
7872
- * Type of actor, such as `user`, `api_key`, `service_account`, or `system`.
7873
- */
7874
- type: string;
7875
- /**
7876
- * Display name of the actor. This is the user's email address for a `user` actor, or the name of the API key or integration that acted. Absent when it could not be resolved.
7877
- *
7878
- */
7879
- readonly display_name?: string | null;
7880
- };
7881
7928
  /**
7882
7929
  * Physical type of a phone number. New number types may be added over time, so treat unrecognized values as supported types rather than errors.
7883
7930
  */
@@ -8134,7 +8181,7 @@ type VoiceCall = {
8134
8181
  /**
8135
8182
  * Who placed the call: the API key whose credentials it used, the integration acting for the workspace, or the user who placed it from a browser or the CLI. Absent when the call was admitted only by its source IP address, or when no actor was recorded.
8136
8183
  */
8137
- readonly actor?: AuditLogActor;
8184
+ readonly actor?: Actor;
8138
8185
  /**
8139
8186
  * Identifier of the SIP trunk that originated this call. `null` when no trunk is associated.
8140
8187
  */
@@ -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.1`,
7132
7132
  "Bird-Surface": "sdk-js",
7133
- "Bird-Version": "0.32.0"
7133
+ "Bird-Version": "0.33.1"
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