@messagebird/sdk 0.33.1 → 0.35.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
@@ -368,6 +368,8 @@ type WebhookEvent = ({
368
368
  } & EventSmsSent) | ({
369
369
  type: "sms.undelivered";
370
370
  } & EventSmsUndelivered) | ({
371
+ type: "sms_suppression.created";
372
+ } & EventSmsSuppressionCreated) | ({
371
373
  type: "verify.attempt.delivered";
372
374
  } & EventVerifyAttemptDelivered) | ({
373
375
  type: "verify.attempt.sent";
@@ -4069,6 +4071,7 @@ type WhatsAppEventList = {
4069
4071
  */
4070
4072
  data: Array<WhatsAppEvent>;
4071
4073
  };
4074
+ type NumbersDedicatedAllocationId = string;
4072
4075
  /**
4073
4076
  * The window and bucket grain the response covers, echoed from the request, plus the freshness boundary the data is current to.
4074
4077
  *
@@ -7352,6 +7355,43 @@ type EventSmsUndelivered = {
7352
7355
  timestamp: string;
7353
7356
  data: EventSmsUndeliveredData;
7354
7357
  };
7358
+ /**
7359
+ * Always `sms_suppression.created` for this event.
7360
+ */
7361
+ type SmsSuppressionCreatedEventType = "sms_suppression.created";
7362
+ /**
7363
+ * Payload of the sms_suppression.created event.
7364
+ */
7365
+ type EventSmsSuppressionCreatedData = {
7366
+ /**
7367
+ * The suppression episode that was opened.
7368
+ */
7369
+ suppression_id: SmsSuppressionId;
7370
+ /**
7371
+ * The subscriber, in E.164 format.
7372
+ */
7373
+ destination: string;
7374
+ /**
7375
+ * The sender this stops. An SMS suppression is the exact (sender, recipient) pair, so your other senders still reach this subscriber.
7376
+ */
7377
+ originator: string;
7378
+ reason: SmsSuppressionReason;
7379
+ /**
7380
+ * The workspace the suppression belongs to.
7381
+ */
7382
+ workspace_id: WorkspaceId;
7383
+ };
7384
+ /**
7385
+ * A destination was added to the workspace's SMS suppression ledger: a subscriber's STOP, a carrier opt-out, or a manual add.
7386
+ */
7387
+ type EventSmsSuppressionCreated = {
7388
+ type: SmsSuppressionCreatedEventType;
7389
+ /**
7390
+ * When the episode's opening statement took effect (`effective_at`).
7391
+ */
7392
+ timestamp: string;
7393
+ data: EventSmsSuppressionCreatedData;
7394
+ };
7355
7395
  /**
7356
7396
  * Identity fields shared by every Verify lifecycle event payload.
7357
7397
  */
@@ -8034,7 +8074,6 @@ type AvailableNumber = {
8034
8074
  */
8035
8075
  type NumbersOrderStatus$1 = "charging" | "ordering" | "pending" | "completed" | "failed" | (string & {});
8036
8076
  type NumbersOrderId = string;
8037
- type NumbersDedicatedAllocationId = string;
8038
8077
  type NumbersOrder = {
8039
8078
  /**
8040
8079
  * Identifier of this purchase order.
@@ -9690,11 +9729,25 @@ type ListWhatsAppMessagesData = {
9690
9729
  */
9691
9730
  direction?: MessageDirection;
9692
9731
  /**
9693
- * Filter by contact phone number (E.164 exact match).
9732
+ * Filter by recipient, exact match. The recipient is the contact on an outbound message and your business number on an inbound one, matching the `to` each message returns. Accepts an E.164 phone number, or a business-scoped user ID to name the contact. Only a contact is ever identified by a business-scoped user ID, so `to=<business-scoped user ID>` matches outbound messages only.
9733
+ *
9734
+ */
9735
+ to?: string;
9736
+ /**
9737
+ * Filter by sender, exact match. The sender is your business number on an outbound message and the contact on an inbound one, matching the `from` each message returns. Accepts an E.164 phone number, or a business-scoped user ID to name the contact. Only a contact is ever identified by a business-scoped user ID, so `from=<business-scoped user ID>` matches inbound messages only.
9738
+ *
9739
+ */
9740
+ from?: string;
9741
+ /**
9742
+ * Deprecated: use `to` or `from` instead, which also match a business-scoped user ID. Filters by contact phone number (E.164 exact match), in either direction.
9743
+ *
9744
+ *
9745
+ * @deprecated
9694
9746
  */
9695
9747
  phone_number?: string;
9696
9748
  /**
9697
- * Filter by business-scoped user ID (Meta identifier).
9749
+ * Filter by business-scoped user ID (Meta identifier), matching the contact in either direction. `to` and `from` also accept one, but each matches a single end of the message.
9750
+ *
9698
9751
  */
9699
9752
  bsuid?: string;
9700
9753
  /**
@@ -12630,7 +12683,7 @@ declare class WhatsappResourceBase extends Resource {
12630
12683
  */
12631
12684
  get(messageId: string, options?: RequestOptions): APIPromise<WhatsAppMessage>;
12632
12685
  /**
12633
- * List WhatsApp messages, newest first, as a cursor page ({data, next_cursor, …}). Each message carries the one content it was built from: a template, or free-form text, image, video, audio, sticker, document or location. Pass next_cursor back as starting_after to fetch the next page. Filter by direction, status, contact phone number, bsuid, template category, or tag. Use whatsapp_get for one message's current state.
12686
+ * List WhatsApp messages, newest first, as a cursor page ({data, next_cursor, …}). Each message carries the one content it was built from: a template, or free-form text, image, video, audio, sticker, document or location. Pass next_cursor back as starting_after to fetch the next page. Filter by direction, status, recipient (to), sender (from), business-scoped user ID (bsuid), template category, or tag. to and from each accept a phone number or a business-scoped user ID; pair either with direction to search a single side of the message. Use whatsapp_get for one message's current state.
12634
12687
  *
12635
12688
  * @example Iterate delivered messages
12636
12689
  * for await (const msg of bird.whatsapp.list({ status: ["delivered"] })) {
@@ -13271,6 +13324,7 @@ declare const WebhookEventType: {
13271
13324
  readonly SmsReceived: "sms.received";
13272
13325
  readonly SmsRejected: "sms.rejected";
13273
13326
  readonly SmsSent: "sms.sent";
13327
+ readonly SmsSuppressionCreated: "sms_suppression.created";
13274
13328
  readonly SmsUndelivered: "sms.undelivered";
13275
13329
  readonly VerifyAttemptDelivered: "verify.attempt.delivered";
13276
13330
  readonly VerifyAttemptSent: "verify.attempt.sent";
package/dist/index.mjs CHANGED
@@ -2798,8 +2798,12 @@ const createVerificationNextChannel = (options) => (options.client ?? client).po
2798
2798
  * `image`, `video`, `audio`, `sticker`, `document` or `location`. An inbound
2799
2799
  * message whose content WhatsApp models and we do not carries `unsupported`
2800
2800
  * instead, naming the type rather than reading back empty.
2801
- * Filter by direction, status, contact phone number,
2802
- * business-scoped user ID, template category, tag, or creation time; pass the response's `next_cursor` back as
2801
+ * Filter by direction, status, recipient (`to`), sender (`from`),
2802
+ * business-scoped user ID (`bsuid`), template category, tag, or creation
2803
+ * time. `to` and `from` name the same ends of the message the response
2804
+ * does, and each accepts an E.164 phone number or a business-scoped user
2805
+ * ID. Pair either with `direction` to search a single side of the message.
2806
+ * Pass the response's `next_cursor` back as
2803
2807
  * `starting_after` to fetch the next page. To follow a single message's
2804
2808
  * delivery, use
2805
2809
  * [Get a WhatsApp message](/docs/api/reference/get-whatsapp-message)
@@ -6110,7 +6114,7 @@ var WhatsappResourceBase = class extends Resource {
6110
6114
  }));
6111
6115
  }
6112
6116
  /**
6113
- * List WhatsApp messages, newest first, as a cursor page ({data, next_cursor, …}). Each message carries the one content it was built from: a template, or free-form text, image, video, audio, sticker, document or location. Pass next_cursor back as starting_after to fetch the next page. Filter by direction, status, contact phone number, bsuid, template category, or tag. Use whatsapp_get for one message's current state.
6117
+ * List WhatsApp messages, newest first, as a cursor page ({data, next_cursor, …}). Each message carries the one content it was built from: a template, or free-form text, image, video, audio, sticker, document or location. Pass next_cursor back as starting_after to fetch the next page. Filter by direction, status, recipient (to), sender (from), business-scoped user ID (bsuid), template category, or tag. to and from each accept a phone number or a business-scoped user ID; pair either with direction to search a single side of the message. Use whatsapp_get for one message's current state.
6114
6118
  *
6115
6119
  * @example Iterate delivered messages
6116
6120
  * for await (const msg of bird.whatsapp.list({ status: ["delivered"] })) {
@@ -7128,9 +7132,9 @@ var BirdClient = class {
7128
7132
  this.#headers = {
7129
7133
  ...opts.defaultHeaders,
7130
7134
  Authorization: `Bearer ${opts.apiKey}`,
7131
- "User-Agent": `bird-sdk-js/0.33.1`,
7135
+ "User-Agent": `bird-sdk-js/0.35.0`,
7132
7136
  "Bird-Surface": "sdk-js",
7133
- "Bird-Version": "0.33.1"
7137
+ "Bird-Version": "0.35.0"
7134
7138
  };
7135
7139
  const caller = detectCaller();
7136
7140
  if (caller) this.#headers["Bird-Caller"] = caller;
@@ -7261,6 +7265,7 @@ const WebhookEventType = {
7261
7265
  SmsReceived: "sms.received",
7262
7266
  SmsRejected: "sms.rejected",
7263
7267
  SmsSent: "sms.sent",
7268
+ SmsSuppressionCreated: "sms_suppression.created",
7264
7269
  SmsUndelivered: "sms.undelivered",
7265
7270
  VerifyAttemptDelivered: "verify.attempt.delivered",
7266
7271
  VerifyAttemptSent: "verify.attempt.sent",