@linqapp/sdk 0.26.0 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -3
- package/README.md +2 -2
- package/client.d.mts +16 -5
- package/client.d.mts.map +1 -1
- package/client.d.ts +16 -5
- package/client.d.ts.map +1 -1
- package/client.js +5 -1
- package/client.js.map +1 -1
- package/client.mjs +5 -1
- package/client.mjs.map +1 -1
- package/package.json +4 -2
- package/resources/capability.d.mts +4 -4
- package/resources/capability.d.ts +4 -4
- package/resources/capability.js +2 -2
- package/resources/capability.mjs +2 -2
- package/resources/chats/chats.d.mts +100 -1
- package/resources/chats/chats.d.mts.map +1 -1
- package/resources/chats/chats.d.ts +100 -1
- package/resources/chats/chats.d.ts.map +1 -1
- package/resources/chats/chats.js.map +1 -1
- package/resources/chats/chats.mjs.map +1 -1
- package/resources/chats/messages.d.mts +101 -3
- package/resources/chats/messages.d.mts.map +1 -1
- package/resources/chats/messages.d.ts +101 -3
- package/resources/chats/messages.d.ts.map +1 -1
- package/resources/index.d.mts +2 -2
- package/resources/index.d.ts +2 -2
- package/resources/messages.d.mts +107 -3
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +107 -3
- package/resources/messages.d.ts.map +1 -1
- package/resources/webhooks.d.mts +178 -5
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +178 -5
- package/resources/webhooks.d.ts.map +1 -1
- package/resources/webhooks.js +9 -1
- package/resources/webhooks.js.map +1 -1
- package/resources/webhooks.mjs +9 -1
- package/resources/webhooks.mjs.map +1 -1
- package/src/client.ts +20 -4
- package/src/resources/capability.ts +5 -5
- package/src/resources/chats/chats.ts +117 -1
- package/src/resources/chats/messages.ts +124 -3
- package/src/resources/index.ts +2 -2
- package/src/resources/messages.ts +131 -3
- package/src/resources/webhooks.ts +230 -6
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/resources/webhooks.mjs
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { Webhook } from 'standardwebhooks';
|
|
3
4
|
export class Webhooks extends APIResource {
|
|
4
|
-
|
|
5
|
+
unwrap(body, { headers, key }) {
|
|
6
|
+
if (headers !== undefined) {
|
|
7
|
+
const keyStr = key === undefined ? this._client.webhookSecret : key;
|
|
8
|
+
if (keyStr === null)
|
|
9
|
+
throw new Error('Webhook key must not be null in order to unwrap');
|
|
10
|
+
const wh = new Webhook(keyStr);
|
|
11
|
+
wh.verify(body, headers);
|
|
12
|
+
}
|
|
5
13
|
return JSON.parse(body);
|
|
6
14
|
}
|
|
7
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.mjs","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;
|
|
1
|
+
{"version":3,"file":"webhooks.mjs","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAG/C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC,MAAM,CACJ,IAAY,EACZ,EAAE,OAAO,EAAE,GAAG,EAAqD;QAEnE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,MAAM,GAAkB,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC;YACnF,IAAI,MAAM,KAAK,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;YACxF,MAAM,EAAE,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;YAC/B,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAuB,CAAC;IAChD,CAAC;CACF"}
|
package/src/client.ts
CHANGED
|
@@ -34,8 +34,8 @@ import {
|
|
|
34
34
|
} from './resources/attachments';
|
|
35
35
|
import {
|
|
36
36
|
Capability,
|
|
37
|
+
CapabilityCheckIMessageParams,
|
|
37
38
|
CapabilityCheckRCSParams,
|
|
38
|
-
CapabilityCheckiMessageParams,
|
|
39
39
|
HandleCheck,
|
|
40
40
|
HandleCheckResponse,
|
|
41
41
|
} from './resources/capability';
|
|
@@ -77,7 +77,6 @@ import {
|
|
|
77
77
|
ChatGroupNameUpdatedWebhookEvent,
|
|
78
78
|
ChatTypingIndicatorStartedWebhookEvent,
|
|
79
79
|
ChatTypingIndicatorStoppedWebhookEvent,
|
|
80
|
-
EventsWebhookEvent,
|
|
81
80
|
MessageDeliveredWebhookEvent,
|
|
82
81
|
MessageEditedWebhookEvent,
|
|
83
82
|
MessageEventV2,
|
|
@@ -95,6 +94,7 @@ import {
|
|
|
95
94
|
SchemasMediaPartResponse,
|
|
96
95
|
SchemasMessageEffect,
|
|
97
96
|
SchemasTextPartResponse,
|
|
97
|
+
UnwrapWebhookEvent,
|
|
98
98
|
Webhooks,
|
|
99
99
|
} from './resources/webhooks';
|
|
100
100
|
import {
|
|
@@ -136,6 +136,16 @@ export interface ClientOptions {
|
|
|
136
136
|
*/
|
|
137
137
|
apiKey?: string | undefined;
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Webhook signing secret used by `client.webhooks.unwrap()` to verify the
|
|
141
|
+
* Standard Webhooks signature on incoming webhook requests.
|
|
142
|
+
*
|
|
143
|
+
* Format: a base64-encoded key, optionally with a `whsec_` prefix
|
|
144
|
+
* (e.g. `whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw7Jxx2Oll+OE=`).
|
|
145
|
+
*
|
|
146
|
+
*/
|
|
147
|
+
webhookSecret?: string | null | undefined;
|
|
148
|
+
|
|
139
149
|
/**
|
|
140
150
|
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
141
151
|
*
|
|
@@ -210,6 +220,7 @@ export interface ClientOptions {
|
|
|
210
220
|
*/
|
|
211
221
|
export class LinqAPIV3 {
|
|
212
222
|
apiKey: string;
|
|
223
|
+
webhookSecret: string | null;
|
|
213
224
|
|
|
214
225
|
baseURL: string;
|
|
215
226
|
maxRetries: number;
|
|
@@ -227,6 +238,7 @@ export class LinqAPIV3 {
|
|
|
227
238
|
* API Client for interfacing with the Linq API V3 API.
|
|
228
239
|
*
|
|
229
240
|
* @param {string | undefined} [opts.apiKey=process.env['LINQ_API_V3_API_KEY'] ?? undefined]
|
|
241
|
+
* @param {string | null | undefined} [opts.webhookSecret=process.env['LINQ_WEBHOOK_SECRET'] ?? null]
|
|
230
242
|
* @param {string} [opts.baseURL=process.env['LINQ_API_V3_BASE_URL'] ?? https://api.linqapp.com/api/partner] - Override the default base URL for the API.
|
|
231
243
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
232
244
|
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
@@ -238,6 +250,7 @@ export class LinqAPIV3 {
|
|
|
238
250
|
constructor({
|
|
239
251
|
baseURL = readEnv('LINQ_API_V3_BASE_URL'),
|
|
240
252
|
apiKey = readEnv('LINQ_API_V3_API_KEY'),
|
|
253
|
+
webhookSecret = readEnv('LINQ_WEBHOOK_SECRET') ?? null,
|
|
241
254
|
...opts
|
|
242
255
|
}: ClientOptions = {}) {
|
|
243
256
|
if (apiKey === undefined) {
|
|
@@ -248,6 +261,7 @@ export class LinqAPIV3 {
|
|
|
248
261
|
|
|
249
262
|
const options: ClientOptions = {
|
|
250
263
|
apiKey,
|
|
264
|
+
webhookSecret,
|
|
251
265
|
...opts,
|
|
252
266
|
baseURL: baseURL || `https://api.linqapp.com/api/partner`,
|
|
253
267
|
};
|
|
@@ -282,6 +296,7 @@ export class LinqAPIV3 {
|
|
|
282
296
|
this._options = options;
|
|
283
297
|
|
|
284
298
|
this.apiKey = apiKey;
|
|
299
|
+
this.webhookSecret = webhookSecret;
|
|
285
300
|
}
|
|
286
301
|
|
|
287
302
|
/**
|
|
@@ -298,6 +313,7 @@ export class LinqAPIV3 {
|
|
|
298
313
|
fetch: this.fetch,
|
|
299
314
|
fetchOptions: this.fetchOptions,
|
|
300
315
|
apiKey: this.apiKey,
|
|
316
|
+
webhookSecret: this.webhookSecret,
|
|
301
317
|
...options,
|
|
302
318
|
});
|
|
303
319
|
return client;
|
|
@@ -1446,7 +1462,7 @@ export declare namespace LinqAPIV3 {
|
|
|
1446
1462
|
Capability as Capability,
|
|
1447
1463
|
type HandleCheck as HandleCheck,
|
|
1448
1464
|
type HandleCheckResponse as HandleCheckResponse,
|
|
1449
|
-
type
|
|
1465
|
+
type CapabilityCheckIMessageParams as CapabilityCheckIMessageParams,
|
|
1450
1466
|
type CapabilityCheckRCSParams as CapabilityCheckRCSParams,
|
|
1451
1467
|
};
|
|
1452
1468
|
|
|
@@ -1476,7 +1492,7 @@ export declare namespace LinqAPIV3 {
|
|
|
1476
1492
|
type ChatTypingIndicatorStartedWebhookEvent as ChatTypingIndicatorStartedWebhookEvent,
|
|
1477
1493
|
type ChatTypingIndicatorStoppedWebhookEvent as ChatTypingIndicatorStoppedWebhookEvent,
|
|
1478
1494
|
type PhoneNumberStatusUpdatedWebhookEvent as PhoneNumberStatusUpdatedWebhookEvent,
|
|
1479
|
-
type
|
|
1495
|
+
type UnwrapWebhookEvent as UnwrapWebhookEvent,
|
|
1480
1496
|
};
|
|
1481
1497
|
|
|
1482
1498
|
export {
|
|
@@ -15,13 +15,13 @@ export class Capability extends APIResource {
|
|
|
15
15
|
* @example
|
|
16
16
|
* ```ts
|
|
17
17
|
* const handleCheckResponse =
|
|
18
|
-
* await client.capability.
|
|
18
|
+
* await client.capability.checkIMessage({
|
|
19
19
|
* address: '+15551234567',
|
|
20
20
|
* });
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
|
|
24
|
-
body:
|
|
23
|
+
checkIMessage(
|
|
24
|
+
body: CapabilityCheckIMessageParams,
|
|
25
25
|
options?: RequestOptions,
|
|
26
26
|
): APIPromise<HandleCheckResponse> {
|
|
27
27
|
return this._client.post('/v3/capability/check_imessage', { body, ...options });
|
|
@@ -68,7 +68,7 @@ export interface HandleCheckResponse {
|
|
|
68
68
|
available: boolean;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
export interface
|
|
71
|
+
export interface CapabilityCheckIMessageParams {
|
|
72
72
|
/**
|
|
73
73
|
* The recipient phone number or email address to check
|
|
74
74
|
*/
|
|
@@ -98,7 +98,7 @@ export declare namespace Capability {
|
|
|
98
98
|
export {
|
|
99
99
|
type HandleCheck as HandleCheck,
|
|
100
100
|
type HandleCheckResponse as HandleCheckResponse,
|
|
101
|
-
type
|
|
101
|
+
type CapabilityCheckIMessageParams as CapabilityCheckIMessageParams,
|
|
102
102
|
type CapabilityCheckRCSParams as CapabilityCheckRCSParams,
|
|
103
103
|
};
|
|
104
104
|
}
|
|
@@ -478,7 +478,7 @@ export interface MessageContent {
|
|
|
478
478
|
* sub-limit. For bulk media sends exceeding 40 files, pre-upload via
|
|
479
479
|
* `POST /v3/attachments` and reference by `attachment_id` or `download_url`.
|
|
480
480
|
*/
|
|
481
|
-
parts: Array<TextPart | MediaPart | LinkPart>;
|
|
481
|
+
parts: Array<TextPart | MediaPart | LinkPart | MessageContent.IMessageAppPart>;
|
|
482
482
|
|
|
483
483
|
/**
|
|
484
484
|
* iMessage effect to apply to this message (screen or bubble effect)
|
|
@@ -502,6 +502,122 @@ export interface MessageContent {
|
|
|
502
502
|
reply_to?: MessagesAPI.ReplyTo;
|
|
503
503
|
}
|
|
504
504
|
|
|
505
|
+
export namespace MessageContent {
|
|
506
|
+
/**
|
|
507
|
+
* An iMessage app card, backed by a Messages app extension. iMessage only — an
|
|
508
|
+
* `imessage_app` part must be the **only** part in the message and is never
|
|
509
|
+
* delivered over SMS/RCS. See the IMessageAppServiceUnsupported (2018) and
|
|
510
|
+
* RecipientUnsupportedMessageType (4005) error codes.
|
|
511
|
+
*/
|
|
512
|
+
export interface IMessageAppPart {
|
|
513
|
+
/**
|
|
514
|
+
* Identifies the iMessage app (Messages app extension) that backs the card.
|
|
515
|
+
*/
|
|
516
|
+
app: IMessageAppPart.App;
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Visible layout of the card. At least one of `caption`, `subcaption`,
|
|
520
|
+
* `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
|
|
521
|
+
* the card renders as an empty bubble.
|
|
522
|
+
*/
|
|
523
|
+
layout: IMessageAppPart.Layout;
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Indicates this is an iMessage app card part.
|
|
527
|
+
*/
|
|
528
|
+
type: 'imessage_app';
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Absolute HTTPS URL delivered to the recipient's installed iMessage app when they
|
|
532
|
+
* tap the card. Opaque to Messages.
|
|
533
|
+
*/
|
|
534
|
+
url: string;
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Text shown on surfaces that cannot render the card (notifications, lock screen).
|
|
538
|
+
* Defaults to the caption when omitted.
|
|
539
|
+
*/
|
|
540
|
+
fallback_text?: string;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Optional client-supplied identifier to correlate updatable/collaborative app
|
|
544
|
+
* sessions (advanced). Not interpreted by Synapse.
|
|
545
|
+
*/
|
|
546
|
+
session_id?: string;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export namespace IMessageAppPart {
|
|
550
|
+
/**
|
|
551
|
+
* Identifies the iMessage app (Messages app extension) that backs the card.
|
|
552
|
+
*/
|
|
553
|
+
export interface App {
|
|
554
|
+
/**
|
|
555
|
+
* Bundle identifier of the Messages app extension. Must not contain `:`.
|
|
556
|
+
*/
|
|
557
|
+
bundle_id: string;
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Display name of the app, shown by Messages' fallback UI.
|
|
561
|
+
*/
|
|
562
|
+
name: string;
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* The app's 10-character uppercase alphanumeric team identifier.
|
|
566
|
+
*/
|
|
567
|
+
team_id: string;
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* The owning app's App Store id (optional). When set, recipients without the
|
|
571
|
+
* iMessage app installed see a "Get the app" affordance.
|
|
572
|
+
*/
|
|
573
|
+
app_store_id?: number;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Visible layout of the card. At least one of `caption`, `subcaption`,
|
|
578
|
+
* `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
|
|
579
|
+
* the card renders as an empty bubble.
|
|
580
|
+
*/
|
|
581
|
+
export interface Layout {
|
|
582
|
+
/**
|
|
583
|
+
* Primary label, top-left and bold.
|
|
584
|
+
*/
|
|
585
|
+
caption?: string;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Overlay text shown below `image_title`. Requires `image_url`.
|
|
589
|
+
*/
|
|
590
|
+
image_subtitle?: string;
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Overlay text shown above the image. Requires `image_url`.
|
|
594
|
+
*/
|
|
595
|
+
image_title?: string;
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Optional HTTPS URL of a preview image. The server downloads it and embeds it in
|
|
599
|
+
* the card as JPEG (10MB max, same fetch rules as media parts).
|
|
600
|
+
*/
|
|
601
|
+
image_url?: string;
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Secondary label, below `caption` on the left.
|
|
605
|
+
*/
|
|
606
|
+
subcaption?: string;
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Label shown top-right.
|
|
610
|
+
*/
|
|
611
|
+
trailing_caption?: string;
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Label shown below `trailing_caption`, on the right.
|
|
615
|
+
*/
|
|
616
|
+
trailing_subcaption?: string;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
|
|
505
621
|
export interface TextPart {
|
|
506
622
|
/**
|
|
507
623
|
* Indicates this is a text message part
|
|
@@ -138,17 +138,23 @@ export interface SentMessage {
|
|
|
138
138
|
/**
|
|
139
139
|
* Current delivery status of a message
|
|
140
140
|
*/
|
|
141
|
-
delivery_status: 'pending' | 'queued' | 'sent' | 'delivered' | 'failed';
|
|
141
|
+
delivery_status: 'pending' | 'queued' | 'sent' | 'delivered' | 'received' | 'read' | 'failed';
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
|
-
*
|
|
144
|
+
* @deprecated DEPRECATED: Use `delivery_status == "read"` instead. Whether the
|
|
145
|
+
* message has been read.
|
|
145
146
|
*/
|
|
146
147
|
is_read: boolean;
|
|
147
148
|
|
|
148
149
|
/**
|
|
149
150
|
* Message parts in order (text, media, and link)
|
|
150
151
|
*/
|
|
151
|
-
parts: Array<
|
|
152
|
+
parts: Array<
|
|
153
|
+
| Shared.TextPartResponse
|
|
154
|
+
| Shared.MediaPartResponse
|
|
155
|
+
| Shared.LinkPartResponse
|
|
156
|
+
| SentMessage.IMessageAppPartResponse
|
|
157
|
+
>;
|
|
152
158
|
|
|
153
159
|
/**
|
|
154
160
|
* When the message was actually sent (null if still queued)
|
|
@@ -186,6 +192,121 @@ export interface SentMessage {
|
|
|
186
192
|
service?: Shared.ServiceType | null;
|
|
187
193
|
}
|
|
188
194
|
|
|
195
|
+
export namespace SentMessage {
|
|
196
|
+
/**
|
|
197
|
+
* An iMessage app card part.
|
|
198
|
+
*/
|
|
199
|
+
export interface IMessageAppPartResponse {
|
|
200
|
+
/**
|
|
201
|
+
* Identifies the iMessage app (Messages app extension) that backs the card.
|
|
202
|
+
*/
|
|
203
|
+
app: IMessageAppPartResponse.App;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Visible layout of the card. At least one of `caption`, `subcaption`,
|
|
207
|
+
* `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
|
|
208
|
+
* the card renders as an empty bubble.
|
|
209
|
+
*/
|
|
210
|
+
layout: IMessageAppPartResponse.Layout;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Reactions on this message part
|
|
214
|
+
*/
|
|
215
|
+
reactions: Array<Shared.Reaction> | null;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Indicates this is an iMessage app card part.
|
|
219
|
+
*/
|
|
220
|
+
type: 'imessage_app';
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* The URL delivered to the iMessage app on tap.
|
|
224
|
+
*/
|
|
225
|
+
url: string;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Fallback text for surfaces that cannot render the card.
|
|
229
|
+
*/
|
|
230
|
+
fallback_text?: string | null;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Client-supplied session identifier, echoed back when provided.
|
|
234
|
+
*/
|
|
235
|
+
session_id?: string | null;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export namespace IMessageAppPartResponse {
|
|
239
|
+
/**
|
|
240
|
+
* Identifies the iMessage app (Messages app extension) that backs the card.
|
|
241
|
+
*/
|
|
242
|
+
export interface App {
|
|
243
|
+
/**
|
|
244
|
+
* Bundle identifier of the Messages app extension. Must not contain `:`.
|
|
245
|
+
*/
|
|
246
|
+
bundle_id: string;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Display name of the app, shown by Messages' fallback UI.
|
|
250
|
+
*/
|
|
251
|
+
name: string;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* The app's 10-character uppercase alphanumeric team identifier.
|
|
255
|
+
*/
|
|
256
|
+
team_id: string;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* The owning app's App Store id (optional). When set, recipients without the
|
|
260
|
+
* iMessage app installed see a "Get the app" affordance.
|
|
261
|
+
*/
|
|
262
|
+
app_store_id?: number;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Visible layout of the card. At least one of `caption`, `subcaption`,
|
|
267
|
+
* `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
|
|
268
|
+
* the card renders as an empty bubble.
|
|
269
|
+
*/
|
|
270
|
+
export interface Layout {
|
|
271
|
+
/**
|
|
272
|
+
* Primary label, top-left and bold.
|
|
273
|
+
*/
|
|
274
|
+
caption?: string;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Overlay text shown below `image_title`. Requires `image_url`.
|
|
278
|
+
*/
|
|
279
|
+
image_subtitle?: string;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Overlay text shown above the image. Requires `image_url`.
|
|
283
|
+
*/
|
|
284
|
+
image_title?: string;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Optional HTTPS URL of a preview image. The server downloads it and embeds it in
|
|
288
|
+
* the card as JPEG (10MB max, same fetch rules as media parts).
|
|
289
|
+
*/
|
|
290
|
+
image_url?: string;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Secondary label, below `caption` on the left.
|
|
294
|
+
*/
|
|
295
|
+
subcaption?: string;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Label shown top-right.
|
|
299
|
+
*/
|
|
300
|
+
trailing_caption?: string;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Label shown below `trailing_caption`, on the right.
|
|
304
|
+
*/
|
|
305
|
+
trailing_subcaption?: string;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
189
310
|
/**
|
|
190
311
|
* Response for sending a message to a chat
|
|
191
312
|
*/
|
package/src/resources/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ export {
|
|
|
12
12
|
Capability,
|
|
13
13
|
type HandleCheck,
|
|
14
14
|
type HandleCheckResponse,
|
|
15
|
-
type
|
|
15
|
+
type CapabilityCheckIMessageParams,
|
|
16
16
|
type CapabilityCheckRCSParams,
|
|
17
17
|
} from './capability';
|
|
18
18
|
export {
|
|
@@ -88,5 +88,5 @@ export {
|
|
|
88
88
|
type ChatTypingIndicatorStartedWebhookEvent,
|
|
89
89
|
type ChatTypingIndicatorStoppedWebhookEvent,
|
|
90
90
|
type PhoneNumberStatusUpdatedWebhookEvent,
|
|
91
|
-
type
|
|
91
|
+
type UnwrapWebhookEvent,
|
|
92
92
|
} from './webhooks';
|
|
@@ -159,7 +159,14 @@ export interface Message {
|
|
|
159
159
|
created_at: string;
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
|
-
*
|
|
162
|
+
* Current delivery status of a message
|
|
163
|
+
*/
|
|
164
|
+
delivery_status: 'pending' | 'queued' | 'sent' | 'delivered' | 'received' | 'read' | 'failed';
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @deprecated DEPRECATED: Use `delivery_status` instead (true when
|
|
168
|
+
* `delivery_status` is `delivered` or `read`). Whether the message has been
|
|
169
|
+
* delivered.
|
|
163
170
|
*/
|
|
164
171
|
is_delivered: boolean;
|
|
165
172
|
|
|
@@ -169,7 +176,8 @@ export interface Message {
|
|
|
169
176
|
is_from_me: boolean;
|
|
170
177
|
|
|
171
178
|
/**
|
|
172
|
-
*
|
|
179
|
+
* @deprecated DEPRECATED: Use `delivery_status == "read"` instead. Whether the
|
|
180
|
+
* message has been read.
|
|
173
181
|
*/
|
|
174
182
|
is_read: boolean;
|
|
175
183
|
|
|
@@ -202,7 +210,12 @@ export interface Message {
|
|
|
202
210
|
/**
|
|
203
211
|
* Message parts in order (text, media, and link)
|
|
204
212
|
*/
|
|
205
|
-
parts?: Array<
|
|
213
|
+
parts?: Array<
|
|
214
|
+
| Shared.TextPartResponse
|
|
215
|
+
| Shared.MediaPartResponse
|
|
216
|
+
| Shared.LinkPartResponse
|
|
217
|
+
| Message.IMessageAppPartResponse
|
|
218
|
+
> | null;
|
|
206
219
|
|
|
207
220
|
/**
|
|
208
221
|
* Messaging service type
|
|
@@ -230,6 +243,121 @@ export interface Message {
|
|
|
230
243
|
service?: Shared.ServiceType | null;
|
|
231
244
|
}
|
|
232
245
|
|
|
246
|
+
export namespace Message {
|
|
247
|
+
/**
|
|
248
|
+
* An iMessage app card part.
|
|
249
|
+
*/
|
|
250
|
+
export interface IMessageAppPartResponse {
|
|
251
|
+
/**
|
|
252
|
+
* Identifies the iMessage app (Messages app extension) that backs the card.
|
|
253
|
+
*/
|
|
254
|
+
app: IMessageAppPartResponse.App;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Visible layout of the card. At least one of `caption`, `subcaption`,
|
|
258
|
+
* `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
|
|
259
|
+
* the card renders as an empty bubble.
|
|
260
|
+
*/
|
|
261
|
+
layout: IMessageAppPartResponse.Layout;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Reactions on this message part
|
|
265
|
+
*/
|
|
266
|
+
reactions: Array<Shared.Reaction> | null;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Indicates this is an iMessage app card part.
|
|
270
|
+
*/
|
|
271
|
+
type: 'imessage_app';
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* The URL delivered to the iMessage app on tap.
|
|
275
|
+
*/
|
|
276
|
+
url: string;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Fallback text for surfaces that cannot render the card.
|
|
280
|
+
*/
|
|
281
|
+
fallback_text?: string | null;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Client-supplied session identifier, echoed back when provided.
|
|
285
|
+
*/
|
|
286
|
+
session_id?: string | null;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export namespace IMessageAppPartResponse {
|
|
290
|
+
/**
|
|
291
|
+
* Identifies the iMessage app (Messages app extension) that backs the card.
|
|
292
|
+
*/
|
|
293
|
+
export interface App {
|
|
294
|
+
/**
|
|
295
|
+
* Bundle identifier of the Messages app extension. Must not contain `:`.
|
|
296
|
+
*/
|
|
297
|
+
bundle_id: string;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Display name of the app, shown by Messages' fallback UI.
|
|
301
|
+
*/
|
|
302
|
+
name: string;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* The app's 10-character uppercase alphanumeric team identifier.
|
|
306
|
+
*/
|
|
307
|
+
team_id: string;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* The owning app's App Store id (optional). When set, recipients without the
|
|
311
|
+
* iMessage app installed see a "Get the app" affordance.
|
|
312
|
+
*/
|
|
313
|
+
app_store_id?: number;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Visible layout of the card. At least one of `caption`, `subcaption`,
|
|
318
|
+
* `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
|
|
319
|
+
* the card renders as an empty bubble.
|
|
320
|
+
*/
|
|
321
|
+
export interface Layout {
|
|
322
|
+
/**
|
|
323
|
+
* Primary label, top-left and bold.
|
|
324
|
+
*/
|
|
325
|
+
caption?: string;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Overlay text shown below `image_title`. Requires `image_url`.
|
|
329
|
+
*/
|
|
330
|
+
image_subtitle?: string;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Overlay text shown above the image. Requires `image_url`.
|
|
334
|
+
*/
|
|
335
|
+
image_title?: string;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Optional HTTPS URL of a preview image. The server downloads it and embeds it in
|
|
339
|
+
* the card as JPEG (10MB max, same fetch rules as media parts).
|
|
340
|
+
*/
|
|
341
|
+
image_url?: string;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Secondary label, below `caption` on the left.
|
|
345
|
+
*/
|
|
346
|
+
subcaption?: string;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Label shown top-right.
|
|
350
|
+
*/
|
|
351
|
+
trailing_caption?: string;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Label shown below `trailing_caption`, on the right.
|
|
355
|
+
*/
|
|
356
|
+
trailing_subcaption?: string;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
233
361
|
/**
|
|
234
362
|
* iMessage effect applied to a message (screen or bubble effect)
|
|
235
363
|
*/
|