@linqapp/sdk 0.32.1 → 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.
Files changed (149) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +82 -112
  3. package/client.d.mts +41 -5
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +41 -5
  6. package/client.d.ts.map +1 -1
  7. package/client.js +38 -2
  8. package/client.js.map +1 -1
  9. package/client.mjs +38 -2
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/available-number.d.mts +13 -1
  13. package/resources/available-number.d.mts.map +1 -1
  14. package/resources/available-number.d.ts +13 -1
  15. package/resources/available-number.d.ts.map +1 -1
  16. package/resources/available-number.js +2 -1
  17. package/resources/available-number.js.map +1 -1
  18. package/resources/available-number.mjs +2 -1
  19. package/resources/available-number.mjs.map +1 -1
  20. package/resources/chats/chats.d.mts +125 -64
  21. package/resources/chats/chats.d.mts.map +1 -1
  22. package/resources/chats/chats.d.ts +125 -64
  23. package/resources/chats/chats.d.ts.map +1 -1
  24. package/resources/chats/chats.js +59 -59
  25. package/resources/chats/chats.js.map +1 -1
  26. package/resources/chats/chats.mjs +59 -59
  27. package/resources/chats/chats.mjs.map +1 -1
  28. package/resources/chats/index.d.mts +2 -2
  29. package/resources/chats/index.d.mts.map +1 -1
  30. package/resources/chats/index.d.ts +2 -2
  31. package/resources/chats/index.d.ts.map +1 -1
  32. package/resources/chats/location.d.mts +25 -25
  33. package/resources/chats/location.d.mts.map +1 -1
  34. package/resources/chats/location.d.ts +25 -25
  35. package/resources/chats/location.d.ts.map +1 -1
  36. package/resources/chats/location.js +27 -27
  37. package/resources/chats/location.js.map +1 -1
  38. package/resources/chats/location.mjs +27 -27
  39. package/resources/chats/location.mjs.map +1 -1
  40. package/resources/chats/messages.d.mts +17 -17
  41. package/resources/chats/messages.d.mts.map +1 -1
  42. package/resources/chats/messages.d.ts +17 -17
  43. package/resources/chats/messages.d.ts.map +1 -1
  44. package/resources/chats/messages.js +16 -16
  45. package/resources/chats/messages.js.map +1 -1
  46. package/resources/chats/messages.mjs +16 -16
  47. package/resources/chats/messages.mjs.map +1 -1
  48. package/resources/contact-card.d.mts +29 -28
  49. package/resources/contact-card.d.mts.map +1 -1
  50. package/resources/contact-card.d.ts +29 -28
  51. package/resources/contact-card.d.ts.map +1 -1
  52. package/resources/contact-card.js +23 -22
  53. package/resources/contact-card.js.map +1 -1
  54. package/resources/contact-card.mjs +23 -22
  55. package/resources/contact-card.mjs.map +1 -1
  56. package/resources/experiences.d.mts +91 -0
  57. package/resources/experiences.d.mts.map +1 -0
  58. package/resources/experiences.d.ts +91 -0
  59. package/resources/experiences.d.ts.map +1 -0
  60. package/resources/experiences.js +29 -0
  61. package/resources/experiences.js.map +1 -0
  62. package/resources/experiences.mjs +25 -0
  63. package/resources/experiences.mjs.map +1 -0
  64. package/resources/index.d.mts +7 -3
  65. package/resources/index.d.mts.map +1 -1
  66. package/resources/index.d.ts +7 -3
  67. package/resources/index.d.ts.map +1 -1
  68. package/resources/index.js +9 -1
  69. package/resources/index.js.map +1 -1
  70. package/resources/index.mjs +4 -0
  71. package/resources/index.mjs.map +1 -1
  72. package/resources/messages.d.mts +71 -35
  73. package/resources/messages.d.mts.map +1 -1
  74. package/resources/messages.d.ts +71 -35
  75. package/resources/messages.d.ts.map +1 -1
  76. package/resources/messages.js +41 -30
  77. package/resources/messages.js.map +1 -1
  78. package/resources/messages.mjs +41 -30
  79. package/resources/messages.mjs.map +1 -1
  80. package/resources/payment-handles.d.mts +87 -0
  81. package/resources/payment-handles.d.mts.map +1 -0
  82. package/resources/payment-handles.d.ts +87 -0
  83. package/resources/payment-handles.d.ts.map +1 -0
  84. package/resources/payment-handles.js +76 -0
  85. package/resources/payment-handles.js.map +1 -0
  86. package/resources/payment-handles.mjs +72 -0
  87. package/resources/payment-handles.mjs.map +1 -0
  88. package/resources/payment-providers.d.mts +58 -0
  89. package/resources/payment-providers.d.mts.map +1 -0
  90. package/resources/payment-providers.d.ts +58 -0
  91. package/resources/payment-providers.d.ts.map +1 -0
  92. package/resources/payment-providers.js +45 -0
  93. package/resources/payment-providers.js.map +1 -0
  94. package/resources/payment-providers.mjs +41 -0
  95. package/resources/payment-providers.mjs.map +1 -0
  96. package/resources/payment-requests.d.mts +2 -2
  97. package/resources/payment-requests.d.ts +2 -2
  98. package/resources/payment-requests.js +2 -2
  99. package/resources/payment-requests.mjs +2 -2
  100. package/resources/payments.d.mts +116 -0
  101. package/resources/payments.d.mts.map +1 -0
  102. package/resources/payments.d.ts +116 -0
  103. package/resources/payments.d.ts.map +1 -0
  104. package/resources/payments.js +70 -0
  105. package/resources/payments.js.map +1 -0
  106. package/resources/payments.mjs +66 -0
  107. package/resources/payments.mjs.map +1 -0
  108. package/resources/phone-numbers.d.mts +11 -11
  109. package/resources/phone-numbers.d.mts.map +1 -1
  110. package/resources/phone-numbers.d.ts +11 -11
  111. package/resources/phone-numbers.d.ts.map +1 -1
  112. package/resources/phone-numbers.js +13 -13
  113. package/resources/phone-numbers.js.map +1 -1
  114. package/resources/phone-numbers.mjs +13 -13
  115. package/resources/phone-numbers.mjs.map +1 -1
  116. package/resources/webhook-subscriptions.d.mts +11 -11
  117. package/resources/webhook-subscriptions.d.mts.map +1 -1
  118. package/resources/webhook-subscriptions.d.ts +11 -11
  119. package/resources/webhook-subscriptions.d.ts.map +1 -1
  120. package/resources/webhook-subscriptions.js +13 -13
  121. package/resources/webhook-subscriptions.js.map +1 -1
  122. package/resources/webhook-subscriptions.mjs +13 -13
  123. package/resources/webhook-subscriptions.mjs.map +1 -1
  124. package/resources/webhooks.d.mts +59 -0
  125. package/resources/webhooks.d.mts.map +1 -1
  126. package/resources/webhooks.d.ts +59 -0
  127. package/resources/webhooks.d.ts.map +1 -1
  128. package/src/client.ts +77 -6
  129. package/src/resources/available-number.ts +14 -1
  130. package/src/resources/chats/chats.ts +142 -79
  131. package/src/resources/chats/index.ts +2 -2
  132. package/src/resources/chats/location.ts +28 -28
  133. package/src/resources/chats/messages.ts +28 -28
  134. package/src/resources/contact-card.ts +36 -35
  135. package/src/resources/experiences.ts +118 -0
  136. package/src/resources/index.ts +22 -4
  137. package/src/resources/messages.ts +85 -47
  138. package/src/resources/payment-handles.ts +114 -0
  139. package/src/resources/payment-providers.ts +81 -0
  140. package/src/resources/payment-requests.ts +2 -2
  141. package/src/resources/payments.ts +163 -0
  142. package/src/resources/phone-numbers.ts +14 -14
  143. package/src/resources/webhook-subscriptions.ts +14 -14
  144. package/src/resources/webhooks.ts +61 -0
  145. package/src/version.ts +1 -1
  146. package/version.d.mts +1 -1
  147. package/version.d.ts +1 -1
  148. package/version.js +1 -1
  149. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -52,6 +52,7 @@ import {
52
52
  ContactCardUpdateParams,
53
53
  SetContactCard,
54
54
  } from './resources/contact-card';
55
+ import { ExperienceListResponse, ExperienceRetrieveResponse, Experiences } from './resources/experiences';
55
56
  import {
56
57
  Message,
57
58
  MessageAddReactionParams,
@@ -67,6 +68,17 @@ import {
67
68
  MessagesListMessagesPagination,
68
69
  ReplyTo,
69
70
  } from './resources/messages';
71
+ import {
72
+ PaymentHandleConnection,
73
+ PaymentHandleVerifyParams,
74
+ PaymentHandles,
75
+ } from './resources/payment-handles';
76
+ import {
77
+ PaymentProvider,
78
+ PaymentProviderConnectParams,
79
+ PaymentProviderConnectResponse,
80
+ PaymentProviders,
81
+ } from './resources/payment-providers';
70
82
  import {
71
83
  PaymentRequest,
72
84
  PaymentRequestCreateParams,
@@ -74,6 +86,7 @@ import {
74
86
  PaymentRequestListResponse,
75
87
  PaymentRequests,
76
88
  } from './resources/payment-requests';
89
+ import { Payment, PaymentCreateParams, PaymentCredentialsResponse, Payments } from './resources/payments';
77
90
  import {
78
91
  PhoneNumberListResponse,
79
92
  PhoneNumberUpdateParams,
@@ -1192,7 +1205,7 @@ export class LinqAPIV3 {
1192
1205
  *
1193
1206
  * ## Connected accounts (Stripe Standard, direct charges)
1194
1207
  *
1195
- * Agent Pay runs on **Stripe Connect Standard accounts** using **direct
1208
+ * Payments run on **Stripe Connect Standard accounts** using **direct
1196
1209
  * charges**: the charge is created on *your* connected account and **you are
1197
1210
  * the merchant of record**. That means the money, the payout schedule, the
1198
1211
  * customer relationship, and the compliance surface are all yours — Linq
@@ -1275,7 +1288,7 @@ export class LinqAPIV3 {
1275
1288
  * no-install checkout sheet. Everywhere else (Android, desktop, iPhones
1276
1289
  * without the App Clip yet) the same URL opens the web checkout, so the link
1277
1290
  * always works. The App Clip experience for your payment links is registered
1278
- * automatically by Linq and refreshed whenever you update your Agent Pay
1291
+ * automatically by Linq and refreshed whenever you update your payments
1279
1292
  * branding; a newly registered experience can take up to ~24 hours to
1280
1293
  * activate on Apple's side, during which links open the web checkout.
1281
1294
  *
@@ -1288,6 +1301,34 @@ export class LinqAPIV3 {
1288
1301
  *
1289
1302
  */
1290
1303
  paymentRequests: API.PaymentRequests = new API.PaymentRequests(this);
1304
+ /**
1305
+ * Let an agent pay on a customer's behalf with a single-use virtual card.
1306
+ * Connect a customer once, then create a payment — a virtual card is minted
1307
+ * scoped to that purchase and the card details are handed back for checkout.
1308
+ *
1309
+ */
1310
+ paymentProviders: API.PaymentProviders = new API.PaymentProviders(this);
1311
+ /**
1312
+ * Let an agent pay on a customer's behalf with a single-use virtual card.
1313
+ * Connect a customer once, then create a payment — a virtual card is minted
1314
+ * scoped to that purchase and the card details are handed back for checkout.
1315
+ *
1316
+ */
1317
+ paymentHandles: API.PaymentHandles = new API.PaymentHandles(this);
1318
+ /**
1319
+ * Let an agent pay on a customer's behalf with a single-use virtual card.
1320
+ * Connect a customer once, then create a payment — a virtual card is minted
1321
+ * scoped to that purchase and the card details are handed back for checkout.
1322
+ *
1323
+ */
1324
+ payments: API.Payments = new API.Payments(this);
1325
+ /**
1326
+ * Let an agent pay on a customer's behalf with a single-use virtual card.
1327
+ * Connect a customer once, then create a payment — a virtual card is minted
1328
+ * scoped to that purchase and the card details are handed back for checkout.
1329
+ *
1330
+ */
1331
+ experiences: API.Experiences = new API.Experiences(this);
1291
1332
  /**
1292
1333
  * Webhook Subscriptions allow you to receive real-time notifications when events
1293
1334
  * occur on your account.
@@ -1574,6 +1615,10 @@ LinqAPIV3.Phonenumbers = Phonenumbers;
1574
1615
  LinqAPIV3.PhoneNumbers = PhoneNumbers;
1575
1616
  LinqAPIV3.AvailableNumber = AvailableNumber;
1576
1617
  LinqAPIV3.PaymentRequests = PaymentRequests;
1618
+ LinqAPIV3.PaymentProviders = PaymentProviders;
1619
+ LinqAPIV3.PaymentHandles = PaymentHandles;
1620
+ LinqAPIV3.Payments = Payments;
1621
+ LinqAPIV3.Experiences = Experiences;
1577
1622
  LinqAPIV3.WebhookEvents = WebhookEvents;
1578
1623
  LinqAPIV3.WebhookSubscriptions = WebhookSubscriptions;
1579
1624
  LinqAPIV3.Capability = Capability;
@@ -1608,8 +1653,8 @@ export declare namespace LinqAPIV3 {
1608
1653
  type ChatSendVoicememoResponse as ChatSendVoicememoResponse,
1609
1654
  type ChatsListChatsPagination as ChatsListChatsPagination,
1610
1655
  type ChatCreateParams as ChatCreateParams,
1611
- type ChatListChatsParams as ChatListChatsParams,
1612
1656
  type ChatUpdateParams as ChatUpdateParams,
1657
+ type ChatListChatsParams as ChatListChatsParams,
1613
1658
  type ChatSendVoicememoParams as ChatSendVoicememoParams,
1614
1659
  };
1615
1660
 
@@ -1623,9 +1668,9 @@ export declare namespace LinqAPIV3 {
1623
1668
  type MessageUpdateAppCardResponse as MessageUpdateAppCardResponse,
1624
1669
  type MessagesListMessagesPagination as MessagesListMessagesPagination,
1625
1670
  type MessageCreateParams as MessageCreateParams,
1626
- type MessageListMessagesThreadParams as MessageListMessagesThreadParams,
1627
- type MessageAddReactionParams as MessageAddReactionParams,
1628
1671
  type MessageUpdateParams as MessageUpdateParams,
1672
+ type MessageAddReactionParams as MessageAddReactionParams,
1673
+ type MessageListMessagesThreadParams as MessageListMessagesThreadParams,
1629
1674
  type MessageUpdateAppCardParams as MessageUpdateAppCardParams,
1630
1675
  };
1631
1676
 
@@ -1660,6 +1705,32 @@ export declare namespace LinqAPIV3 {
1660
1705
  type PaymentRequestListParams as PaymentRequestListParams,
1661
1706
  };
1662
1707
 
1708
+ export {
1709
+ PaymentProviders as PaymentProviders,
1710
+ type PaymentProvider as PaymentProvider,
1711
+ type PaymentProviderConnectResponse as PaymentProviderConnectResponse,
1712
+ type PaymentProviderConnectParams as PaymentProviderConnectParams,
1713
+ };
1714
+
1715
+ export {
1716
+ PaymentHandles as PaymentHandles,
1717
+ type PaymentHandleConnection as PaymentHandleConnection,
1718
+ type PaymentHandleVerifyParams as PaymentHandleVerifyParams,
1719
+ };
1720
+
1721
+ export {
1722
+ Payments as Payments,
1723
+ type Payment as Payment,
1724
+ type PaymentCredentialsResponse as PaymentCredentialsResponse,
1725
+ type PaymentCreateParams as PaymentCreateParams,
1726
+ };
1727
+
1728
+ export {
1729
+ Experiences as Experiences,
1730
+ type ExperienceRetrieveResponse as ExperienceRetrieveResponse,
1731
+ type ExperienceListResponse as ExperienceListResponse,
1732
+ };
1733
+
1663
1734
  export {
1664
1735
  WebhookEvents as WebhookEvents,
1665
1736
  type WebhookEventType as WebhookEventType,
@@ -1716,8 +1787,8 @@ export declare namespace LinqAPIV3 {
1716
1787
  ContactCard as ContactCard,
1717
1788
  type SetContactCard as SetContactCard,
1718
1789
  type ContactCardRetrieveResponse as ContactCardRetrieveResponse,
1719
- type ContactCardRetrieveParams as ContactCardRetrieveParams,
1720
1790
  type ContactCardCreateParams as ContactCardCreateParams,
1791
+ type ContactCardRetrieveParams as ContactCardRetrieveParams,
1721
1792
  type ContactCardUpdateParams as ContactCardUpdateParams,
1722
1793
  };
1723
1794
 
@@ -30,7 +30,8 @@ export class AvailableNumber extends APIResource {
30
30
  * Also returns `vcf_url`: a time-limited link to a vCard (`.vcf`) for the chosen
31
31
  * line, carrying its contact card (name/photo) with the chosen number as the
32
32
  * primary `TEL` and the partner's other available lines as backups. Share it with
33
- * recipients so they can save the line as a contact.
33
+ * recipients so they can save the line as a contact. Lines you pass in
34
+ * `exclude_from` are left out of the vCard too.
34
35
  */
35
36
  retrieve(
36
37
  query: AvailableNumberRetrieveParams | null | undefined = {},
@@ -59,6 +60,18 @@ export interface AvailableNumberRetrieveResponse {
59
60
  }
60
61
 
61
62
  export interface AvailableNumberRetrieveParams {
63
+ /**
64
+ * Lines (E.164) to leave out of this selection. Applies to the returned
65
+ * `phone_number`, to the sticky choice when `to` is given, and to the vCard's
66
+ * backup numbers. Repeat the parameter for multiple lines; use `%2B` for the
67
+ * leading `+`.
68
+ *
69
+ * Numbers that are not your lines are ignored. Every entry must be E.164 — a value
70
+ * like `4155551234` is rejected rather than silently skipped. Excluding every one
71
+ * of your available lines returns 400.
72
+ */
73
+ exclude_from?: Array<string>;
74
+
62
75
  /**
63
76
  * Recipient handles (E.164 or email) the message is destined for. When provided,
64
77
  * an existing chat with these recipients makes the choice sticky. Repeat the
@@ -122,46 +122,6 @@ export class Chats extends APIResource {
122
122
  return this._client.post('/v3/chats', { body, ...options });
123
123
  }
124
124
 
125
- /**
126
- * Retrieves a paginated list of chats for the authenticated partner.
127
- *
128
- * **Filtering:**
129
- *
130
- * - If `from` is provided, returns chats for that specific phone number
131
- * - If `from` is omitted, returns chats across all phone numbers owned by the
132
- * partner
133
- * - If `to` is provided, only returns chats where the specified handle is a
134
- * participant
135
- *
136
- * **Pagination:**
137
- *
138
- * - Use `limit` to control page size (default: 20, max: 100)
139
- * - The response includes `next_cursor` for fetching the next page
140
- * - When `next_cursor` is `null`, there are no more results to fetch
141
- * - Pass the `next_cursor` value as the `cursor` parameter for the next request
142
- *
143
- * **Example pagination flow:**
144
- *
145
- * 1. First request: `GET /v3/chats?from=%2B12223334444&limit=20`
146
- * 2. Response includes `next_cursor: "20"` (more results exist)
147
- * 3. Next request: `GET /v3/chats?from=%2B12223334444&limit=20&cursor=20`
148
- * 4. Response includes `next_cursor: null` (no more results)
149
- *
150
- * @example
151
- * ```ts
152
- * // Automatically fetches more pages as needed.
153
- * for await (const chat of client.chats.listChats()) {
154
- * // ...
155
- * }
156
- * ```
157
- */
158
- listChats(
159
- query: ChatListChatsParams | null | undefined = {},
160
- options?: RequestOptions,
161
- ): PagePromise<ChatsListChatsPagination, Chat> {
162
- return this._client.getAPIList('/v3/chats', ListChatsPagination<Chat>, { query, ...options });
163
- }
164
-
165
125
  /**
166
126
  * Retrieve a chat by its unique identifier.
167
127
  *
@@ -195,23 +155,6 @@ export class Chats extends APIResource {
195
155
  return this._client.put(path`/v3/chats/${chatID}`, { body, ...options });
196
156
  }
197
157
 
198
- /**
199
- * Mark all messages in a chat as read.
200
- *
201
- * @example
202
- * ```ts
203
- * await client.chats.markAsRead(
204
- * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
205
- * );
206
- * ```
207
- */
208
- markAsRead(chatID: string, options?: RequestOptions): APIPromise<void> {
209
- return this._client.post(path`/v3/chats/${chatID}/read`, {
210
- ...options,
211
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
212
- });
213
- }
214
-
215
158
  /**
216
159
  * Removes your phone number from a group chat. Once you leave, you will no longer
217
160
  * receive messages from the group and all interaction endpoints (send message,
@@ -239,21 +182,57 @@ export class Chats extends APIResource {
239
182
  }
240
183
 
241
184
  /**
242
- * Share your contact information (Name and Photo Sharing) with a chat.
185
+ * Retrieves a paginated list of chats for the authenticated partner.
243
186
  *
244
- * **Note:** A contact card must be configured before sharing. You can set up your
245
- * contact card via the [Contact Card API](#tag/Contact-Card) or on the
246
- * [Linq dashboard](https://dashboard.linqapp.com/contact-cards).
187
+ * **Filtering:**
188
+ *
189
+ * - If `from` is provided, returns chats for that specific phone number
190
+ * - If `from` is omitted, returns chats across all phone numbers owned by the
191
+ * partner
192
+ * - If `to` is provided, only returns chats where the specified handle is a
193
+ * participant
194
+ *
195
+ * **Pagination:**
196
+ *
197
+ * - Use `limit` to control page size (default: 20, max: 100)
198
+ * - The response includes `next_cursor` for fetching the next page
199
+ * - When `next_cursor` is `null`, there are no more results to fetch
200
+ * - Pass the `next_cursor` value as the `cursor` parameter for the next request
201
+ *
202
+ * **Example pagination flow:**
203
+ *
204
+ * 1. First request: `GET /v3/chats?from=%2B12223334444&limit=20`
205
+ * 2. Response includes `next_cursor: "20"` (more results exist)
206
+ * 3. Next request: `GET /v3/chats?from=%2B12223334444&limit=20&cursor=20`
207
+ * 4. Response includes `next_cursor: null` (no more results)
247
208
  *
248
209
  * @example
249
210
  * ```ts
250
- * await client.chats.shareContactCard(
211
+ * // Automatically fetches more pages as needed.
212
+ * for await (const chat of client.chats.listChats()) {
213
+ * // ...
214
+ * }
215
+ * ```
216
+ */
217
+ listChats(
218
+ query: ChatListChatsParams | null | undefined = {},
219
+ options?: RequestOptions,
220
+ ): PagePromise<ChatsListChatsPagination, Chat> {
221
+ return this._client.getAPIList('/v3/chats', ListChatsPagination<Chat>, { query, ...options });
222
+ }
223
+
224
+ /**
225
+ * Mark all messages in a chat as read.
226
+ *
227
+ * @example
228
+ * ```ts
229
+ * await client.chats.markAsRead(
251
230
  * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
252
231
  * );
253
232
  * ```
254
233
  */
255
- shareContactCard(chatID: string, options?: RequestOptions): APIPromise<void> {
256
- return this._client.post(path`/v3/chats/${chatID}/share_contact_card`, {
234
+ markAsRead(chatID: string, options?: RequestOptions): APIPromise<void> {
235
+ return this._client.post(path`/v3/chats/${chatID}/read`, {
257
236
  ...options,
258
237
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
259
238
  });
@@ -290,6 +269,27 @@ export class Chats extends APIResource {
290
269
  ): APIPromise<ChatSendVoicememoResponse> {
291
270
  return this._client.post(path`/v3/chats/${chatID}/voicememo`, { body, ...options });
292
271
  }
272
+
273
+ /**
274
+ * Share your contact information (Name and Photo Sharing) with a chat.
275
+ *
276
+ * **Note:** A contact card must be configured before sharing. You can set up your
277
+ * contact card via the [Contact Card API](#tag/Contact-Card) or on the
278
+ * [Linq dashboard](https://dashboard.linqapp.com/contact-cards).
279
+ *
280
+ * @example
281
+ * ```ts
282
+ * await client.chats.shareContactCard(
283
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
284
+ * );
285
+ * ```
286
+ */
287
+ shareContactCard(chatID: string, options?: RequestOptions): APIPromise<void> {
288
+ return this._client.post(path`/v3/chats/${chatID}/share_contact_card`, {
289
+ ...options,
290
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
291
+ });
292
+ }
293
293
  }
294
294
 
295
295
  export type ChatsListChatsPagination = ListChatsPagination<Chat>;
@@ -383,6 +383,17 @@ export namespace Chat {
383
383
  * Current health bucket for the chat. See the
384
384
  * [Chat Health guide](/guides/chats/chat-health) for what each value means and how
385
385
  * to react. `doc_url` deep-links to the relevant section.
386
+ *
387
+ * `OPTED_OUT` is terminal — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`,
388
+ * `CANCEL`, `END`, or `QUIT`, and you should send nothing further on this chat.
389
+ * The keyword must be the whole trimmed message, never part of a longer one:
390
+ * `STOP` counts, `please stop` does not. Most keywords must match exactly,
391
+ * including case. `OPT OUT` is the exception — it matches in any casing, with or
392
+ * without the space or a hyphen, so `opt out`, `Opt-Out` and `optout` all count.
393
+ * It clears if they later send `START`, `OPTIN`, or `UNSTOP`, or if they keep
394
+ * replying on the chat — sustained two-way conversation is treated as a sign the
395
+ * stop keyword was a false positive. Suppressing sends to opted-out recipients is
396
+ * your responsibility — Linq surfaces the status but does not block the send.
386
397
  */
387
398
  status: 'HEALTHY' | 'AT_RISK' | 'CRITICAL' | 'OPTED_OUT';
388
399
 
@@ -468,6 +479,16 @@ export interface MediaPart {
468
479
  * cannot coexist with text), so copy and a card are two sends, not one.
469
480
  */
470
481
  export interface MessageContent {
482
+ /**
483
+ * Invokes an action on an experience — a third party that renders inside Linq's
484
+ * iMessage app. Linq resolves the recipient's connection, mints any session the
485
+ * action needs, composes the card and sends it; none of that is visible to you.
486
+ *
487
+ * Call `GET /v3/experiences/{experience}` for the actions you may invoke and the
488
+ * fields each accepts.
489
+ */
490
+ action?: MessageContent.Action;
491
+
471
492
  /**
472
493
  * iMessage effect to apply to this message (screen or bubble effect)
473
494
  */
@@ -475,7 +496,9 @@ export interface MessageContent {
475
496
 
476
497
  /**
477
498
  * Optional idempotency key for this message. Use this to prevent duplicate sends
478
- * of the same message.
499
+ * of the same message. Reusing a key whose message was deleted — or was an
500
+ * ephemeral message that has since expired — returns 404; the message is never
501
+ * resent.
479
502
  */
480
503
  idempotency_key?: string;
481
504
 
@@ -532,6 +555,35 @@ export interface MessageContent {
532
555
  }
533
556
 
534
557
  export namespace MessageContent {
558
+ /**
559
+ * Invokes an action on an experience — a third party that renders inside Linq's
560
+ * iMessage app. Linq resolves the recipient's connection, mints any session the
561
+ * action needs, composes the card and sends it; none of that is visible to you.
562
+ *
563
+ * Call `GET /v3/experiences/{experience}` for the actions you may invoke and the
564
+ * fields each accepts.
565
+ */
566
+ export interface Action {
567
+ /**
568
+ * Which of its actions, e.g. `attach_card`.
569
+ */
570
+ action: string;
571
+
572
+ /**
573
+ * The experience to invoke, e.g. `agentcard`.
574
+ */
575
+ experience: string;
576
+
577
+ /**
578
+ * Values for the fields this action exposes. Keys are exactly the field names
579
+ * listed for the action — no mapping, no nesting.
580
+ *
581
+ * Display copy only, except a `url`-type field — that value sets the destination,
582
+ * and must be an absolute `https` URL.
583
+ */
584
+ params?: { [key: string]: unknown };
585
+ }
586
+
535
587
  /**
536
588
  * An iMessage app card, backed by a Messages app extension. iMessage only — an
537
589
  * `imessage_app` part must be the **only** part in the message and is never
@@ -795,6 +847,17 @@ export namespace ChatCreateResponse {
795
847
  * Current health bucket for the chat. See the
796
848
  * [Chat Health guide](/guides/chats/chat-health) for what each value means and how
797
849
  * to react. `doc_url` deep-links to the relevant section.
850
+ *
851
+ * `OPTED_OUT` is terminal — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`,
852
+ * `CANCEL`, `END`, or `QUIT`, and you should send nothing further on this chat.
853
+ * The keyword must be the whole trimmed message, never part of a longer one:
854
+ * `STOP` counts, `please stop` does not. Most keywords must match exactly,
855
+ * including case. `OPT OUT` is the exception — it matches in any casing, with or
856
+ * without the space or a hyphen, so `opt out`, `Opt-Out` and `optout` all count.
857
+ * It clears if they later send `START`, `OPTIN`, or `UNSTOP`, or if they keep
858
+ * replying on the chat — sustained two-way conversation is treated as a sign the
859
+ * stop keyword was a false positive. Suppressing sends to opted-out recipients is
860
+ * your responsibility — Linq surfaces the status but does not block the send.
798
861
  */
799
862
  status: 'HEALTHY' | 'AT_RISK' | 'CRITICAL' | 'OPTED_OUT';
800
863
 
@@ -952,6 +1015,18 @@ export interface ChatCreateParams {
952
1015
  to: Array<string>;
953
1016
  }
954
1017
 
1018
+ export interface ChatUpdateParams {
1019
+ /**
1020
+ * New display name for the chat (group chats only)
1021
+ */
1022
+ display_name?: string;
1023
+
1024
+ /**
1025
+ * URL of an image to set as the group chat icon (group chats only)
1026
+ */
1027
+ group_chat_icon?: string;
1028
+ }
1029
+
955
1030
  export interface ChatListChatsParams extends ListChatsPaginationParams {
956
1031
  /**
957
1032
  * Phone number to filter chats by. Returns chats made from this phone number. Must
@@ -970,18 +1045,6 @@ export interface ChatListChatsParams extends ListChatsPaginationParams {
970
1045
  to?: string;
971
1046
  }
972
1047
 
973
- export interface ChatUpdateParams {
974
- /**
975
- * New display name for the chat (group chats only)
976
- */
977
- display_name?: string;
978
-
979
- /**
980
- * URL of an image to set as the group chat icon (group chats only)
981
- */
982
- group_chat_icon?: string;
983
- }
984
-
985
1048
  export interface ChatSendVoicememoParams {
986
1049
  /**
987
1050
  * Reference to a voice memo file pre-uploaded via `POST /v3/attachments`. The file
@@ -1017,8 +1080,8 @@ export declare namespace Chats {
1017
1080
  type ChatSendVoicememoResponse as ChatSendVoicememoResponse,
1018
1081
  type ChatsListChatsPagination as ChatsListChatsPagination,
1019
1082
  type ChatCreateParams as ChatCreateParams,
1020
- type ChatListChatsParams as ChatListChatsParams,
1021
1083
  type ChatUpdateParams as ChatUpdateParams,
1084
+ type ChatListChatsParams as ChatListChatsParams,
1022
1085
  type ChatSendVoicememoParams as ChatSendVoicememoParams,
1023
1086
  };
1024
1087
 
@@ -1036,8 +1099,8 @@ export declare namespace Chats {
1036
1099
  Messages as Messages,
1037
1100
  type SentMessage as SentMessage,
1038
1101
  type MessageSendResponse as MessageSendResponse,
1039
- type MessageSendParams as MessageSendParams,
1040
1102
  type MessageListParams as MessageListParams,
1103
+ type MessageSendParams as MessageSendParams,
1041
1104
  };
1042
1105
 
1043
1106
  export {
@@ -12,8 +12,8 @@ export {
12
12
  type ChatLeaveChatResponse,
13
13
  type ChatSendVoicememoResponse,
14
14
  type ChatCreateParams,
15
- type ChatListChatsParams,
16
15
  type ChatUpdateParams,
16
+ type ChatListChatsParams,
17
17
  type ChatSendVoicememoParams,
18
18
  type ChatsListChatsPagination,
19
19
  } from './chats';
@@ -22,8 +22,8 @@ export {
22
22
  Messages,
23
23
  type SentMessage,
24
24
  type MessageSendResponse,
25
- type MessageSendParams,
26
25
  type MessageListParams,
26
+ type MessageSendParams,
27
27
  } from './messages';
28
28
  export {
29
29
  Participants,
@@ -45,34 +45,6 @@ import { path } from '../../internal/utils/path';
45
45
  * Messages conversation** with your number.
46
46
  */
47
47
  export class Location extends APIResource {
48
- /**
49
- * Request a contact in a chat to share their location. They receive an iMessage
50
- * prompt and must accept before any location is available; once they do, read
51
- * their location coordinates with `GET /v3/chats/{chatId}/location`.
52
- *
53
- * The request is delivered asynchronously. The endpoint returns immediately with
54
- * `{ "success": true, "message": "Location request sent" }` and does not return
55
- * coordinates.
56
- *
57
- * Location requests only work in **1:1 iMessage chats** (Apple limitation):
58
- *
59
- * - Group chats (any service) return `409` with code `2016`
60
- * (`GroupChatNotSupported`).
61
- * - 1:1 SMS and RCS chats return `409` with code `2017`
62
- * (`ChatServiceNotSupported`).
63
- *
64
- * @example
65
- * ```ts
66
- * const locationRequestResponse =
67
- * await client.chats.location.request(
68
- * '975d0776-bd17-4273-8337-f346b4c661b0',
69
- * );
70
- * ```
71
- */
72
- request(chatID: string, options?: RequestOptions): APIPromise<LocationRequestResponse> {
73
- return this._client.post(path`/v3/chats/${chatID}/location/request`, options);
74
- }
75
-
76
48
  /**
77
49
  * Retrieve the current location for contacts sharing with you in a chat.
78
50
  *
@@ -107,6 +79,34 @@ export class Location extends APIResource {
107
79
  headers: buildHeaders([{ Accept: 'application/geo+json' }, options?.headers]),
108
80
  });
109
81
  }
82
+
83
+ /**
84
+ * Request a contact in a chat to share their location. They receive an iMessage
85
+ * prompt and must accept before any location is available; once they do, read
86
+ * their location coordinates with `GET /v3/chats/{chatId}/location`.
87
+ *
88
+ * The request is delivered asynchronously. The endpoint returns immediately with
89
+ * `{ "success": true, "message": "Location request sent" }` and does not return
90
+ * coordinates.
91
+ *
92
+ * Location requests only work in **1:1 iMessage chats** (Apple limitation):
93
+ *
94
+ * - Group chats (any service) return `409` with code `2016`
95
+ * (`GroupChatNotSupported`).
96
+ * - 1:1 SMS and RCS chats return `409` with code `2017`
97
+ * (`ChatServiceNotSupported`).
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * const locationRequestResponse =
102
+ * await client.chats.location.request(
103
+ * '975d0776-bd17-4273-8337-f346b4c661b0',
104
+ * );
105
+ * ```
106
+ */
107
+ request(chatID: string, options?: RequestOptions): APIPromise<LocationRequestResponse> {
108
+ return this._client.post(path`/v3/chats/${chatID}/location/request`, options);
109
+ }
110
110
  }
111
111
 
112
112
  export interface GetChatLocationResponse {
@@ -75,6 +75,31 @@ import { path } from '../../internal/utils/path';
75
75
  * **Important:** ephemeral applies in *both directions* — messages you send **and** messages received by the phone numbers in that scope. Because Linq can no longer return the message after 24 hours, persist anything you need to keep from the webhook payload at the time it is delivered.
76
76
  */
77
77
  export class Messages extends APIResource {
78
+ /**
79
+ * Retrieve messages from a specific chat with pagination support.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * // Automatically fetches more pages as needed.
84
+ * for await (const message of client.chats.messages.list(
85
+ * '550e8400-e29b-41d4-a716-446655440000',
86
+ * )) {
87
+ * // ...
88
+ * }
89
+ * ```
90
+ */
91
+ list(
92
+ chatID: string,
93
+ query: MessageListParams | null | undefined = {},
94
+ options?: RequestOptions,
95
+ ): PagePromise<MessagesListMessagesPagination, MessagesAPI.Message> {
96
+ return this._client.getAPIList(
97
+ path`/v3/chats/${chatID}/messages`,
98
+ ListMessagesPagination<MessagesAPI.Message>,
99
+ { query, ...options },
100
+ );
101
+ }
102
+
78
103
  /**
79
104
  * Send a message to an existing chat. Use this endpoint when you already have a
80
105
  * chat ID and want to send additional messages to it.
@@ -134,31 +159,6 @@ export class Messages extends APIResource {
134
159
  send(chatID: string, body: MessageSendParams, options?: RequestOptions): APIPromise<MessageSendResponse> {
135
160
  return this._client.post(path`/v3/chats/${chatID}/messages`, { body, ...options });
136
161
  }
137
-
138
- /**
139
- * Retrieve messages from a specific chat with pagination support.
140
- *
141
- * @example
142
- * ```ts
143
- * // Automatically fetches more pages as needed.
144
- * for await (const message of client.chats.messages.list(
145
- * '550e8400-e29b-41d4-a716-446655440000',
146
- * )) {
147
- * // ...
148
- * }
149
- * ```
150
- */
151
- list(
152
- chatID: string,
153
- query: MessageListParams | null | undefined = {},
154
- options?: RequestOptions,
155
- ): PagePromise<MessagesListMessagesPagination, MessagesAPI.Message> {
156
- return this._client.getAPIList(
157
- path`/v3/chats/${chatID}/messages`,
158
- ListMessagesPagination<MessagesAPI.Message>,
159
- { query, ...options },
160
- );
161
- }
162
162
  }
163
163
 
164
164
  /**
@@ -384,6 +384,8 @@ export interface MessageSendResponse {
384
384
  message: SentMessage;
385
385
  }
386
386
 
387
+ export interface MessageListParams extends ListMessagesPaginationParams {}
388
+
387
389
  export interface MessageSendParams {
388
390
  /**
389
391
  * Message content container. Groups all message-related fields together,
@@ -398,14 +400,12 @@ export interface MessageSendParams {
398
400
  message: ChatsAPI.MessageContent;
399
401
  }
400
402
 
401
- export interface MessageListParams extends ListMessagesPaginationParams {}
402
-
403
403
  export declare namespace Messages {
404
404
  export {
405
405
  type SentMessage as SentMessage,
406
406
  type MessageSendResponse as MessageSendResponse,
407
- type MessageSendParams as MessageSendParams,
408
407
  type MessageListParams as MessageListParams,
408
+ type MessageSendParams as MessageSendParams,
409
409
  };
410
410
  }
411
411