@messagebird/sdk 0.45.0 → 0.46.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.mjs CHANGED
@@ -2935,7 +2935,10 @@ const createVerificationNextChannel = (options) => (options.client ?? client).po
2935
2935
  * Returns the workspace's WhatsApp messages as a cursor-paginated list,
2936
2936
  * newest first, outbound and inbound alike. Each message carries the one
2937
2937
  * content object it was built from: `template`, or free-form `text`,
2938
- * `image`, `video`, `audio`, `sticker`, `document` or `location`. An inbound
2938
+ * `image`, `video`, `audio`, `sticker`, `document`, `location`,
2939
+ * `interactive` or `contact_cards`. An inbound message carries
2940
+ * `interactive_reply` when the contact tapped a reply button or a list row,
2941
+ * on an interactive message or on a template's quick reply. An inbound
2939
2942
  * message whose content WhatsApp models and we do not carries `unsupported`
2940
2943
  * instead, naming the type rather than reading back empty.
2941
2944
  * Filter by direction, status, recipient (`to`), sender (`from`),
@@ -2972,8 +2975,9 @@ const listWhatsAppMessages = (options) => (options?.client ?? client).get({
2972
2975
  *
2973
2976
  * Sends one WhatsApp message to one recipient. The request carries exactly one
2974
2977
  * kind of content: a message template, or free-form `text`, `image`, `video`,
2975
- * `audio`, `sticker`, `document` or `location`. A request carrying none is
2976
- * rejected with a `422`, and one carrying more than one is too.
2978
+ * `audio`, `sticker`, `document`, `location` or `interactive`. A request
2979
+ * carrying none is rejected with a `422`, and one carrying more than one is
2980
+ * too.
2977
2981
  *
2978
2982
  * A **template** is the only content WhatsApp delivers outside an open
2979
2983
  * customer service window, so it is what starts a conversation. Name the
@@ -2993,6 +2997,23 @@ const listWhatsAppMessages = (options) => (options?.client ?? client).get({
2993
2997
  * asynchronously, carrying `service_window_expired` on the message's
2994
2998
  * `last_error`. Every free-form send requires `from`.
2995
2999
  *
3000
+ * **Interactive content** gives the recipient something to tap. `interactive`
3001
+ * names its kind in `type` and carries that kind's own field: reply `buttons`,
3002
+ * a `list` menu, a `cta_url` link button, or `cards` for a carousel;
3003
+ * `location_request_message` and `request_contact_info` are each a single
3004
+ * button asking the recipient for something, so `body_text` is the whole
3005
+ * message. A tap on a reply button or a list row comes back as an inbound
3006
+ * message carrying `interactive_reply`. The other kinds answer in their own
3007
+ * shape: a `cta_url` link opens in the recipient's browser and sends nothing
3008
+ * back, and the two request kinds come back as the thing they asked for, an
3009
+ * inbound `location` or `contact_cards` message.
3010
+ * Interactive content is free-form, so the customer service window and the
3011
+ * `from` requirement above both apply.
3012
+ *
3013
+ * Set `in_reply_to_message_id` to quote a message the contact sees above this
3014
+ * one, the way replying in the WhatsApp client does. Any content quotes, and
3015
+ * the quoted message must be one from this same conversation.
3016
+ *
2996
3017
  * The `202` response is the accepted message, echoing the resolved content; it
2997
3018
  * is not a delivery confirmation. Follow delivery with
2998
3019
  * [Get a WhatsApp message](/docs/api/reference/get-whatsapp-message), the
@@ -3031,7 +3052,7 @@ const createWhatsAppMessage = (options) => (options.client ?? client).post({
3031
3052
  /**
3032
3053
  * Get a WhatsApp message
3033
3054
  *
3034
- * Returns a single WhatsApp message: its current delivery status, per-stage timestamps (`sent_at`, `delivered_at`, `read_at`), and failure detail when it failed. It carries the one content object it was built from: `template`, or free-form `text`, `image`, `video`, `audio`, `sticker`, `document` or `location`. An inbound message whose content WhatsApp models and we do not carries `unsupported` instead, naming the type rather than reading back empty. The `status` advances asynchronously as delivery progresses, so poll this endpoint (or subscribe to `whatsapp.*` webhook events) after a send to confirm delivery. For the per-event timeline, use [List events for a WhatsApp message](/docs/api/reference/list-whatsapp-message-events) instead.
3055
+ * Returns a single WhatsApp message: its current delivery status, per-stage timestamps (`sent_at`, `delivered_at`, `read_at`), and failure detail when it failed. It carries the one content object it was built from: `template`, or free-form `text`, `image`, `video`, `audio`, `sticker`, `document`, `location`, `interactive` or `contact_cards`. An inbound message carries `interactive_reply` when the contact tapped a reply button or a list row. An inbound message whose content WhatsApp models and we do not carries `unsupported` instead, naming the type rather than reading back empty. The `status` advances asynchronously as delivery progresses, so poll this endpoint (or subscribe to `whatsapp.*` webhook events) after a send to confirm delivery. For the per-event timeline, use [List events for a WhatsApp message](/docs/api/reference/list-whatsapp-message-events) instead.
3035
3056
  *
3036
3057
  */
3037
3058
  const getWhatsAppMessage = (options) => (options.client ?? client).get({
@@ -6577,7 +6598,7 @@ var SmsTemplatesResource = class extends Resource {
6577
6598
  //#region src/resources/whatsapp.gen.ts
6578
6599
  var WhatsappResourceBase = class extends Resource {
6579
6600
  /**
6580
- * Get one WhatsApp message by id: current delivery status, sent/delivered/read timestamps, the one content it was built from (a template, or free-form text, image, video, audio, sticker, document or location), and failure detail if it failed. For the per-event timeline use whatsapp_list_events.
6601
+ * Get one WhatsApp message by id: current delivery status, sent/delivered/read timestamps, the one content it was built from (a template, or free-form text, image, video, audio, sticker, document, location, interactive or contact_cards, or interactive_reply on an inbound tap), and failure detail if it failed. For the per-event timeline use whatsapp_list_events.
6581
6602
  *
6582
6603
  * @example Read a message back
6583
6604
  * const msg = await bird.whatsapp.get("wa_abc123");
@@ -6592,7 +6613,7 @@ var WhatsappResourceBase = class extends Resource {
6592
6613
  }));
6593
6614
  }
6594
6615
  /**
6595
- * 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.
6616
+ * 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, location, interactive or contact_cards. An inbound tap on a reply button or list row carries interactive_reply instead. 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.
6596
6617
  *
6597
6618
  * @example Iterate delivered messages
6598
6619
  * for await (const msg of bird.whatsapp.list({ status: ["delivered"] })) {
@@ -6632,10 +6653,14 @@ var WhatsappResourceBase = class extends Resource {
6632
6653
  var WhatsappResource = class extends WhatsappResourceBase {
6633
6654
  /**
6634
6655
  * Send one message, carrying exactly one kind of content: a template, or
6635
- * free-form `text`, `image`, `video`, `audio`, `sticker`, `document` or
6636
- * `location`. Every send but a Bird-managed template needs `from`, a number
6637
- * this workspace owns. The result is `accepted`, not yet delivered read it
6638
- * back with `get` to confirm.
6656
+ * free-form `text`, `image`, `video`, `audio`, `sticker`, `document`,
6657
+ * `location` or `interactive` the last being the arm that gives the
6658
+ * recipient something to tap: reply buttons, a list menu, a link button,
6659
+ * media cards, or a request for their location or contact details. Set
6660
+ * `in_reply_to_message_id` to quote an earlier message from the same
6661
+ * conversation. Every send but a Bird-managed
6662
+ * template needs `from`, a number this workspace owns. The result is
6663
+ * `accepted`, not yet delivered — read it back with `get` to confirm.
6639
6664
  *
6640
6665
  * @example
6641
6666
  * const msg = await bird.whatsapp.send({
@@ -7765,9 +7790,9 @@ var BirdClient = class {
7765
7790
  this.#headers = {
7766
7791
  ...opts.defaultHeaders,
7767
7792
  ...opts.apiKey ? { Authorization: `Bearer ${opts.apiKey}` } : {},
7768
- "User-Agent": `bird-sdk-js/0.45.0`,
7793
+ "User-Agent": `bird-sdk-js/0.46.0`,
7769
7794
  "Bird-Surface": "sdk-js",
7770
- "Bird-Version": "0.45.0"
7795
+ "Bird-Version": "0.46.0"
7771
7796
  };
7772
7797
  const caller = detectCaller();
7773
7798
  if (caller) this.#headers["Bird-Caller"] = caller;
@@ -8215,6 +8240,48 @@ const WhatsAppEventType = {
8215
8240
  WhatsappSent: "whatsapp.sent"
8216
8241
  };
8217
8242
  /**
8243
+ * Values of WhatsAppInteractiveButtonType known at this SDK version. The wire value is an open
8244
+ * string: a value added by a newer server deserializes unchanged, so switch on
8245
+ * these with a `default` branch rather than treating the set as closed.
8246
+ */
8247
+ const WhatsAppInteractiveButtonType = {
8248
+ CtaUrl: "cta_url",
8249
+ QuickReply: "quick_reply"
8250
+ };
8251
+ /**
8252
+ * Values of WhatsAppInteractiveHeaderType known at this SDK version. The wire value is an open
8253
+ * string: a value added by a newer server deserializes unchanged, so switch on
8254
+ * these with a `default` branch rather than treating the set as closed.
8255
+ */
8256
+ const WhatsAppInteractiveHeaderType = {
8257
+ Document: "document",
8258
+ Image: "image",
8259
+ Text: "text",
8260
+ Video: "video"
8261
+ };
8262
+ /**
8263
+ * Values of WhatsAppInteractiveReplyType known at this SDK version. The wire value is an open
8264
+ * string: a value added by a newer server deserializes unchanged, so switch on
8265
+ * these with a `default` branch rather than treating the set as closed.
8266
+ */
8267
+ const WhatsAppInteractiveReplyType = {
8268
+ Button: "button",
8269
+ List: "list"
8270
+ };
8271
+ /**
8272
+ * Values of WhatsAppInteractiveType known at this SDK version. The wire value is an open
8273
+ * string: a value added by a newer server deserializes unchanged, so switch on
8274
+ * these with a `default` branch rather than treating the set as closed.
8275
+ */
8276
+ const WhatsAppInteractiveType = {
8277
+ Button: "button",
8278
+ Carousel: "carousel",
8279
+ CtaUrl: "cta_url",
8280
+ List: "list",
8281
+ LocationRequestMessage: "location_request_message",
8282
+ RequestContactInfo: "request_contact_info"
8283
+ };
8284
+ /**
8218
8285
  * Values of WhatsAppTemplateCategory known at this SDK version. The wire value is an open
8219
8286
  * string: a value added by a newer server deserializes unchanged, so switch on
8220
8287
  * these with a `default` branch rather than treating the set as closed.
@@ -8238,6 +8305,6 @@ const WhatsAppTemplateParameterType = {
8238
8305
  Video: "video"
8239
8306
  };
8240
8307
  //#endregion
8241
- export { BirdAPIError, BirdAuthError, BirdBadRequestError, BirdBillingError, BirdClient, BirdConflictError, BirdConnectionError, BirdError, BirdInternalError, BirdMisdirectedError, BirdMissingApiKeyError, BirdNotFoundError, BirdNotImplementedError, BirdPayloadTooLargeError, BirdPermissionError, BirdPreconditionError, BirdRateLimitError, BirdServiceUnavailableError, BirdTimeoutError, BirdValidationError, BirdWebhookVerificationError, EmailEventType, EmailLookupFlag, EmailLookupReason, EmailLookupResult, LookupFlag, LookupPropertyStatus, NumberCapability, NumberType, NumbersOrderStatus, PreferenceChannel, PreferenceOrigin, SMSErrorCode, SMSKeywordOperation, SMSSuppressionCoverage, SMSSuppressionEndReason, SMSSuppressionOrigin, SMSSuppressionReason, TemplateLanguageStatus, TemplateStatus, VerificationAttemptFailureReason, VerificationChannel, VerificationTerminalReason, WebhookEventType, WhatsAppErrorCode, WhatsAppEventType, WhatsAppTemplateCategory, WhatsAppTemplateParameterType, baseUrlForRegion, regionFromApiKey };
8308
+ export { BirdAPIError, BirdAuthError, BirdBadRequestError, BirdBillingError, BirdClient, BirdConflictError, BirdConnectionError, BirdError, BirdInternalError, BirdMisdirectedError, BirdMissingApiKeyError, BirdNotFoundError, BirdNotImplementedError, BirdPayloadTooLargeError, BirdPermissionError, BirdPreconditionError, BirdRateLimitError, BirdServiceUnavailableError, BirdTimeoutError, BirdValidationError, BirdWebhookVerificationError, EmailEventType, EmailLookupFlag, EmailLookupReason, EmailLookupResult, LookupFlag, LookupPropertyStatus, NumberCapability, NumberType, NumbersOrderStatus, PreferenceChannel, PreferenceOrigin, SMSErrorCode, SMSKeywordOperation, SMSSuppressionCoverage, SMSSuppressionEndReason, SMSSuppressionOrigin, SMSSuppressionReason, TemplateLanguageStatus, TemplateStatus, VerificationAttemptFailureReason, VerificationChannel, VerificationTerminalReason, WebhookEventType, WhatsAppErrorCode, WhatsAppEventType, WhatsAppInteractiveButtonType, WhatsAppInteractiveHeaderType, WhatsAppInteractiveReplyType, WhatsAppInteractiveType, WhatsAppTemplateCategory, WhatsAppTemplateParameterType, baseUrlForRegion, regionFromApiKey };
8242
8309
 
8243
8310
  //# sourceMappingURL=index.mjs.map