@linqapp/sdk 0.35.1 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/client.d.mts +86 -5
- package/client.d.mts.map +1 -1
- package/client.d.ts +86 -5
- package/client.d.ts.map +1 -1
- package/client.js +84 -3
- package/client.js.map +1 -1
- package/client.mjs +84 -3
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/attachments.d.mts +3 -5
- package/resources/attachments.d.mts.map +1 -1
- package/resources/attachments.d.ts +3 -5
- package/resources/attachments.d.ts.map +1 -1
- package/resources/attachments.js +3 -5
- package/resources/attachments.js.map +1 -1
- package/resources/attachments.mjs +3 -5
- package/resources/attachments.mjs.map +1 -1
- package/resources/capability.d.mts +22 -0
- package/resources/capability.d.mts.map +1 -1
- package/resources/capability.d.ts +22 -0
- package/resources/capability.d.ts.map +1 -1
- package/resources/capability.js +7 -0
- package/resources/capability.js.map +1 -1
- package/resources/capability.mjs +7 -0
- package/resources/capability.mjs.map +1 -1
- package/resources/chats/chats.d.mts +20 -14
- package/resources/chats/chats.d.mts.map +1 -1
- package/resources/chats/chats.d.ts +20 -14
- 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 +4 -3
- package/resources/chats/messages.d.mts.map +1 -1
- package/resources/chats/messages.d.ts +4 -3
- package/resources/chats/messages.d.ts.map +1 -1
- package/resources/experiences.d.mts +61 -3
- package/resources/experiences.d.mts.map +1 -1
- package/resources/experiences.d.ts +61 -3
- package/resources/experiences.d.ts.map +1 -1
- package/resources/experiences.js +61 -3
- package/resources/experiences.js.map +1 -1
- package/resources/experiences.mjs +61 -3
- package/resources/experiences.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/messages/messages.d.mts +13 -8
- package/resources/messages/messages.d.mts.map +1 -1
- package/resources/messages/messages.d.ts +13 -8
- package/resources/messages/messages.d.ts.map +1 -1
- package/resources/messages/messages.js.map +1 -1
- package/resources/messages/messages.mjs.map +1 -1
- package/resources/payment-requests.d.mts +35 -0
- package/resources/payment-requests.d.mts.map +1 -1
- package/resources/payment-requests.d.ts +35 -0
- package/resources/payment-requests.d.ts.map +1 -1
- package/resources/payment-requests.js +35 -0
- package/resources/payment-requests.js.map +1 -1
- package/resources/payment-requests.mjs +35 -0
- package/resources/payment-requests.mjs.map +1 -1
- package/resources/phone-numbers.d.mts +229 -1
- package/resources/phone-numbers.d.mts.map +1 -1
- package/resources/phone-numbers.d.ts +229 -1
- package/resources/phone-numbers.d.ts.map +1 -1
- package/resources/phone-numbers.js +36 -0
- package/resources/phone-numbers.js.map +1 -1
- package/resources/phone-numbers.mjs +36 -0
- package/resources/phone-numbers.mjs.map +1 -1
- package/src/client.ts +104 -3
- package/src/resources/attachments.ts +3 -5
- package/src/resources/capability.ts +24 -0
- package/src/resources/chats/chats.ts +21 -15
- package/src/resources/chats/messages.ts +4 -3
- package/src/resources/experiences.ts +61 -3
- package/src/resources/index.ts +10 -0
- package/src/resources/messages/messages.ts +13 -8
- package/src/resources/payment-requests.ts +35 -0
- package/src/resources/phone-numbers.ts +286 -0
- 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/src/client.ts
CHANGED
|
@@ -81,10 +81,20 @@ import {
|
|
|
81
81
|
} from './resources/payment-requests';
|
|
82
82
|
import { Payment, PaymentCreateParams, PaymentCredentialsResponse, Payments } from './resources/payments';
|
|
83
83
|
import {
|
|
84
|
+
PhoneNumberGetReputationAuditParams,
|
|
84
85
|
PhoneNumberListResponse,
|
|
85
86
|
PhoneNumberUpdateParams,
|
|
86
87
|
PhoneNumberUpdateResponse,
|
|
87
88
|
PhoneNumbers,
|
|
89
|
+
ReputationActionItem,
|
|
90
|
+
ReputationAudit,
|
|
91
|
+
ReputationAuditStarted,
|
|
92
|
+
ReputationDriver,
|
|
93
|
+
ReputationDriverKey,
|
|
94
|
+
ReputationEvidence,
|
|
95
|
+
ReputationOptOutChat,
|
|
96
|
+
ReputationReport,
|
|
97
|
+
ReputationUnhealthyChat,
|
|
88
98
|
} from './resources/phone-numbers';
|
|
89
99
|
import { PhonenumberListResponse, Phonenumbers } from './resources/phonenumbers';
|
|
90
100
|
import { WebhookEventListResponse, WebhookEventType, WebhookEvents } from './resources/webhook-events';
|
|
@@ -1300,6 +1310,41 @@ export class LinqAPIV3 {
|
|
|
1300
1310
|
* branding; a newly registered experience can take up to ~24 hours to
|
|
1301
1311
|
* activate on Apple's side, during which links open the web checkout.
|
|
1302
1312
|
*
|
|
1313
|
+
* ## Sending it as a card instead
|
|
1314
|
+
*
|
|
1315
|
+
* A `link` part is one way to deliver a request. The other is the
|
|
1316
|
+
* **`agentpay` experience**, which sends the same request as a native card
|
|
1317
|
+
* in Linq's iMessage app — the amount and reason are drawn in the bubble,
|
|
1318
|
+
* and it turns itself into "Paid" in place once the payment succeeds,
|
|
1319
|
+
* without a second message.
|
|
1320
|
+
*
|
|
1321
|
+
* Send it to `POST /v3/chats/{chatId}/messages`:
|
|
1322
|
+
*
|
|
1323
|
+
* ```json
|
|
1324
|
+
* {
|
|
1325
|
+
* "message": {
|
|
1326
|
+
* "experience": {
|
|
1327
|
+
* "name": "agentpay",
|
|
1328
|
+
* "action": "request_payment",
|
|
1329
|
+
* "params": { "checkout_url": "https://zero.linqapp.com/pay/acme?session=tok_..." }
|
|
1330
|
+
* }
|
|
1331
|
+
* }
|
|
1332
|
+
* }
|
|
1333
|
+
* ```
|
|
1334
|
+
*
|
|
1335
|
+
* `checkout_url` is the only required field — pass back exactly what
|
|
1336
|
+
* `POST /v3/payment_requests` returned. **The amount and reason are read
|
|
1337
|
+
* from that request, never from you**, so the card can never claim a
|
|
1338
|
+
* different figure than the checkout will charge. Optional `title` and
|
|
1339
|
+
* `note` override the copy only. The link must be one of your own payment
|
|
1340
|
+
* requests; another partner's is rejected.
|
|
1341
|
+
*
|
|
1342
|
+
* The trade-off against a `link` part: a card is an app card, so it is
|
|
1343
|
+
* iMessage-only, and recipients without the app see a static version of it.
|
|
1344
|
+
* A link works everywhere and is what opens the Apple Pay App Clip. Send
|
|
1345
|
+
* whichever suits the conversation — both settle the same payment request
|
|
1346
|
+
* and fire the same webhooks.
|
|
1347
|
+
*
|
|
1303
1348
|
* ## Webhooks
|
|
1304
1349
|
*
|
|
1305
1350
|
* Subscribe to payment lifecycle events to reconcile server-side rather than
|
|
@@ -1340,9 +1385,55 @@ export class LinqAPIV3 {
|
|
|
1340
1385
|
*/
|
|
1341
1386
|
blockedHandles: API.BlockedHandles = new API.BlockedHandles(this);
|
|
1342
1387
|
/**
|
|
1343
|
-
*
|
|
1344
|
-
*
|
|
1345
|
-
*
|
|
1388
|
+
* An **experience** renders inside Linq's iMessage app as a native card,
|
|
1389
|
+
* instead of as text or a link. You invoke one by name; Linq resolves the
|
|
1390
|
+
* recipient, mints any session it needs, composes the card and sends it.
|
|
1391
|
+
*
|
|
1392
|
+
* Send it to `POST /v3/chats/{chatId}/messages`:
|
|
1393
|
+
*
|
|
1394
|
+
* ```json
|
|
1395
|
+
* {
|
|
1396
|
+
* "message": {
|
|
1397
|
+
* "experience": {
|
|
1398
|
+
* "name": "agentpay",
|
|
1399
|
+
* "action": "request_payment",
|
|
1400
|
+
* "params": { "checkout_url": "https://zero.linqapp.com/pay/acme?session=tok_..." }
|
|
1401
|
+
* }
|
|
1402
|
+
* }
|
|
1403
|
+
* }
|
|
1404
|
+
* ```
|
|
1405
|
+
*
|
|
1406
|
+
* The key is `experience` — what you're invoking. Nested under it is its
|
|
1407
|
+
* `name`, the action you're invoking on it, and that action's params. A card
|
|
1408
|
+
* **is** the whole message on Apple's side, so a message carries either
|
|
1409
|
+
* `experience` or `parts`, never both, and an action goes to exactly one
|
|
1410
|
+
* recipient.
|
|
1411
|
+
*
|
|
1412
|
+
* ## What you can invoke
|
|
1413
|
+
*
|
|
1414
|
+
* | Experience | Action | What the customer sees |
|
|
1415
|
+
* |---|---|---|
|
|
1416
|
+
* | `agentpay` | `request_payment` | A payment request they can pay in the app. Turns itself into "Paid" in place once it settles. |
|
|
1417
|
+
* | `agentcard` | `attach_card` | A prompt to add a card to their wallet. |
|
|
1418
|
+
* | `agentcard` | `approve_card` | A passkey approval for a virtual card. |
|
|
1419
|
+
* | `link` | `open` | A card that opens a URL you supply. |
|
|
1420
|
+
*
|
|
1421
|
+
* `GET /v3/experiences` is the authoritative list for your account, with
|
|
1422
|
+
* every action and the fields each accepts — an action missing there cannot
|
|
1423
|
+
* be sent. Fields are display copy unless documented otherwise.
|
|
1424
|
+
*
|
|
1425
|
+
* ## Params are checked before the card is sent
|
|
1426
|
+
*
|
|
1427
|
+
* Unknown fields are **rejected rather than ignored**, so copy that would
|
|
1428
|
+
* never have rendered fails for you now instead of arriving wrong on
|
|
1429
|
+
* somebody's phone. Some fields are read rather than sent: `agentpay`'s
|
|
1430
|
+
* `request_payment` takes only a `checkout_url` and resolves the amount and
|
|
1431
|
+
* reason from that payment request, so a card can never claim a figure the
|
|
1432
|
+
* checkout will not charge.
|
|
1433
|
+
*
|
|
1434
|
+
* Cards are **iMessage-only**. Recipients without the app see a static
|
|
1435
|
+
* version built from the same copy; SMS and RCS recipients cannot receive
|
|
1436
|
+
* one at all (error codes 2018 and 4005).
|
|
1346
1437
|
*
|
|
1347
1438
|
*/
|
|
1348
1439
|
experiences: API.Experiences = new API.Experiences(this);
|
|
@@ -1704,9 +1795,19 @@ export declare namespace LinqAPIV3 {
|
|
|
1704
1795
|
|
|
1705
1796
|
export {
|
|
1706
1797
|
PhoneNumbers as PhoneNumbers,
|
|
1798
|
+
type ReputationActionItem as ReputationActionItem,
|
|
1799
|
+
type ReputationAudit as ReputationAudit,
|
|
1800
|
+
type ReputationAuditStarted as ReputationAuditStarted,
|
|
1801
|
+
type ReputationDriver as ReputationDriver,
|
|
1802
|
+
type ReputationDriverKey as ReputationDriverKey,
|
|
1803
|
+
type ReputationEvidence as ReputationEvidence,
|
|
1804
|
+
type ReputationOptOutChat as ReputationOptOutChat,
|
|
1805
|
+
type ReputationReport as ReputationReport,
|
|
1806
|
+
type ReputationUnhealthyChat as ReputationUnhealthyChat,
|
|
1707
1807
|
type PhoneNumberUpdateResponse as PhoneNumberUpdateResponse,
|
|
1708
1808
|
type PhoneNumberListResponse as PhoneNumberListResponse,
|
|
1709
1809
|
type PhoneNumberUpdateParams as PhoneNumberUpdateParams,
|
|
1810
|
+
type PhoneNumberGetReputationAuditParams as PhoneNumberGetReputationAuditParams,
|
|
1710
1811
|
};
|
|
1711
1812
|
|
|
1712
1813
|
export {
|
|
@@ -197,10 +197,9 @@ export class Attachments extends APIResource {
|
|
|
197
197
|
*
|
|
198
198
|
* ## Step 1: Request an upload URL
|
|
199
199
|
*
|
|
200
|
-
* Call
|
|
200
|
+
* Call `POST /v3/attachments` with file metadata:
|
|
201
201
|
*
|
|
202
202
|
* ```json
|
|
203
|
-
* POST /v3/attachments
|
|
204
203
|
* {
|
|
205
204
|
* "filename": "photo.jpg",
|
|
206
205
|
* "content_type": "image/jpeg",
|
|
@@ -231,11 +230,10 @@ export class Attachments extends APIResource {
|
|
|
231
230
|
*
|
|
232
231
|
* ## Step 3: Send a message with the attachment
|
|
233
232
|
*
|
|
234
|
-
* Reference the `attachment_id` in a media part
|
|
235
|
-
* as many messages as you want.
|
|
233
|
+
* Reference the `attachment_id` in a media part with `POST /v3/chats`. The ID
|
|
234
|
+
* never expires — use it in as many messages as you want.
|
|
236
235
|
*
|
|
237
236
|
* ```json
|
|
238
|
-
* POST /v3/chats
|
|
239
237
|
* {
|
|
240
238
|
* "from": "+15559876543",
|
|
241
239
|
* "to": ["+15551234567"],
|
|
@@ -30,6 +30,13 @@ export class Capability extends APIResource {
|
|
|
30
30
|
/**
|
|
31
31
|
* Check whether a recipient address (phone number) supports RCS messaging.
|
|
32
32
|
*
|
|
33
|
+
* A `200` means the check ran and the answer is about the **recipient**. A `503`
|
|
34
|
+
* means the check could not produce an answer because of a fault on the **sender**
|
|
35
|
+
* line — `4004` (RCS not turned on for the line), `4009` (line has no RCS
|
|
36
|
+
* account), or `4010` (the check could not run). Treat all three as "unknown",
|
|
37
|
+
* never as "the recipient does not support RCS", and do not cache them as a
|
|
38
|
+
* negative result.
|
|
39
|
+
*
|
|
33
40
|
* @example
|
|
34
41
|
* ```ts
|
|
35
42
|
* const handleCheckResponse =
|
|
@@ -66,6 +73,23 @@ export interface HandleCheckResponse {
|
|
|
66
73
|
* Whether the recipient supports the checked messaging service
|
|
67
74
|
*/
|
|
68
75
|
available: boolean;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Why `available` is `false`. Only present on a negative result.
|
|
79
|
+
*
|
|
80
|
+
* `not_supported` is the only value returned with a `200`, and it means the check
|
|
81
|
+
* completed and the recipient is genuinely not reachable over this service. On
|
|
82
|
+
* `check_rcs`, sender-side faults do not return `200` — they return `503` with a
|
|
83
|
+
* specific error code. `check_imessage` does not use this mapping.
|
|
84
|
+
*/
|
|
85
|
+
reason?: 'not_supported';
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The service that would actually carry a message to this address right now, which
|
|
89
|
+
* is not always the service you checked — a recipient without RCS resolves to
|
|
90
|
+
* `SMS`. Absent when the check could not determine one.
|
|
91
|
+
*/
|
|
92
|
+
selected_service?: string;
|
|
69
93
|
}
|
|
70
94
|
|
|
71
95
|
export interface CapabilityCheckIMessageParams {
|
|
@@ -481,11 +481,17 @@ export interface MediaPart {
|
|
|
481
481
|
* from/to).
|
|
482
482
|
*
|
|
483
483
|
* A message carries EITHER `parts` — text and attachments, which compose into one
|
|
484
|
-
* bubble — or a single `
|
|
485
|
-
* iMessage app. Never both: an app card is the whole message (Apple's
|
|
486
|
-
* cannot coexist with text), so copy and a card are two sends, not
|
|
484
|
+
* bubble — or a single `experience` invocation, which renders an experience inside
|
|
485
|
+
* Linq's iMessage app. Never both: an app card is the whole message (Apple's
|
|
486
|
+
* `MSMessage` cannot coexist with text), so copy and a card are two sends, not
|
|
487
|
+
* one.
|
|
487
488
|
*/
|
|
488
489
|
export interface MessageContent {
|
|
490
|
+
/**
|
|
491
|
+
* iMessage effect to apply to this message (screen or bubble effect)
|
|
492
|
+
*/
|
|
493
|
+
effect?: ResourcesMessagesAPI.MessageEffect;
|
|
494
|
+
|
|
489
495
|
/**
|
|
490
496
|
* Invokes an action on an experience — a third party that renders inside Linq's
|
|
491
497
|
* iMessage app. Linq resolves the recipient's connection, mints any session the
|
|
@@ -494,12 +500,7 @@ export interface MessageContent {
|
|
|
494
500
|
* Call `GET /v3/experiences/{experience}` for the actions you may invoke and the
|
|
495
501
|
* fields each accepts.
|
|
496
502
|
*/
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* iMessage effect to apply to this message (screen or bubble effect)
|
|
501
|
-
*/
|
|
502
|
-
effect?: ResourcesMessagesAPI.MessageEffect;
|
|
503
|
+
experience?: MessageContent.Experience;
|
|
503
504
|
|
|
504
505
|
/**
|
|
505
506
|
* Optional idempotency key for this message. Use this to prevent duplicate sends
|
|
@@ -570,16 +571,16 @@ export namespace MessageContent {
|
|
|
570
571
|
* Call `GET /v3/experiences/{experience}` for the actions you may invoke and the
|
|
571
572
|
* fields each accepts.
|
|
572
573
|
*/
|
|
573
|
-
export interface
|
|
574
|
+
export interface Experience {
|
|
574
575
|
/**
|
|
575
576
|
* Which of its actions, e.g. `attach_card`.
|
|
576
577
|
*/
|
|
577
578
|
action: string;
|
|
578
579
|
|
|
579
580
|
/**
|
|
580
|
-
* The experience to invoke, e.g. `agentcard`.
|
|
581
|
+
* The experience to invoke, e.g. `agentcard` or `agentpay`.
|
|
581
582
|
*/
|
|
582
|
-
|
|
583
|
+
name: string;
|
|
583
584
|
|
|
584
585
|
/**
|
|
585
586
|
* Values for the fields this action exposes. Keys are exactly the field names
|
|
@@ -587,6 +588,10 @@ export namespace MessageContent {
|
|
|
587
588
|
*
|
|
588
589
|
* Display copy only, except a `url`-type field — that value sets the destination,
|
|
589
590
|
* and must be an absolute `https` URL.
|
|
591
|
+
*
|
|
592
|
+
* Some fields are read rather than sent: `agentpay`'s `request_payment` takes only
|
|
593
|
+
* a `checkout_url` and resolves the amount and reason from that payment request
|
|
594
|
+
* itself, so the card cannot state a figure the checkout will not charge.
|
|
590
595
|
*/
|
|
591
596
|
params?: { [key: string]: unknown };
|
|
592
597
|
}
|
|
@@ -1033,9 +1038,10 @@ export interface ChatCreateParams {
|
|
|
1033
1038
|
* from/to).
|
|
1034
1039
|
*
|
|
1035
1040
|
* A message carries EITHER `parts` — text and attachments, which compose into one
|
|
1036
|
-
* bubble — or a single `
|
|
1037
|
-
* iMessage app. Never both: an app card is the whole message (Apple's
|
|
1038
|
-
* cannot coexist with text), so copy and a card are two sends, not
|
|
1041
|
+
* bubble — or a single `experience` invocation, which renders an experience inside
|
|
1042
|
+
* Linq's iMessage app. Never both: an app card is the whole message (Apple's
|
|
1043
|
+
* `MSMessage` cannot coexist with text), so copy and a card are two sends, not
|
|
1044
|
+
* one.
|
|
1039
1045
|
*/
|
|
1040
1046
|
message: MessageContent;
|
|
1041
1047
|
|
|
@@ -393,9 +393,10 @@ export interface MessageSendParams {
|
|
|
393
393
|
* from/to).
|
|
394
394
|
*
|
|
395
395
|
* A message carries EITHER `parts` — text and attachments, which compose into one
|
|
396
|
-
* bubble — or a single `
|
|
397
|
-
* iMessage app. Never both: an app card is the whole message (Apple's
|
|
398
|
-
* cannot coexist with text), so copy and a card are two sends, not
|
|
396
|
+
* bubble — or a single `experience` invocation, which renders an experience inside
|
|
397
|
+
* Linq's iMessage app. Never both: an app card is the whole message (Apple's
|
|
398
|
+
* `MSMessage` cannot coexist with text), so copy and a card are two sends, not
|
|
399
|
+
* one.
|
|
399
400
|
*/
|
|
400
401
|
message: ChatsAPI.MessageContent;
|
|
401
402
|
|
|
@@ -6,13 +6,66 @@ import { RequestOptions } from '../internal/request-options';
|
|
|
6
6
|
import { path } from '../internal/utils/path';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* An **experience** renders inside Linq's iMessage app as a native card,
|
|
10
|
+
* instead of as text or a link. You invoke one by name; Linq resolves the
|
|
11
|
+
* recipient, mints any session it needs, composes the card and sends it.
|
|
12
|
+
*
|
|
13
|
+
* Send it to `POST /v3/chats/{chatId}/messages`:
|
|
14
|
+
*
|
|
15
|
+
* ```json
|
|
16
|
+
* {
|
|
17
|
+
* "message": {
|
|
18
|
+
* "experience": {
|
|
19
|
+
* "name": "agentpay",
|
|
20
|
+
* "action": "request_payment",
|
|
21
|
+
* "params": { "checkout_url": "https://zero.linqapp.com/pay/acme?session=tok_..." }
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* The key is `experience` — what you're invoking. Nested under it is its
|
|
28
|
+
* `name`, the action you're invoking on it, and that action's params. A card
|
|
29
|
+
* **is** the whole message on Apple's side, so a message carries either
|
|
30
|
+
* `experience` or `parts`, never both, and an action goes to exactly one
|
|
31
|
+
* recipient.
|
|
32
|
+
*
|
|
33
|
+
* ## What you can invoke
|
|
34
|
+
*
|
|
35
|
+
* | Experience | Action | What the customer sees |
|
|
36
|
+
* |---|---|---|
|
|
37
|
+
* | `agentpay` | `request_payment` | A payment request they can pay in the app. Turns itself into "Paid" in place once it settles. |
|
|
38
|
+
* | `agentcard` | `attach_card` | A prompt to add a card to their wallet. |
|
|
39
|
+
* | `agentcard` | `approve_card` | A passkey approval for a virtual card. |
|
|
40
|
+
* | `link` | `open` | A card that opens a URL you supply. |
|
|
41
|
+
*
|
|
42
|
+
* `GET /v3/experiences` is the authoritative list for your account, with
|
|
43
|
+
* every action and the fields each accepts — an action missing there cannot
|
|
44
|
+
* be sent. Fields are display copy unless documented otherwise.
|
|
45
|
+
*
|
|
46
|
+
* ## Params are checked before the card is sent
|
|
47
|
+
*
|
|
48
|
+
* Unknown fields are **rejected rather than ignored**, so copy that would
|
|
49
|
+
* never have rendered fails for you now instead of arriving wrong on
|
|
50
|
+
* somebody's phone. Some fields are read rather than sent: `agentpay`'s
|
|
51
|
+
* `request_payment` takes only a `checkout_url` and resolves the amount and
|
|
52
|
+
* reason from that payment request, so a card can never claim a figure the
|
|
53
|
+
* checkout will not charge.
|
|
54
|
+
*
|
|
55
|
+
* Cards are **iMessage-only**. Recipients without the app see a static
|
|
56
|
+
* version built from the same copy; SMS and RCS recipients cannot receive
|
|
57
|
+
* one at all (error codes 2018 and 4005).
|
|
12
58
|
*/
|
|
13
59
|
export class Experiences extends APIResource {
|
|
14
60
|
/**
|
|
15
61
|
* Get one experience
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const experience = await client.experiences.retrieve(
|
|
66
|
+
* 'agentpay',
|
|
67
|
+
* );
|
|
68
|
+
* ```
|
|
16
69
|
*/
|
|
17
70
|
retrieve(experience: string, options?: RequestOptions): APIPromise<ExperienceRetrieveResponse> {
|
|
18
71
|
return this._client.get(path`/v3/experiences/${experience}`, options);
|
|
@@ -22,6 +75,11 @@ export class Experiences extends APIResource {
|
|
|
22
75
|
* The experiences enabled for your account, with the actions you may invoke on
|
|
23
76
|
* each and the fields each action accepts. This is the authoritative list — an
|
|
24
77
|
* action missing here cannot be sent.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const experiences = await client.experiences.list();
|
|
82
|
+
* ```
|
|
25
83
|
*/
|
|
26
84
|
list(options?: RequestOptions): APIPromise<ExperienceListResponse> {
|
|
27
85
|
return this._client.get('/v3/experiences', options);
|
package/src/resources/index.ts
CHANGED
|
@@ -95,9 +95,19 @@ export {
|
|
|
95
95
|
} from './payments';
|
|
96
96
|
export {
|
|
97
97
|
PhoneNumbers,
|
|
98
|
+
type ReputationActionItem,
|
|
99
|
+
type ReputationAudit,
|
|
100
|
+
type ReputationAuditStarted,
|
|
101
|
+
type ReputationDriver,
|
|
102
|
+
type ReputationDriverKey,
|
|
103
|
+
type ReputationEvidence,
|
|
104
|
+
type ReputationOptOutChat,
|
|
105
|
+
type ReputationReport,
|
|
106
|
+
type ReputationUnhealthyChat,
|
|
98
107
|
type PhoneNumberUpdateResponse,
|
|
99
108
|
type PhoneNumberListResponse,
|
|
100
109
|
type PhoneNumberUpdateParams,
|
|
110
|
+
type PhoneNumberGetReputationAuditParams,
|
|
101
111
|
} from './phone-numbers';
|
|
102
112
|
export { Phonenumbers, type PhonenumberListResponse } from './phonenumbers';
|
|
103
113
|
export { WebhookEvents, type WebhookEventType, type WebhookEventListResponse } from './webhook-events';
|
|
@@ -706,9 +706,10 @@ export interface MessageCreateParams {
|
|
|
706
706
|
* fields like from/to).
|
|
707
707
|
*
|
|
708
708
|
* A message carries EITHER `parts` — text and attachments, which compose into one
|
|
709
|
-
* bubble — or a single `
|
|
710
|
-
* iMessage app. Never both: an app card is the whole message (Apple's
|
|
711
|
-
* cannot coexist with text), so copy and a card are two sends, not
|
|
709
|
+
* bubble — or a single `experience` invocation, which renders an experience inside
|
|
710
|
+
* Linq's iMessage app. Never both: an app card is the whole message (Apple's
|
|
711
|
+
* `MSMessage` cannot coexist with text), so copy and a card are two sends, not
|
|
712
|
+
* one.
|
|
712
713
|
*/
|
|
713
714
|
message: ChatsAPI.MessageContent;
|
|
714
715
|
|
|
@@ -854,7 +855,7 @@ export interface MessageUpdateAppCardParams {
|
|
|
854
855
|
* Call `GET /v3/experiences/{experience}` for the actions you may invoke and the
|
|
855
856
|
* fields each accepts.
|
|
856
857
|
*/
|
|
857
|
-
|
|
858
|
+
experience?: MessageUpdateAppCardParams.Experience;
|
|
858
859
|
|
|
859
860
|
/**
|
|
860
861
|
* Text shown on surfaces that cannot render the card (notifications, lock screen).
|
|
@@ -878,7 +879,7 @@ export interface MessageUpdateAppCardParams {
|
|
|
878
879
|
/**
|
|
879
880
|
* URL the recipient's app opens when they tap the updated card.
|
|
880
881
|
*
|
|
881
|
-
* Mutually exclusive with `
|
|
882
|
+
* Mutually exclusive with `experience` and `raw_payload_data`.
|
|
882
883
|
*/
|
|
883
884
|
url?: string;
|
|
884
885
|
}
|
|
@@ -951,16 +952,16 @@ export namespace MessageUpdateAppCardParams {
|
|
|
951
952
|
* Call `GET /v3/experiences/{experience}` for the actions you may invoke and the
|
|
952
953
|
* fields each accepts.
|
|
953
954
|
*/
|
|
954
|
-
export interface
|
|
955
|
+
export interface Experience {
|
|
955
956
|
/**
|
|
956
957
|
* Which of its actions, e.g. `attach_card`.
|
|
957
958
|
*/
|
|
958
959
|
action: string;
|
|
959
960
|
|
|
960
961
|
/**
|
|
961
|
-
* The experience to invoke, e.g. `agentcard`.
|
|
962
|
+
* The experience to invoke, e.g. `agentcard` or `agentpay`.
|
|
962
963
|
*/
|
|
963
|
-
|
|
964
|
+
name: string;
|
|
964
965
|
|
|
965
966
|
/**
|
|
966
967
|
* Values for the fields this action exposes. Keys are exactly the field names
|
|
@@ -968,6 +969,10 @@ export namespace MessageUpdateAppCardParams {
|
|
|
968
969
|
*
|
|
969
970
|
* Display copy only, except a `url`-type field — that value sets the destination,
|
|
970
971
|
* and must be an absolute `https` URL.
|
|
972
|
+
*
|
|
973
|
+
* Some fields are read rather than sent: `agentpay`'s `request_payment` takes only
|
|
974
|
+
* a `checkout_url` and resolves the amount and reason from that payment request
|
|
975
|
+
* itself, so the card cannot state a figure the checkout will not charge.
|
|
971
976
|
*/
|
|
972
977
|
params?: { [key: string]: unknown };
|
|
973
978
|
}
|
|
@@ -112,6 +112,41 @@ import { path } from '../internal/utils/path';
|
|
|
112
112
|
* branding; a newly registered experience can take up to ~24 hours to
|
|
113
113
|
* activate on Apple's side, during which links open the web checkout.
|
|
114
114
|
*
|
|
115
|
+
* ## Sending it as a card instead
|
|
116
|
+
*
|
|
117
|
+
* A `link` part is one way to deliver a request. The other is the
|
|
118
|
+
* **`agentpay` experience**, which sends the same request as a native card
|
|
119
|
+
* in Linq's iMessage app — the amount and reason are drawn in the bubble,
|
|
120
|
+
* and it turns itself into "Paid" in place once the payment succeeds,
|
|
121
|
+
* without a second message.
|
|
122
|
+
*
|
|
123
|
+
* Send it to `POST /v3/chats/{chatId}/messages`:
|
|
124
|
+
*
|
|
125
|
+
* ```json
|
|
126
|
+
* {
|
|
127
|
+
* "message": {
|
|
128
|
+
* "experience": {
|
|
129
|
+
* "name": "agentpay",
|
|
130
|
+
* "action": "request_payment",
|
|
131
|
+
* "params": { "checkout_url": "https://zero.linqapp.com/pay/acme?session=tok_..." }
|
|
132
|
+
* }
|
|
133
|
+
* }
|
|
134
|
+
* }
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* `checkout_url` is the only required field — pass back exactly what
|
|
138
|
+
* `POST /v3/payment_requests` returned. **The amount and reason are read
|
|
139
|
+
* from that request, never from you**, so the card can never claim a
|
|
140
|
+
* different figure than the checkout will charge. Optional `title` and
|
|
141
|
+
* `note` override the copy only. The link must be one of your own payment
|
|
142
|
+
* requests; another partner's is rejected.
|
|
143
|
+
*
|
|
144
|
+
* The trade-off against a `link` part: a card is an app card, so it is
|
|
145
|
+
* iMessage-only, and recipients without the app see a static version of it.
|
|
146
|
+
* A link works everywhere and is what opens the Apple Pay App Clip. Send
|
|
147
|
+
* whichever suits the conversation — both settle the same payment request
|
|
148
|
+
* and fire the same webhooks.
|
|
149
|
+
*
|
|
115
150
|
* ## Webhooks
|
|
116
151
|
*
|
|
117
152
|
* Subscribe to payment lifecycle events to reconcile server-side rather than
|