@linqapp/sdk 0.32.1 → 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.
Files changed (203) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +82 -112
  3. package/client.d.mts +42 -6
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +42 -6
  6. package/client.d.ts.map +1 -1
  7. package/client.js +39 -3
  8. package/client.js.map +1 -1
  9. package/client.mjs +39 -3
  10. package/client.mjs.map +1 -1
  11. package/core/error.d.mts +13 -0
  12. package/core/error.d.mts.map +1 -1
  13. package/core/error.d.ts +13 -0
  14. package/core/error.d.ts.map +1 -1
  15. package/core/error.js +5 -1
  16. package/core/error.js.map +1 -1
  17. package/core/error.mjs +5 -1
  18. package/core/error.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/resources/available-number.d.mts +13 -1
  21. package/resources/available-number.d.mts.map +1 -1
  22. package/resources/available-number.d.ts +13 -1
  23. package/resources/available-number.d.ts.map +1 -1
  24. package/resources/available-number.js +2 -1
  25. package/resources/available-number.js.map +1 -1
  26. package/resources/available-number.mjs +2 -1
  27. package/resources/available-number.mjs.map +1 -1
  28. package/resources/chats/chats.d.mts +175 -70
  29. package/resources/chats/chats.d.mts.map +1 -1
  30. package/resources/chats/chats.d.ts +175 -70
  31. package/resources/chats/chats.d.ts.map +1 -1
  32. package/resources/chats/chats.js +65 -61
  33. package/resources/chats/chats.js.map +1 -1
  34. package/resources/chats/chats.mjs +65 -61
  35. package/resources/chats/chats.mjs.map +1 -1
  36. package/resources/chats/index.d.mts +3 -2
  37. package/resources/chats/index.d.mts.map +1 -1
  38. package/resources/chats/index.d.ts +3 -2
  39. package/resources/chats/index.d.ts.map +1 -1
  40. package/resources/chats/index.js +3 -1
  41. package/resources/chats/index.js.map +1 -1
  42. package/resources/chats/index.mjs +1 -0
  43. package/resources/chats/index.mjs.map +1 -1
  44. package/resources/chats/location.d.mts +25 -25
  45. package/resources/chats/location.d.mts.map +1 -1
  46. package/resources/chats/location.d.ts +25 -25
  47. package/resources/chats/location.d.ts.map +1 -1
  48. package/resources/chats/location.js +27 -27
  49. package/resources/chats/location.js.map +1 -1
  50. package/resources/chats/location.mjs +27 -27
  51. package/resources/chats/location.mjs.map +1 -1
  52. package/resources/chats/messages.d.mts +28 -21
  53. package/resources/chats/messages.d.mts.map +1 -1
  54. package/resources/chats/messages.d.ts +28 -21
  55. package/resources/chats/messages.d.ts.map +1 -1
  56. package/resources/chats/messages.js +16 -16
  57. package/resources/chats/messages.js.map +1 -1
  58. package/resources/chats/messages.mjs +16 -16
  59. package/resources/chats/messages.mjs.map +1 -1
  60. package/resources/chats/polls.d.mts +171 -0
  61. package/resources/chats/polls.d.mts.map +1 -0
  62. package/resources/chats/polls.d.ts +171 -0
  63. package/resources/chats/polls.d.ts.map +1 -0
  64. package/resources/chats/polls.js +95 -0
  65. package/resources/chats/polls.js.map +1 -0
  66. package/resources/chats/polls.mjs +91 -0
  67. package/resources/chats/polls.mjs.map +1 -0
  68. package/resources/contact-card.d.mts +29 -28
  69. package/resources/contact-card.d.mts.map +1 -1
  70. package/resources/contact-card.d.ts +29 -28
  71. package/resources/contact-card.d.ts.map +1 -1
  72. package/resources/contact-card.js +23 -22
  73. package/resources/contact-card.js.map +1 -1
  74. package/resources/contact-card.mjs +23 -22
  75. package/resources/contact-card.mjs.map +1 -1
  76. package/resources/experiences.d.mts +91 -0
  77. package/resources/experiences.d.mts.map +1 -0
  78. package/resources/experiences.d.ts +91 -0
  79. package/resources/experiences.d.ts.map +1 -0
  80. package/resources/experiences.js +29 -0
  81. package/resources/experiences.js.map +1 -0
  82. package/resources/experiences.mjs +25 -0
  83. package/resources/experiences.mjs.map +1 -0
  84. package/resources/index.d.mts +7 -3
  85. package/resources/index.d.mts.map +1 -1
  86. package/resources/index.d.ts +7 -3
  87. package/resources/index.d.ts.map +1 -1
  88. package/resources/index.js +10 -2
  89. package/resources/index.js.map +1 -1
  90. package/resources/index.mjs +5 -1
  91. package/resources/index.mjs.map +1 -1
  92. package/resources/messages/index.d.mts +3 -0
  93. package/resources/messages/index.d.mts.map +1 -0
  94. package/resources/messages/index.d.ts +3 -0
  95. package/resources/messages/index.d.ts.map +1 -0
  96. package/resources/messages/index.js +9 -0
  97. package/resources/messages/index.js.map +1 -0
  98. package/resources/messages/index.mjs +4 -0
  99. package/resources/messages/index.mjs.map +1 -0
  100. package/resources/messages/messages.d.mts +795 -0
  101. package/resources/messages/messages.d.mts.map +1 -0
  102. package/resources/messages/messages.d.ts +795 -0
  103. package/resources/messages/messages.d.ts.map +1 -0
  104. package/resources/messages/messages.js +298 -0
  105. package/resources/messages/messages.js.map +1 -0
  106. package/resources/messages/messages.mjs +293 -0
  107. package/resources/messages/messages.mjs.map +1 -0
  108. package/resources/messages/poll.d.mts +131 -0
  109. package/resources/messages/poll.d.mts.map +1 -0
  110. package/resources/messages/poll.d.ts +131 -0
  111. package/resources/messages/poll.d.ts.map +1 -0
  112. package/resources/messages/poll.js +119 -0
  113. package/resources/messages/poll.js.map +1 -0
  114. package/resources/messages/poll.mjs +115 -0
  115. package/resources/messages/poll.mjs.map +1 -0
  116. package/resources/messages.d.mts +1 -747
  117. package/resources/messages.d.mts.map +1 -1
  118. package/resources/messages.d.ts +1 -747
  119. package/resources/messages.d.ts.map +1 -1
  120. package/resources/messages.js +2 -275
  121. package/resources/messages.js.map +1 -1
  122. package/resources/messages.mjs +1 -273
  123. package/resources/messages.mjs.map +1 -1
  124. package/resources/payment-handles.d.mts +87 -0
  125. package/resources/payment-handles.d.mts.map +1 -0
  126. package/resources/payment-handles.d.ts +87 -0
  127. package/resources/payment-handles.d.ts.map +1 -0
  128. package/resources/payment-handles.js +76 -0
  129. package/resources/payment-handles.js.map +1 -0
  130. package/resources/payment-handles.mjs +72 -0
  131. package/resources/payment-handles.mjs.map +1 -0
  132. package/resources/payment-providers.d.mts +58 -0
  133. package/resources/payment-providers.d.mts.map +1 -0
  134. package/resources/payment-providers.d.ts +58 -0
  135. package/resources/payment-providers.d.ts.map +1 -0
  136. package/resources/payment-providers.js +45 -0
  137. package/resources/payment-providers.js.map +1 -0
  138. package/resources/payment-providers.mjs +41 -0
  139. package/resources/payment-providers.mjs.map +1 -0
  140. package/resources/payment-requests.d.mts +2 -2
  141. package/resources/payment-requests.d.ts +2 -2
  142. package/resources/payment-requests.js +2 -2
  143. package/resources/payment-requests.mjs +2 -2
  144. package/resources/payments.d.mts +116 -0
  145. package/resources/payments.d.mts.map +1 -0
  146. package/resources/payments.d.ts +116 -0
  147. package/resources/payments.d.ts.map +1 -0
  148. package/resources/payments.js +70 -0
  149. package/resources/payments.js.map +1 -0
  150. package/resources/payments.mjs +66 -0
  151. package/resources/payments.mjs.map +1 -0
  152. package/resources/phone-numbers.d.mts +11 -11
  153. package/resources/phone-numbers.d.mts.map +1 -1
  154. package/resources/phone-numbers.d.ts +11 -11
  155. package/resources/phone-numbers.d.ts.map +1 -1
  156. package/resources/phone-numbers.js +13 -13
  157. package/resources/phone-numbers.js.map +1 -1
  158. package/resources/phone-numbers.mjs +13 -13
  159. package/resources/phone-numbers.mjs.map +1 -1
  160. package/resources/webhook-events.d.mts +1 -1
  161. package/resources/webhook-events.d.mts.map +1 -1
  162. package/resources/webhook-events.d.ts +1 -1
  163. package/resources/webhook-events.d.ts.map +1 -1
  164. package/resources/webhook-subscriptions.d.mts +11 -11
  165. package/resources/webhook-subscriptions.d.mts.map +1 -1
  166. package/resources/webhook-subscriptions.d.ts +11 -11
  167. package/resources/webhook-subscriptions.d.ts.map +1 -1
  168. package/resources/webhook-subscriptions.js +13 -13
  169. package/resources/webhook-subscriptions.js.map +1 -1
  170. package/resources/webhook-subscriptions.mjs +13 -13
  171. package/resources/webhook-subscriptions.mjs.map +1 -1
  172. package/resources/webhooks.d.mts +72 -1
  173. package/resources/webhooks.d.mts.map +1 -1
  174. package/resources/webhooks.d.ts +72 -1
  175. package/resources/webhooks.d.ts.map +1 -1
  176. package/src/client.ts +91 -20
  177. package/src/core/error.ts +20 -1
  178. package/src/resources/available-number.ts +14 -1
  179. package/src/resources/chats/chats.ts +203 -85
  180. package/src/resources/chats/index.ts +3 -2
  181. package/src/resources/chats/location.ts +28 -28
  182. package/src/resources/chats/messages.ts +40 -32
  183. package/src/resources/chats/polls.ts +196 -0
  184. package/src/resources/contact-card.ts +36 -35
  185. package/src/resources/experiences.ts +118 -0
  186. package/src/resources/index.ts +23 -5
  187. package/src/resources/messages/index.ts +18 -0
  188. package/src/resources/messages/messages.ts +958 -0
  189. package/src/resources/messages/poll.ts +151 -0
  190. package/src/resources/messages.ts +1 -894
  191. package/src/resources/payment-handles.ts +114 -0
  192. package/src/resources/payment-providers.ts +81 -0
  193. package/src/resources/payment-requests.ts +2 -2
  194. package/src/resources/payments.ts +163 -0
  195. package/src/resources/phone-numbers.ts +14 -14
  196. package/src/resources/webhook-events.ts +9 -0
  197. package/src/resources/webhook-subscriptions.ts +14 -14
  198. package/src/resources/webhooks.ts +82 -0
  199. package/src/version.ts +1 -1
  200. package/version.d.mts +1 -1
  201. package/version.d.ts +1 -1
  202. package/version.js +1 -1
  203. package/version.mjs +1 -1
@@ -1,896 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../core/resource';
4
- import * as Shared from './shared';
5
- import * as ChatsAPI from './chats/chats';
6
- import * as ChatsMessagesAPI from './chats/messages';
7
- import { APIPromise } from '../core/api-promise';
8
- import { ListMessagesPagination, type ListMessagesPaginationParams, PagePromise } from '../core/pagination';
9
- import { buildHeaders } from '../internal/headers';
10
- import { RequestOptions } from '../internal/request-options';
11
- import { path } from '../internal/utils/path';
12
-
13
- /**
14
- * Messages are individual communications within a chat thread.
15
- *
16
- * Messages can include text, media attachments, rich link previews, special effects
17
- * (like confetti or fireworks), and reactions. All messages are associated with a
18
- * specific chat and sent from a phone number you own.
19
- *
20
- * Messages support delivery status tracking, read receipts, and editing capabilities.
21
- *
22
- * ## Rich Link Previews
23
- *
24
- * Send a URL as a `link` part to deliver it with a rich preview card showing the
25
- * page's title, description, and image (when available). A `link` part must be the
26
- * **only** part in the message — it cannot be combined with text or media parts.
27
- * To send a URL without a preview card, include it in a `text` part instead.
28
- *
29
- * **Limitations:**
30
- * - A `link` part cannot be combined with other parts in the same message.
31
- * - Maximum URL length: 2,048 characters.
32
- *
33
- * ## Ephemeral Messages (Privacy Tier)
34
- *
35
- * For regulated or sensitive conversations, opt in to the **ephemeral messages** tier by contacting your Linq support contact. When enabled, every message on the covered phone numbers is automatically given a fixed **24-hour retention window** — after that window the platform permanently deletes the message from Linq storage. There is no per-message flag; ephemerality is applied automatically based on your configuration.
36
- *
37
- * You can request it at two scopes:
38
- *
39
- * | Scope | Effect |
40
- * |---|---|
41
- * | **Partner-wide** | Every outbound and inbound message on every phone number under your account is retained for 24 hours, then deleted. |
42
- * | **Per phone number** | Only the specified phone numbers have their messages auto-deleted. The rest follow the standard message-retention policy. |
43
- *
44
- * **Behavioral differences vs the standard default:**
45
- *
46
- * | Aspect | Standard | Ephemeral |
47
- * |---|---|---|
48
- * | Retention | Retained per the standard message-retention policy | **Hard backstop: 24 hours** from when the message is created |
49
- * | After expiry | Message stays retrievable | Message is permanently deleted — `GET /v3/messages/{messageId}` returns `404` and it no longer appears in `GET /v3/chats/{chatId}/messages` |
50
- * | Content on expiry | N/A | Text, formatting, and attachment references are scrubbed; the message is gone, not blanked out |
51
- * | Cross-partner isolation | Enforced | Enforced |
52
- *
53
- * **How the 24-hour window works:**
54
- *
55
- * - The window is fixed at **24 hours from message creation** (`created_at`) and cannot be configured per message.
56
- * - It mirrors the ephemeral *attachments* 1-day backstop, so a message and any media it carries expire together.
57
- * - Expiry is delivery-independent — the clock starts when the message is created, not when it is delivered or read.
58
- *
59
- * **What you observe:**
60
- *
61
- * - **No expiry timestamp is exposed.** API responses and webhook payloads do not include the deletion time. If you need it, compute `created_at + 24h` yourself.
62
- * - **No deletion webhook is sent.** There is no `message.deleted` event — a message simply stops being retrievable once its window passes.
63
- * - **Delivery is unaffected.** Ephemeral messages send, deliver, and fire the usual `message.sent` / `message.received` and status webhooks exactly like standard messages. Only retention changes.
64
- *
65
- * **When to choose ephemeral:**
66
- *
67
- * - You have a compliance requirement that the platform must not retain message content beyond a short window.
68
- * - The conversation is high-sensitivity (PHI, financial, identity verification) and you do not want it sitting in storage long-term.
69
- * - Your application is the system of record — you capture what you need from the delivery webhook in real time and do not rely on reading message history back from Linq later.
70
- *
71
- * **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.
72
- */
73
- export class Messages extends APIResource {
74
- /**
75
- * Send a message to one or more recipients **without supplying a `from` number**.
76
- * Linq resolves both the sending line and the target chat for you, then returns
77
- * exactly which line was used, which chat the message landed in, whether a new
78
- * chat was created, and every resulting message id.
79
- *
80
- * This fuses "create chat" and "send message" behind a single message-centric
81
- * resource. Provide only the recipients (`to`) and the `message`; the platform
82
- * decides the rest.
83
- *
84
- * ## How the from-number and chat are chosen
85
- *
86
- * - **Reuse** — if a chat with exactly these recipients already exists on a line
87
- * that can still send, the message is sent into that chat on its existing line
88
- * (`from_selection.reason = reused_active_chat`). The most-recently-active such
89
- * chat wins; chats stranded on flagged lines (e.g. by an earlier failover) are
90
- * skipped.
91
- * - **New** — if no such chat exists, a new chat is created on the best available
92
- * line (`from_selection.reason = new_best_number`).
93
- * - **Failover** — if matching chats exist but none is on a line that can send, a
94
- * **new** chat is created on a fresh best line and the flagged chat is abandoned
95
- * (`from_selection.reason = failover_flagged`, `previous_chat_id` set). If you
96
- * supply `continuation_message`, that text is sent as the single message INSTEAD
97
- * of `message` (useful as a fresh-number-appropriate opener). Exactly one
98
- * message is sent either way.
99
- *
100
- * Recipients (`to`) are an order-independent set: a single handle is a direct
101
- * chat, multiple handles a group chat.
102
- *
103
- * ## Differences from POST /v3/chats
104
- *
105
- * - The first message **may contain a link** (including for a newly created chat).
106
- * Note: sending a link as the very first message on a freshly selected line can
107
- * elevate that line's flagging risk — it is allowed, not recommended.
108
- * - Voice memos are **not** supported here. To send an iMessage voice-memo bubble,
109
- * use `POST /v3/chats/{chatId}/voicememo` with a known chat id.
110
- *
111
- * ## Service preference, effects, decorations
112
- *
113
- * Set `message.preferred_service` (`iMessage` | `RCS` | `SMS`), `message.effect`,
114
- * and per-part `text_decorations` exactly as on the other send endpoints.
115
- *
116
- * Always responds `202 Accepted` — chat creation is incidental to the send.
117
- *
118
- * @example
119
- * ```ts
120
- * const message = await client.messages.create({
121
- * message: {
122
- * parts: [
123
- * {
124
- * type: 'text',
125
- * value:
126
- * 'Hi! Thanks for reaching out — how can we help?',
127
- * },
128
- * ],
129
- * },
130
- * to: ['+14155559876'],
131
- * });
132
- * ```
133
- */
134
- create(params: MessageCreateParams, options?: RequestOptions): APIPromise<MessageCreateResponse> {
135
- const { 'Idempotency-Key': idempotencyKey, ...body } = params;
136
- return this._client.post('/v3/messages', {
137
- body,
138
- ...options,
139
- headers: buildHeaders([
140
- { ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) },
141
- options?.headers,
142
- ]),
143
- });
144
- }
145
-
146
- /**
147
- * Retrieve all messages in a conversation thread. Given any message ID in the
148
- * thread, returns the originator message and all replies in chronological order.
149
- *
150
- * If the message is not part of a thread, returns just that single message.
151
- *
152
- * Supports pagination and configurable ordering.
153
- *
154
- * @example
155
- * ```ts
156
- * // Automatically fetches more pages as needed.
157
- * for await (const message of client.messages.listMessagesThread(
158
- * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
159
- * )) {
160
- * // ...
161
- * }
162
- * ```
163
- */
164
- listMessagesThread(
165
- messageID: string,
166
- query: MessageListMessagesThreadParams | null | undefined = {},
167
- options?: RequestOptions,
168
- ): PagePromise<MessagesListMessagesPagination, Message> {
169
- return this._client.getAPIList(path`/v3/messages/${messageID}/thread`, ListMessagesPagination<Message>, {
170
- query,
171
- ...options,
172
- });
173
- }
174
-
175
- /**
176
- * Retrieve a specific message by its ID. This endpoint returns the full message
177
- * details including text, attachments, reactions, and metadata.
178
- *
179
- * @example
180
- * ```ts
181
- * const message = await client.messages.retrieve(
182
- * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
183
- * );
184
- * ```
185
- */
186
- retrieve(messageID: string, options?: RequestOptions): APIPromise<Message> {
187
- return this._client.get(path`/v3/messages/${messageID}`, options);
188
- }
189
-
190
- /**
191
- * Deletes a message from the Linq API only. This does NOT unsend or remove the
192
- * message from the actual chat — recipients will still see the message.
193
- *
194
- * @example
195
- * ```ts
196
- * await client.messages.delete(
197
- * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
198
- * );
199
- * ```
200
- */
201
- delete(messageID: string, options?: RequestOptions): APIPromise<void> {
202
- return this._client.delete(path`/v3/messages/${messageID}`, {
203
- ...options,
204
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
205
- });
206
- }
207
-
208
- /**
209
- * Add or remove emoji reactions to messages. Reactions let users express their
210
- * response to a message without sending a new message.
211
- *
212
- * **Supported Reactions:**
213
- *
214
- * - love ❤️
215
- * - like 👍
216
- * - dislike 👎
217
- * - laugh 😂
218
- * - emphasize ‼️
219
- * - question ❓
220
- * - custom - any emoji (use `custom_emoji` field to specify)
221
- *
222
- * @example
223
- * ```ts
224
- * const response = await client.messages.addReaction(
225
- * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
226
- * { operation: 'add', type: 'love' },
227
- * );
228
- * ```
229
- */
230
- addReaction(
231
- messageID: string,
232
- body: MessageAddReactionParams,
233
- options?: RequestOptions,
234
- ): APIPromise<MessageAddReactionResponse> {
235
- return this._client.post(path`/v3/messages/${messageID}/reactions`, { body, ...options });
236
- }
237
-
238
- /**
239
- * Edit the text content of a specific part of a previously sent message.
240
- *
241
- * **Note:** A message can be edited up to 5 times, and only within 15 minutes of
242
- * when it was originally sent.
243
- *
244
- * @example
245
- * ```ts
246
- * const message = await client.messages.update(
247
- * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
248
- * { text: 'This is the edited message content' },
249
- * );
250
- * ```
251
- */
252
- update(messageID: string, body: MessageUpdateParams, options?: RequestOptions): APIPromise<Message> {
253
- return this._client.patch(path`/v3/messages/${messageID}`, { body, ...options });
254
- }
255
-
256
- /**
257
- * Replaces a previously delivered `imessage_app` card on the recipient's screen
258
- * with new content, instead of posting a new bubble (like a game move redrawing
259
- * the board).
260
- *
261
- * The update is delivered as a **new message** with its own id and delivery
262
- * lifecycle (`message.sent` / `message.delivered` / `message.failed` webhooks fire
263
- * for the new id). To update the card again, reference the message id returned by
264
- * this call.
265
- *
266
- * Constraints:
267
- *
268
- * - The referenced message must be an `imessage_app` card sent by you (`400`
269
- * otherwise — inbound cards cannot be updated).
270
- * - The referenced card must already be delivered (`409` otherwise — retry after
271
- * the `message.delivered` webhook for it).
272
- * - The app identity (`team_id`, `bundle_id`, name) is inherited from the original
273
- * card and cannot change; only `url`, `fallback_text`, and `layout` are
274
- * replaced.
275
- * - iMessage-only, like all app cards.
276
- * - Concurrent updates against the same card are not serialized server-side; the
277
- * last one delivered wins on the recipient's screen. Serialize updates by always
278
- * referencing the message id returned by the previous call.
279
- *
280
- * @example
281
- * ```ts
282
- * const response = await client.messages.updateAppCard(
283
- * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
284
- * {
285
- * layout: { caption: 'Score: 2 – 1' },
286
- * fallback_text: 'Score update',
287
- * url: 'https://app.example.com/card?game=7f3a&move=2',
288
- * },
289
- * );
290
- * ```
291
- */
292
- updateAppCard(
293
- messageID: string,
294
- body: MessageUpdateAppCardParams,
295
- options?: RequestOptions,
296
- ): APIPromise<MessageUpdateAppCardResponse> {
297
- return this._client.post(path`/v3/messages/${messageID}/update`, { body, ...options });
298
- }
299
- }
300
-
301
- export type MessagesListMessagesPagination = ListMessagesPagination<Message>;
302
-
303
- export interface Message {
304
- /**
305
- * Unique identifier for the message
306
- */
307
- id: string;
308
-
309
- /**
310
- * ID of the chat this message belongs to
311
- */
312
- chat_id: string;
313
-
314
- /**
315
- * When the message was created
316
- */
317
- created_at: string;
318
-
319
- /**
320
- * Current delivery status of a message
321
- */
322
- delivery_status: 'pending' | 'queued' | 'sent' | 'delivered' | 'received' | 'read' | 'failed';
323
-
324
- /**
325
- * @deprecated DEPRECATED: Use `delivery_status` instead (true when
326
- * `delivery_status` is `delivered` or `read`). Whether the message has been
327
- * delivered.
328
- */
329
- is_delivered: boolean;
330
-
331
- /**
332
- * Whether this message was sent by the authenticated user
333
- */
334
- is_from_me: boolean;
335
-
336
- /**
337
- * @deprecated DEPRECATED: Use `delivery_status == "read"` instead. Whether the
338
- * message has been read.
339
- */
340
- is_read: boolean;
341
-
342
- /**
343
- * When the message was last updated
344
- */
345
- updated_at: string;
346
-
347
- /**
348
- * When the message was delivered
349
- */
350
- delivered_at?: string | null;
351
-
352
- /**
353
- * iMessage effect applied to a message (screen or bubble effect)
354
- */
355
- effect?: MessageEffect | null;
356
-
357
- /**
358
- * @deprecated DEPRECATED: Use from_handle instead. Phone number of the message
359
- * sender.
360
- */
361
- from?: string | null;
362
-
363
- /**
364
- * The sender of this message as a full handle object
365
- */
366
- from_handle?: Shared.ChatHandle | null;
367
-
368
- /**
369
- * Message parts in order (text, media, and link)
370
- */
371
- parts?: Array<
372
- | Shared.TextPartResponse
373
- | Shared.MediaPartResponse
374
- | Shared.LinkPartResponse
375
- | Message.IMessageAppPartResponse
376
- > | null;
377
-
378
- /**
379
- * Messaging service type
380
- */
381
- preferred_service?: Shared.ServiceType | null;
382
-
383
- /**
384
- * When the message was read
385
- */
386
- read_at?: string | null;
387
-
388
- /**
389
- * Indicates this message is a threaded reply to another message
390
- */
391
- reply_to?: ReplyTo | null;
392
-
393
- /**
394
- * When the message was sent
395
- */
396
- sent_at?: string | null;
397
-
398
- /**
399
- * Messaging service type
400
- */
401
- service?: Shared.ServiceType | null;
402
- }
403
-
404
- export namespace Message {
405
- /**
406
- * An iMessage app card part.
407
- */
408
- export interface IMessageAppPartResponse {
409
- /**
410
- * Identifies the iMessage app (Messages app extension) that backs the card.
411
- */
412
- app: IMessageAppPartResponse.App;
413
-
414
- /**
415
- * Visible layout of the card. At least one of `caption`, `subcaption`,
416
- * `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
417
- * the card renders as an empty bubble.
418
- *
419
- * `image_url` displays a preview image at the top of the card. The image renders
420
- * on the recipient's card whether or not they have your app installed. The small
421
- * icon beside the caption is the app's own icon and is not settable here.
422
- *
423
- * `* Note - requires a trusted chat w/ inbound activity`
424
- *
425
- * `image_title` and `image_subtitle` render as text overlaid on the image (title
426
- * bold, subtitle beneath it). They only appear when `image_url` is set — without
427
- * an image there is nothing to overlay — so setting either without `image_url` is
428
- * rejected.
429
- */
430
- layout: IMessageAppPartResponse.Layout;
431
-
432
- /**
433
- * Reactions on this message part
434
- */
435
- reactions: Array<Shared.Reaction> | null;
436
-
437
- /**
438
- * Indicates this is an iMessage app card part.
439
- */
440
- type: 'imessage_app';
441
-
442
- /**
443
- * The URL delivered to the iMessage app on tap.
444
- */
445
- url: string;
446
-
447
- /**
448
- * Fallback text for surfaces that cannot render the card.
449
- */
450
- fallback_text?: string | null;
451
- }
452
-
453
- export namespace IMessageAppPartResponse {
454
- /**
455
- * Identifies the iMessage app (Messages app extension) that backs the card.
456
- */
457
- export interface App {
458
- /**
459
- * Bundle identifier of the Messages app extension. Must not contain `:`.
460
- */
461
- bundle_id: string;
462
-
463
- /**
464
- * Display name of the app, shown by Messages' fallback UI.
465
- */
466
- name: string;
467
-
468
- /**
469
- * The app's 10-character uppercase alphanumeric team identifier.
470
- */
471
- team_id: string;
472
-
473
- /**
474
- * The owning app's App Store id (optional). When set, recipients without the
475
- * iMessage app installed see a "Get the app" affordance.
476
- */
477
- app_store_id?: number;
478
- }
479
-
480
- /**
481
- * Visible layout of the card. At least one of `caption`, `subcaption`,
482
- * `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
483
- * the card renders as an empty bubble.
484
- *
485
- * `image_url` displays a preview image at the top of the card. The image renders
486
- * on the recipient's card whether or not they have your app installed. The small
487
- * icon beside the caption is the app's own icon and is not settable here.
488
- *
489
- * `* Note - requires a trusted chat w/ inbound activity`
490
- *
491
- * `image_title` and `image_subtitle` render as text overlaid on the image (title
492
- * bold, subtitle beneath it). They only appear when `image_url` is set — without
493
- * an image there is nothing to overlay — so setting either without `image_url` is
494
- * rejected.
495
- */
496
- export interface Layout {
497
- /**
498
- * Primary label, top-left and bold.
499
- */
500
- caption?: string;
501
-
502
- /**
503
- * Text shown below `image_title`, overlaid on the card image. Requires
504
- * `image_url`.
505
- */
506
- image_subtitle?: string;
507
-
508
- /**
509
- * Bold text overlaid on the card image. Requires `image_url` (rejected without
510
- * it).
511
- */
512
- image_title?: string;
513
-
514
- /**
515
- * URL of an image (JPEG, PNG, HEIF, or WebP) to display as the card's preview
516
- * image; an unreachable or non-image URL returns a validation error. Renders for
517
- * all recipients regardless of whether they have the app. Note - requires a
518
- * trusted chat w/ inbound activity. In responses, this is the re-hosted
519
- * `cdn.linqapp.com` copy of the image you supplied, not your original URL.
520
- */
521
- image_url?: string;
522
-
523
- /**
524
- * Secondary label, below `caption` on the left.
525
- */
526
- subcaption?: string;
527
-
528
- /**
529
- * Label shown top-right.
530
- */
531
- trailing_caption?: string;
532
-
533
- /**
534
- * Label shown below `trailing_caption`, on the right.
535
- */
536
- trailing_subcaption?: string;
537
- }
538
- }
539
- }
540
-
541
- /**
542
- * iMessage effect applied to a message (screen or bubble effect)
543
- */
544
- export interface MessageEffect {
545
- /**
546
- * Name of the effect. Common values:
547
- *
548
- * - Screen effects: confetti, fireworks, lasers, sparkles, celebration, hearts,
549
- * love, balloons, happy_birthday, echo, spotlight
550
- * - Bubble effects: slam, loud, gentle, invisible
551
- */
552
- name?: string;
553
-
554
- /**
555
- * Type of effect
556
- */
557
- type?: 'screen' | 'bubble';
558
- }
559
-
560
- /**
561
- * Indicates this message is a threaded reply to another message
562
- */
563
- export interface ReplyTo {
564
- /**
565
- * The ID of the message to reply to
566
- */
567
- message_id: string;
568
-
569
- /**
570
- * The specific message part to reply to (0-based index). Defaults to 0 (first
571
- * part) if not provided. Use this when replying to a specific part of a multipart
572
- * message.
573
- */
574
- part_index?: number;
575
- }
576
-
577
- /**
578
- * Result of an auto-from send. Self-describing: which line was used, which chat
579
- * the message landed in, whether a new chat was created, and the resulting message
580
- * id(s).
581
- */
582
- export interface MessageCreateResponse {
583
- /**
584
- * The resolved chat (reused or newly created) the message landed in.
585
- */
586
- chat_id: string;
587
-
588
- /**
589
- * True when a new chat was created (new or failover), false on reuse.
590
- */
591
- created_new_chat: boolean;
592
-
593
- /**
594
- * The line (E.164) the message was actually sent from.
595
- */
596
- from: string;
597
-
598
- /**
599
- * Why this line/chat was chosen.
600
- */
601
- from_selection: MessageCreateResponse.FromSelection;
602
-
603
- /**
604
- * Participants of the resolved chat.
605
- */
606
- handles: Array<Shared.ChatHandle>;
607
-
608
- /**
609
- * Whether the resolved chat is a group chat.
610
- */
611
- is_group: boolean;
612
-
613
- /**
614
- * A message that was sent (used in CreateChat and SendMessage responses)
615
- */
616
- message: ChatsMessagesAPI.SentMessage;
617
-
618
- /**
619
- * Messaging service type
620
- */
621
- service: Shared.ServiceType;
622
-
623
- /**
624
- * Set ONLY on `failover_flagged`: the abandoned flagged chat that was NOT sent
625
- * into. Null otherwise.
626
- */
627
- previous_chat_id?: string | null;
628
- }
629
-
630
- export namespace MessageCreateResponse {
631
- /**
632
- * Why this line/chat was chosen.
633
- */
634
- export interface FromSelection {
635
- /**
636
- * - `reused_active_chat` — reused an existing chat on its healthy line
637
- * - `new_best_number` — created a new chat on the best available line
638
- * - `failover_flagged` — no existing chat for these recipients was on a line that
639
- * could send; created a new chat on a fresh line
640
- */
641
- reason: 'reused_active_chat' | 'new_best_number' | 'failover_flagged';
642
-
643
- /**
644
- * True only when an existing chat was reused.
645
- */
646
- reused_existing_chat: boolean;
647
- }
648
- }
649
-
650
- export interface MessageAddReactionResponse {
651
- message?: string;
652
-
653
- status?: string;
654
-
655
- trace_id?: string;
656
- }
657
-
658
- /**
659
- * Response for sending a message to a chat
660
- */
661
- export interface MessageUpdateAppCardResponse {
662
- /**
663
- * Unique identifier of the chat this message was sent to
664
- */
665
- chat_id: string;
666
-
667
- /**
668
- * A message that was sent (used in CreateChat and SendMessage responses)
669
- */
670
- message: ChatsMessagesAPI.SentMessage;
671
- }
672
-
673
- export interface MessageCreateParams {
674
- /**
675
- * Body param: Message content container. Groups all message-related fields
676
- * together, separating the "what" (message content) from the "where" (routing
677
- * fields like from/to).
678
- *
679
- * A message carries EITHER `parts` — text and attachments, which compose into one
680
- * bubble — or a single `action`, which invokes an experience inside Linq's
681
- * iMessage app. Never both: an app card is the whole message (Apple's `MSMessage`
682
- * cannot coexist with text), so copy and a card are two sends, not one.
683
- */
684
- message: ChatsAPI.MessageContent;
685
-
686
- /**
687
- * Body param: Recipient handles (E.164 phone numbers or email addresses). One
688
- * handle is a direct chat; multiple handles a group chat. Order-independent — the
689
- * set identifies the chat.
690
- */
691
- to: Array<string>;
692
-
693
- /**
694
- * Body param: Text-only fallback that **replaces** `message` ONLY on the failover
695
- * branch — when a chat with these recipients already existed but its line was
696
- * flagged, so a new chat is created on a fresh line. On that branch this text is
697
- * sent as the single message instead of `message` (the recipient is on a new
698
- * number, so you typically want a fresh-number-appropriate opener rather than the
699
- * original content). Ignored otherwise (a healthy reuse, or genuine first
700
- * contact). Carries no parts, media, or effects — exactly one message is ever
701
- * sent.
702
- */
703
- continuation_message?: MessageCreateParams.ContinuationMessage;
704
-
705
- /**
706
- * Header param: Optional idempotency key for the send. Reuse the same key to
707
- * safely retry without sending twice. May also be supplied as
708
- * `message.idempotency_key`.
709
- */
710
- 'Idempotency-Key'?: string;
711
- }
712
-
713
- export namespace MessageCreateParams {
714
- /**
715
- * Text-only fallback that **replaces** `message` ONLY on the failover branch —
716
- * when a chat with these recipients already existed but its line was flagged, so a
717
- * new chat is created on a fresh line. On that branch this text is sent as the
718
- * single message instead of `message` (the recipient is on a new number, so you
719
- * typically want a fresh-number-appropriate opener rather than the original
720
- * content). Ignored otherwise (a healthy reuse, or genuine first contact). Carries
721
- * no parts, media, or effects — exactly one message is ever sent.
722
- */
723
- export interface ContinuationMessage {
724
- /**
725
- * The replacement message text, sent as the single message on failover.
726
- */
727
- text: string;
728
- }
729
- }
730
-
731
- export interface MessageListMessagesThreadParams extends ListMessagesPaginationParams {
732
- /**
733
- * Sort order for messages (asc = oldest first, desc = newest first)
734
- */
735
- order?: 'asc' | 'desc';
736
- }
737
-
738
- export interface MessageAddReactionParams {
739
- /**
740
- * Whether to add or remove the reaction
741
- */
742
- operation: 'add' | 'remove';
743
-
744
- /**
745
- * Type of reaction. Standard iMessage tapbacks are love, like, dislike, laugh,
746
- * emphasize, question. Custom emoji reactions have type "custom" with the actual
747
- * emoji in the custom_emoji field. Sticker reactions have type "sticker" with
748
- * sticker attachment details in the sticker field.
749
- */
750
- type: Shared.ReactionType;
751
-
752
- /**
753
- * Custom emoji string. Required when type is "custom".
754
- */
755
- custom_emoji?: string;
756
-
757
- /**
758
- * Optional index of the message part to react to. If not provided, reacts to the
759
- * entire message (part 0).
760
- */
761
- part_index?: number;
762
- }
763
-
764
- export interface MessageUpdateParams {
765
- /**
766
- * New text content for the message part
767
- */
768
- text: string;
769
-
770
- /**
771
- * Index of the message part to edit. Defaults to 0.
772
- */
773
- part_index?: number;
774
- }
775
-
776
- export interface MessageUpdateAppCardParams {
777
- /**
778
- * Visible layout of the card. At least one of `caption`, `subcaption`,
779
- * `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
780
- * the card renders as an empty bubble.
781
- *
782
- * `image_url` displays a preview image at the top of the card. The image renders
783
- * on the recipient's card whether or not they have your app installed. The small
784
- * icon beside the caption is the app's own icon and is not settable here.
785
- *
786
- * `* Note - requires a trusted chat w/ inbound activity`
787
- *
788
- * `image_title` and `image_subtitle` render as text overlaid on the image (title
789
- * bold, subtitle beneath it). They only appear when `image_url` is set — without
790
- * an image there is nothing to overlay — so setting either without `image_url` is
791
- * rejected.
792
- */
793
- layout: MessageUpdateAppCardParams.Layout;
794
-
795
- /**
796
- * Text shown on surfaces that cannot render the card (notifications, lock screen).
797
- * Defaults to the caption when omitted.
798
- */
799
- fallback_text?: string;
800
-
801
- /**
802
- * Whether the updated card renders as your app's interactive balloon for
803
- * recipients who have your iMessage app installed. `true` (default) lets your
804
- * installed extension draw its live view; `false` always shows the static `layout`
805
- * card. Recipients without your app always see the static card regardless of this
806
- * flag.
807
- *
808
- * Defaults to `true` when omitted — it is **not** inherited from the original
809
- * card. To keep a card static across updates, re-send `interactive: false` on each
810
- * update.
811
- */
812
- interactive?: boolean;
813
-
814
- /**
815
- * URL the recipient's app opens when they tap the updated card.
816
- */
817
- url?: string;
818
- }
819
-
820
- export namespace MessageUpdateAppCardParams {
821
- /**
822
- * Visible layout of the card. At least one of `caption`, `subcaption`,
823
- * `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
824
- * the card renders as an empty bubble.
825
- *
826
- * `image_url` displays a preview image at the top of the card. The image renders
827
- * on the recipient's card whether or not they have your app installed. The small
828
- * icon beside the caption is the app's own icon and is not settable here.
829
- *
830
- * `* Note - requires a trusted chat w/ inbound activity`
831
- *
832
- * `image_title` and `image_subtitle` render as text overlaid on the image (title
833
- * bold, subtitle beneath it). They only appear when `image_url` is set — without
834
- * an image there is nothing to overlay — so setting either without `image_url` is
835
- * rejected.
836
- */
837
- export interface Layout {
838
- /**
839
- * Primary label, top-left and bold.
840
- */
841
- caption?: string;
842
-
843
- /**
844
- * Text shown below `image_title`, overlaid on the card image. Requires
845
- * `image_url`.
846
- */
847
- image_subtitle?: string;
848
-
849
- /**
850
- * Bold text overlaid on the card image. Requires `image_url` (rejected without
851
- * it).
852
- */
853
- image_title?: string;
854
-
855
- /**
856
- * URL of an image (JPEG, PNG, HEIF, or WebP) to display as the card's preview
857
- * image; an unreachable or non-image URL returns a validation error. Renders for
858
- * all recipients regardless of whether they have the app. Note - requires a
859
- * trusted chat w/ inbound activity. In responses, this is the re-hosted
860
- * `cdn.linqapp.com` copy of the image you supplied, not your original URL.
861
- */
862
- image_url?: string;
863
-
864
- /**
865
- * Secondary label, below `caption` on the left.
866
- */
867
- subcaption?: string;
868
-
869
- /**
870
- * Label shown top-right.
871
- */
872
- trailing_caption?: string;
873
-
874
- /**
875
- * Label shown below `trailing_caption`, on the right.
876
- */
877
- trailing_subcaption?: string;
878
- }
879
- }
880
-
881
- export declare namespace Messages {
882
- export {
883
- type Message as Message,
884
- type MessageEffect as MessageEffect,
885
- type ReplyTo as ReplyTo,
886
- type MessageCreateResponse as MessageCreateResponse,
887
- type MessageAddReactionResponse as MessageAddReactionResponse,
888
- type MessageUpdateAppCardResponse as MessageUpdateAppCardResponse,
889
- type MessagesListMessagesPagination as MessagesListMessagesPagination,
890
- type MessageCreateParams as MessageCreateParams,
891
- type MessageListMessagesThreadParams as MessageListMessagesThreadParams,
892
- type MessageAddReactionParams as MessageAddReactionParams,
893
- type MessageUpdateParams as MessageUpdateParams,
894
- type MessageUpdateAppCardParams as MessageUpdateAppCardParams,
895
- };
896
- }
3
+ export * from './messages/index';