@linqapp/sdk 0.35.0 → 0.36.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 +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/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/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
|
@@ -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
|
|
@@ -50,6 +50,275 @@ export class PhoneNumbers extends APIResource {
|
|
|
50
50
|
list(options?: RequestOptions): APIPromise<PhoneNumberListResponse> {
|
|
51
51
|
return this._client.get('/v3/phone_numbers', options);
|
|
52
52
|
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Returns the audit's status and, once complete, the report. Audits are scoped to
|
|
56
|
+
* the line in the URL — an `auditId` started on a different line returns `404`.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const reputationAudit =
|
|
61
|
+
* await client.phoneNumbers.getReputationAudit('auditId', {
|
|
62
|
+
* phoneNumber: 'phoneNumber',
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
getReputationAudit(
|
|
67
|
+
auditID: string,
|
|
68
|
+
params: PhoneNumberGetReputationAuditParams,
|
|
69
|
+
options?: RequestOptions,
|
|
70
|
+
): APIPromise<ReputationAudit> {
|
|
71
|
+
const { phoneNumber } = params;
|
|
72
|
+
return this._client.get(path`/v3/phone_numbers/${phoneNumber}/reputation_audit/${auditID}`, options);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Starts an asynchronous reputation audit for a line and returns an `audit_id`.
|
|
77
|
+
* Poll the GET endpoint for the result.
|
|
78
|
+
*
|
|
79
|
+
* Rate limited per line: only one audit may run at a time (a second request
|
|
80
|
+
* returns `409` while the first is still in progress), and a new audit can't be
|
|
81
|
+
* started for the same line until a cooldown elapses (`429`, with `Retry-After`
|
|
82
|
+
* carrying the wait).
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* const reputationAuditStarted =
|
|
87
|
+
* await client.phoneNumbers.startReputationAudit(
|
|
88
|
+
* 'phoneNumber',
|
|
89
|
+
* );
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
startReputationAudit(phoneNumber: string, options?: RequestOptions): APIPromise<ReputationAuditStarted> {
|
|
93
|
+
return this._client.post(path`/v3/phone_numbers/${phoneNumber}/reputation_audit`, options);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface ReputationActionItem {
|
|
98
|
+
detail?: string;
|
|
99
|
+
|
|
100
|
+
expected_impact?: 'high' | 'medium' | 'low';
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* 1 = do first
|
|
104
|
+
*/
|
|
105
|
+
priority?: number;
|
|
106
|
+
|
|
107
|
+
title?: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface ReputationAudit {
|
|
111
|
+
audit_id: string;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* `pending` until the report is ready — poll until `complete` or `error`.
|
|
115
|
+
*/
|
|
116
|
+
status: 'pending' | 'complete' | 'error';
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Present only when `status` is `error`. Short, generic reason safe to display.
|
|
120
|
+
*/
|
|
121
|
+
error?: string;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* When the report was generated; signals reflect the line at this moment.
|
|
125
|
+
*/
|
|
126
|
+
generated_at?: string;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The line audited, E.164.
|
|
130
|
+
*/
|
|
131
|
+
phone?: string;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Present only when `status` is `complete`.
|
|
135
|
+
*/
|
|
136
|
+
report?: ReputationReport;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface ReputationAuditStarted {
|
|
140
|
+
/**
|
|
141
|
+
* Identifier for this audit. Poll
|
|
142
|
+
* `GET /v3/phone_numbers/{phoneNumber}/reputation_audit/{auditId}` until `status`
|
|
143
|
+
* is `complete` or `error`.
|
|
144
|
+
*/
|
|
145
|
+
audit_id: string;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* A newly started audit is `pending`.
|
|
149
|
+
*/
|
|
150
|
+
status: 'pending' | 'complete' | 'error';
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface ReputationDriver {
|
|
154
|
+
/**
|
|
155
|
+
* Stable driver-category identifier — what is dragging the line, or one of its
|
|
156
|
+
* conversations, down.
|
|
157
|
+
*
|
|
158
|
+
* - `low_engagement` — The conversation is one-sided: several messages sent, few
|
|
159
|
+
* or no replies back. Pause or rework outreach where recipients are not
|
|
160
|
+
* replying, and lead with messages that invite a response. Conversation-level:
|
|
161
|
+
* it appears on `evidence.unhealthy_chats[].driver_keys`, never in `drivers`.
|
|
162
|
+
* - `overall_conversation_health` — A large share of the line's active
|
|
163
|
+
* conversations are trending unhealthy. Fix those conversations first — review
|
|
164
|
+
* their content and timing, and whether recipients are engaging.
|
|
165
|
+
* - `volume_spike` — The line's daily sending volume jumped far above its own
|
|
166
|
+
* normal level. Ramp gradually instead of spiking, spread large sends across
|
|
167
|
+
* days, and prioritize people who have already engaged.
|
|
168
|
+
* - `new_conversation_rate` — The line is starting too many brand-new
|
|
169
|
+
* conversations in a single day. Spread new conversations out over time instead
|
|
170
|
+
* of starting many at once.
|
|
171
|
+
* - `opt_out_handling` — Recipients asked this line to stop. Honor every stop
|
|
172
|
+
* request immediately: send nothing further to that recipient unless they opt
|
|
173
|
+
* back in. Every send to them is rejected with `403` (error code `2024`),
|
|
174
|
+
* including a final courtesy message — to send one telling them they can reply
|
|
175
|
+
* to resume, set `override_optout: true` on that single request.
|
|
176
|
+
* - `flagged` — The line is currently restricted and its messages may not be
|
|
177
|
+
* reaching recipients. Move active traffic to a healthy line now, and let this
|
|
178
|
+
* one recover before sending more.
|
|
179
|
+
* - `other` — Fallback for a signal without dedicated partner copy.
|
|
180
|
+
*/
|
|
181
|
+
key?: ReputationDriverKey;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* A specific observed figure when available; otherwise a short qualitative note.
|
|
185
|
+
*/
|
|
186
|
+
metric?: string;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* One plain-English sentence.
|
|
190
|
+
*/
|
|
191
|
+
summary?: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Stable driver-category identifier — what is dragging the line, or one of its
|
|
196
|
+
* conversations, down.
|
|
197
|
+
*
|
|
198
|
+
* - `low_engagement` — The conversation is one-sided: several messages sent, few
|
|
199
|
+
* or no replies back. Pause or rework outreach where recipients are not
|
|
200
|
+
* replying, and lead with messages that invite a response. Conversation-level:
|
|
201
|
+
* it appears on `evidence.unhealthy_chats[].driver_keys`, never in `drivers`.
|
|
202
|
+
* - `overall_conversation_health` — A large share of the line's active
|
|
203
|
+
* conversations are trending unhealthy. Fix those conversations first — review
|
|
204
|
+
* their content and timing, and whether recipients are engaging.
|
|
205
|
+
* - `volume_spike` — The line's daily sending volume jumped far above its own
|
|
206
|
+
* normal level. Ramp gradually instead of spiking, spread large sends across
|
|
207
|
+
* days, and prioritize people who have already engaged.
|
|
208
|
+
* - `new_conversation_rate` — The line is starting too many brand-new
|
|
209
|
+
* conversations in a single day. Spread new conversations out over time instead
|
|
210
|
+
* of starting many at once.
|
|
211
|
+
* - `opt_out_handling` — Recipients asked this line to stop. Honor every stop
|
|
212
|
+
* request immediately: send nothing further to that recipient unless they opt
|
|
213
|
+
* back in. Every send to them is rejected with `403` (error code `2024`),
|
|
214
|
+
* including a final courtesy message — to send one telling them they can reply
|
|
215
|
+
* to resume, set `override_optout: true` on that single request.
|
|
216
|
+
* - `flagged` — The line is currently restricted and its messages may not be
|
|
217
|
+
* reaching recipients. Move active traffic to a healthy line now, and let this
|
|
218
|
+
* one recover before sending more.
|
|
219
|
+
* - `other` — Fallback for a signal without dedicated partner copy.
|
|
220
|
+
*/
|
|
221
|
+
export type ReputationDriverKey =
|
|
222
|
+
| 'low_engagement'
|
|
223
|
+
| 'overall_conversation_health'
|
|
224
|
+
| 'volume_spike'
|
|
225
|
+
| 'new_conversation_rate'
|
|
226
|
+
| 'opt_out_handling'
|
|
227
|
+
| 'flagged'
|
|
228
|
+
| 'other';
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* The specific conversations behind the drivers, so partners can verify every
|
|
232
|
+
* claim against their own send logs. Each `chat_id` can be fetched via
|
|
233
|
+
* `GET /v3/chats/{chatId}` — its current health appears there.
|
|
234
|
+
*/
|
|
235
|
+
export interface ReputationEvidence {
|
|
236
|
+
/**
|
|
237
|
+
* Worst first — most messages sent after the stop request; honor these
|
|
238
|
+
* immediately.
|
|
239
|
+
*/
|
|
240
|
+
opt_out_chats?: Array<ReputationOptOutChat>;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Up to 15, worst first.
|
|
244
|
+
*/
|
|
245
|
+
unhealthy_chats?: Array<ReputationUnhealthyChat>;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export interface ReputationOptOutChat {
|
|
249
|
+
chat_id?: string;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Outbound messages sent after the recipient asked to stop.
|
|
253
|
+
*/
|
|
254
|
+
messages_after_stop?: number;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export interface ReputationReport {
|
|
258
|
+
/**
|
|
259
|
+
* Ordered by `priority`; 1 = do first.
|
|
260
|
+
*/
|
|
261
|
+
action_items?: Array<ReputationActionItem>;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Ranked, highest impact first.
|
|
265
|
+
*/
|
|
266
|
+
drivers?: Array<ReputationDriver>;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* The specific conversations behind the drivers, so partners can verify every
|
|
270
|
+
* claim against their own send logs. Each `chat_id` can be fetched via
|
|
271
|
+
* `GET /v3/chats/{chatId}` — its current health appears there.
|
|
272
|
+
*/
|
|
273
|
+
evidence?: ReputationEvidence;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* The `key` of the most important driver. Empty string when the line has nothing
|
|
277
|
+
* to act on — the report then carries a single reassurance action item. Its values
|
|
278
|
+
* are the `ReputationDriverKey` vocabulary — see that schema for what each means
|
|
279
|
+
* and what to do about it.
|
|
280
|
+
*/
|
|
281
|
+
primary_driver?: string;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Current reputation of this phone line.
|
|
285
|
+
*
|
|
286
|
+
* - `HEALTHY` — The line is in good standing. Send normally.
|
|
287
|
+
* - `AT_RISK` — Warning signs on the line: engagement is low across many of its
|
|
288
|
+
* conversations, or it's starting too many brand-new conversations in a single
|
|
289
|
+
* day — and a spike in send volume can add to either. Slow the line's send pace,
|
|
290
|
+
* avoid opening many new conversations at once, and review your messaging
|
|
291
|
+
* patterns.
|
|
292
|
+
* - `CRITICAL` — Strong signals that messages from this line aren't landing well.
|
|
293
|
+
* Pause outbound on the line until it recovers.
|
|
294
|
+
*
|
|
295
|
+
* Defaults to `HEALTHY` for lines that have not yet been scored.
|
|
296
|
+
*/
|
|
297
|
+
severity?: 'HEALTHY' | 'AT_RISK' | 'CRITICAL';
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Deterministic markdown rendering of this report, suitable for feeding directly
|
|
301
|
+
* to automated systems and AI agents as investigation context. Rendered from the
|
|
302
|
+
* structured fields above, which remain the source of truth.
|
|
303
|
+
*/
|
|
304
|
+
summary_markdown?: string;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export interface ReputationUnhealthyChat {
|
|
308
|
+
chat_id?: string;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* What is dragging this conversation down, in the same vocabulary as the report's
|
|
312
|
+
* drivers. Each key's meaning and the fix for it are documented on
|
|
313
|
+
* `ReputationDriverKey`.
|
|
314
|
+
*/
|
|
315
|
+
driver_keys?: Array<ReputationDriverKey>;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* The conversation's current health — the same value `GET /v3/chats/{chatId}`
|
|
319
|
+
* reports for it.
|
|
320
|
+
*/
|
|
321
|
+
status?: 'AT_RISK' | 'CRITICAL' | 'OPTED_OUT';
|
|
53
322
|
}
|
|
54
323
|
|
|
55
324
|
export interface PhoneNumberUpdateResponse {
|
|
@@ -152,10 +421,27 @@ export interface PhoneNumberUpdateParams {
|
|
|
152
421
|
forwarding_number: string | null;
|
|
153
422
|
}
|
|
154
423
|
|
|
424
|
+
export interface PhoneNumberGetReputationAuditParams {
|
|
425
|
+
/**
|
|
426
|
+
* The line in E.164 format.
|
|
427
|
+
*/
|
|
428
|
+
phoneNumber: string;
|
|
429
|
+
}
|
|
430
|
+
|
|
155
431
|
export declare namespace PhoneNumbers {
|
|
156
432
|
export {
|
|
433
|
+
type ReputationActionItem as ReputationActionItem,
|
|
434
|
+
type ReputationAudit as ReputationAudit,
|
|
435
|
+
type ReputationAuditStarted as ReputationAuditStarted,
|
|
436
|
+
type ReputationDriver as ReputationDriver,
|
|
437
|
+
type ReputationDriverKey as ReputationDriverKey,
|
|
438
|
+
type ReputationEvidence as ReputationEvidence,
|
|
439
|
+
type ReputationOptOutChat as ReputationOptOutChat,
|
|
440
|
+
type ReputationReport as ReputationReport,
|
|
441
|
+
type ReputationUnhealthyChat as ReputationUnhealthyChat,
|
|
157
442
|
type PhoneNumberUpdateResponse as PhoneNumberUpdateResponse,
|
|
158
443
|
type PhoneNumberListResponse as PhoneNumberListResponse,
|
|
159
444
|
type PhoneNumberUpdateParams as PhoneNumberUpdateParams,
|
|
445
|
+
type PhoneNumberGetReputationAuditParams as PhoneNumberGetReputationAuditParams,
|
|
160
446
|
};
|
|
161
447
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.36.1'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.36.1";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.36.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.36.1'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|