@sentdm/sentdm 0.44.0 → 0.46.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 +18 -0
- package/client.d.mts +3 -10
- package/client.d.mts.map +1 -1
- package/client.d.ts +3 -10
- package/client.d.ts.map +1 -1
- package/client.js +3 -10
- package/client.js.map +1 -1
- package/client.mjs +3 -10
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/channels/channels.d.mts +2 -2
- package/resources/channels/channels.d.mts.map +1 -1
- package/resources/channels/channels.d.ts +2 -2
- package/resources/channels/channels.d.ts.map +1 -1
- package/resources/channels/channels.js.map +1 -1
- package/resources/channels/channels.mjs.map +1 -1
- package/resources/channels/index.d.mts +1 -1
- package/resources/channels/index.d.mts.map +1 -1
- package/resources/channels/index.d.ts +1 -1
- package/resources/channels/index.d.ts.map +1 -1
- package/resources/channels/index.js.map +1 -1
- package/resources/channels/index.mjs.map +1 -1
- package/resources/channels/voice.d.mts +13 -105
- package/resources/channels/voice.d.mts.map +1 -1
- package/resources/channels/voice.d.ts +13 -105
- package/resources/channels/voice.d.ts.map +1 -1
- package/resources/channels/voice.js +12 -41
- package/resources/channels/voice.js.map +1 -1
- package/resources/channels/voice.mjs +12 -41
- package/resources/channels/voice.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 +3 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/messages.d.mts +8 -1
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +8 -1
- package/resources/messages.d.ts.map +1 -1
- package/resources/profiles/profiles.d.mts +7 -0
- package/resources/profiles/profiles.d.mts.map +1 -1
- package/resources/profiles/profiles.d.ts +7 -0
- package/resources/profiles/profiles.d.ts.map +1 -1
- package/resources/profiles/profiles.js +7 -0
- package/resources/profiles/profiles.js.map +1 -1
- package/resources/profiles/profiles.mjs +7 -0
- package/resources/profiles/profiles.mjs.map +1 -1
- package/resources/templates.d.mts +14 -13
- package/resources/templates.d.mts.map +1 -1
- package/resources/templates.d.ts +14 -13
- package/resources/templates.d.ts.map +1 -1
- package/resources/{calls → voice/calls}/calls.d.mts +17 -12
- package/resources/voice/calls/calls.d.mts.map +1 -0
- package/resources/{calls → voice/calls}/calls.d.ts +17 -12
- package/resources/voice/calls/calls.d.ts.map +1 -0
- package/resources/{calls → voice/calls}/calls.js +17 -17
- package/resources/voice/calls/calls.js.map +1 -0
- package/resources/{calls → voice/calls}/calls.mjs +16 -16
- package/resources/voice/calls/calls.mjs.map +1 -0
- package/resources/voice/calls/index.d.mts.map +1 -0
- package/resources/voice/calls/index.d.ts.map +1 -0
- package/resources/voice/calls/index.js.map +1 -0
- package/resources/voice/calls/index.mjs.map +1 -0
- package/resources/{calls → voice/calls}/participants.d.mts +14 -14
- package/resources/voice/calls/participants.d.mts.map +1 -0
- package/resources/{calls → voice/calls}/participants.d.ts +14 -14
- package/resources/voice/calls/participants.d.ts.map +1 -0
- package/resources/{calls → voice/calls}/participants.js +17 -17
- package/resources/voice/calls/participants.js.map +1 -0
- package/resources/{calls → voice/calls}/participants.mjs +17 -17
- package/resources/voice/calls/participants.mjs.map +1 -0
- package/resources/voice/calls.d.mts.map +1 -0
- package/resources/voice/calls.d.ts.map +1 -0
- package/resources/{calls.js → voice/calls.js} +1 -1
- package/resources/voice/calls.js.map +1 -0
- package/resources/voice/calls.mjs.map +1 -0
- package/resources/voice/index.d.mts +4 -0
- package/resources/{calls → voice}/index.d.mts.map +1 -1
- package/resources/voice/index.d.ts +4 -0
- package/resources/{calls → voice}/index.d.ts.map +1 -1
- package/resources/voice/index.js +11 -0
- package/resources/voice/index.js.map +1 -0
- package/resources/voice/index.mjs +5 -0
- package/resources/voice/index.mjs.map +1 -0
- package/resources/voice/tokens.d.mts +109 -0
- package/resources/voice/tokens.d.mts.map +1 -0
- package/resources/voice/tokens.d.ts +109 -0
- package/resources/voice/tokens.d.ts.map +1 -0
- package/resources/voice/tokens.js +45 -0
- package/resources/voice/tokens.js.map +1 -0
- package/resources/voice/tokens.mjs +41 -0
- package/resources/voice/tokens.mjs.map +1 -0
- package/resources/voice/voice.d.mts +14 -0
- package/resources/voice/voice.d.mts.map +1 -0
- package/resources/voice/voice.d.ts +14 -0
- package/resources/voice/voice.d.ts.map +1 -0
- package/resources/voice/voice.js +21 -0
- package/resources/voice/voice.js.map +1 -0
- package/resources/voice/voice.mjs +16 -0
- package/resources/voice/voice.mjs.map +1 -0
- package/resources/voice.d.mts +2 -0
- package/resources/voice.d.mts.map +1 -0
- package/resources/voice.d.ts +2 -0
- package/resources/voice.d.ts.map +1 -0
- package/resources/voice.js +6 -0
- package/resources/voice.js.map +1 -0
- package/resources/voice.mjs +3 -0
- package/resources/voice.mjs.map +1 -0
- package/resources/webhooks.d.mts +15 -2
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +15 -2
- package/resources/webhooks.d.ts.map +1 -1
- package/src/client.ts +4 -45
- package/src/resources/channels/channels.ts +0 -6
- package/src/resources/channels/index.ts +0 -3
- package/src/resources/channels/voice.ts +12 -135
- package/src/resources/index.ts +1 -18
- package/src/resources/messages.ts +8 -1
- package/src/resources/profiles/profiles.ts +7 -0
- package/src/resources/templates.ts +14 -13
- package/src/resources/{calls → voice/calls}/calls.ts +25 -19
- package/src/resources/{calls → voice/calls}/participants.ts +21 -21
- package/src/resources/voice/index.ts +22 -0
- package/src/resources/voice/tokens.ts +144 -0
- package/src/resources/voice/voice.ts +60 -0
- package/src/resources/voice.ts +3 -0
- package/src/resources/webhooks.ts +16 -2
- 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/calls/calls.d.mts.map +0 -1
- package/resources/calls/calls.d.ts.map +0 -1
- package/resources/calls/calls.js.map +0 -1
- package/resources/calls/calls.mjs.map +0 -1
- package/resources/calls/index.js.map +0 -1
- package/resources/calls/index.mjs.map +0 -1
- package/resources/calls/participants.d.mts.map +0 -1
- package/resources/calls/participants.d.ts.map +0 -1
- package/resources/calls/participants.js.map +0 -1
- package/resources/calls/participants.mjs.map +0 -1
- package/resources/calls.d.mts.map +0 -1
- package/resources/calls.d.ts.map +0 -1
- package/resources/calls.js.map +0 -1
- package/resources/calls.mjs.map +0 -1
- /package/resources/{calls → voice/calls}/index.d.mts +0 -0
- /package/resources/{calls → voice/calls}/index.d.ts +0 -0
- /package/resources/{calls → voice/calls}/index.js +0 -0
- /package/resources/{calls → voice/calls}/index.mjs +0 -0
- /package/resources/{calls.d.mts → voice/calls.d.mts} +0 -0
- /package/resources/{calls.d.ts → voice/calls.d.ts} +0 -0
- /package/resources/{calls.mjs → voice/calls.mjs} +0 -0
- /package/src/resources/{calls → voice/calls}/index.ts +0 -0
- /package/src/resources/{calls.ts → voice/calls.ts} +0 -0
package/src/client.ts
CHANGED
|
@@ -135,24 +135,6 @@ import {
|
|
|
135
135
|
WebhookUpdateParams,
|
|
136
136
|
Webhooks,
|
|
137
137
|
} from './resources/webhooks';
|
|
138
|
-
import {
|
|
139
|
-
APIResponseOfCall,
|
|
140
|
-
APIResponseOfCallRecordings,
|
|
141
|
-
APIResponseOfCallsList,
|
|
142
|
-
Call,
|
|
143
|
-
CallHangupParams,
|
|
144
|
-
CallListParams,
|
|
145
|
-
CallListRecordingsParams,
|
|
146
|
-
CallParty,
|
|
147
|
-
CallRecordParams,
|
|
148
|
-
CallRecording,
|
|
149
|
-
CallRecordings,
|
|
150
|
-
CallRetrieveParams,
|
|
151
|
-
CallTimelineEntry,
|
|
152
|
-
Calls,
|
|
153
|
-
CallsCallsPage,
|
|
154
|
-
CallsList,
|
|
155
|
-
} from './resources/calls/calls';
|
|
156
138
|
import { Channels } from './resources/channels/channels';
|
|
157
139
|
import {
|
|
158
140
|
APIResponseOfProfileDetail,
|
|
@@ -176,6 +158,7 @@ import {
|
|
|
176
158
|
TcrBrandRelationship,
|
|
177
159
|
TcrVertical,
|
|
178
160
|
} from './resources/profiles/profiles';
|
|
161
|
+
import { Voice } from './resources/voice/voice';
|
|
179
162
|
import { type Fetch } from './internal/builtin-types';
|
|
180
163
|
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
|
181
164
|
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
|
|
@@ -982,14 +965,7 @@ export class Sent {
|
|
|
982
965
|
* Read-only. Sending is **Messages**; a reply arrives here and through your webhooks.
|
|
983
966
|
*/
|
|
984
967
|
conversations: API.Conversations = new API.Conversations(this);
|
|
985
|
-
|
|
986
|
-
* Phone calls from the numbers you hold, driven by your own callback URL.
|
|
987
|
-
*
|
|
988
|
-
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/channels/voice/tokens` mints a short-lived token that lets a user of your app place and receive calls as that number. When a call arrives or a caller presses a key, a signed question is POSTed to the callback URL and the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events themselves (`call.completed` and the rest) arrive through your webhooks.
|
|
989
|
-
*
|
|
990
|
-
* Every call is a record under `/v3/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
|
|
991
|
-
*/
|
|
992
|
-
calls: API.Calls = new API.Calls(this);
|
|
968
|
+
voice: API.Voice = new API.Voice(this);
|
|
993
969
|
channels: API.Channels = new API.Channels(this);
|
|
994
970
|
/**
|
|
995
971
|
* Who the current key is.
|
|
@@ -1007,7 +983,7 @@ Sent.Numbers = Numbers;
|
|
|
1007
983
|
Sent.Messages = Messages;
|
|
1008
984
|
Sent.Contacts = Contacts;
|
|
1009
985
|
Sent.Conversations = Conversations;
|
|
1010
|
-
Sent.
|
|
986
|
+
Sent.Voice = Voice;
|
|
1011
987
|
Sent.Channels = Channels;
|
|
1012
988
|
Sent.Me = Me;
|
|
1013
989
|
|
|
@@ -1176,24 +1152,7 @@ export declare namespace Sent {
|
|
|
1176
1152
|
type ConversationListMessagesParams as ConversationListMessagesParams,
|
|
1177
1153
|
};
|
|
1178
1154
|
|
|
1179
|
-
export {
|
|
1180
|
-
Calls as Calls,
|
|
1181
|
-
type APIResponseOfCall as APIResponseOfCall,
|
|
1182
|
-
type APIResponseOfCallRecordings as APIResponseOfCallRecordings,
|
|
1183
|
-
type APIResponseOfCallsList as APIResponseOfCallsList,
|
|
1184
|
-
type Call as Call,
|
|
1185
|
-
type CallParty as CallParty,
|
|
1186
|
-
type CallRecording as CallRecording,
|
|
1187
|
-
type CallRecordings as CallRecordings,
|
|
1188
|
-
type CallTimelineEntry as CallTimelineEntry,
|
|
1189
|
-
type CallsList as CallsList,
|
|
1190
|
-
type CallsCallsPage as CallsCallsPage,
|
|
1191
|
-
type CallRetrieveParams as CallRetrieveParams,
|
|
1192
|
-
type CallListParams as CallListParams,
|
|
1193
|
-
type CallHangupParams as CallHangupParams,
|
|
1194
|
-
type CallListRecordingsParams as CallListRecordingsParams,
|
|
1195
|
-
type CallRecordParams as CallRecordParams,
|
|
1196
|
-
};
|
|
1155
|
+
export { Voice as Voice };
|
|
1197
1156
|
|
|
1198
1157
|
export { Channels as Channels };
|
|
1199
1158
|
|
|
@@ -8,14 +8,12 @@ import {
|
|
|
8
8
|
APIResponseOfVoiceNumber,
|
|
9
9
|
APIResponseOfVoiceNumberCreated,
|
|
10
10
|
APIResponseOfVoiceSecret,
|
|
11
|
-
APIResponseOfVoiceToken,
|
|
12
11
|
Voice,
|
|
13
12
|
VoiceCallbackTest,
|
|
14
13
|
VoiceCallbackTestErrorInfo,
|
|
15
14
|
VoiceCallbackTestRequestInfo,
|
|
16
15
|
VoiceCallbackTestResponseInfo,
|
|
17
16
|
VoiceCreateParams,
|
|
18
|
-
VoiceCreateTokenParams,
|
|
19
17
|
VoiceListParams,
|
|
20
18
|
VoiceNumber,
|
|
21
19
|
VoiceNumberCreated,
|
|
@@ -23,7 +21,6 @@ import {
|
|
|
23
21
|
VoiceRotateSecretParams,
|
|
24
22
|
VoiceSecret,
|
|
25
23
|
VoiceTestParams,
|
|
26
|
-
VoiceToken,
|
|
27
24
|
VoiceUpdateParams,
|
|
28
25
|
} from './voice';
|
|
29
26
|
|
|
@@ -41,7 +38,6 @@ export declare namespace Channels {
|
|
|
41
38
|
type APIResponseOfVoiceNumber as APIResponseOfVoiceNumber,
|
|
42
39
|
type APIResponseOfVoiceNumberCreated as APIResponseOfVoiceNumberCreated,
|
|
43
40
|
type APIResponseOfVoiceSecret as APIResponseOfVoiceSecret,
|
|
44
|
-
type APIResponseOfVoiceToken as APIResponseOfVoiceToken,
|
|
45
41
|
type VoiceCallbackTest as VoiceCallbackTest,
|
|
46
42
|
type VoiceCallbackTestErrorInfo as VoiceCallbackTestErrorInfo,
|
|
47
43
|
type VoiceCallbackTestRequestInfo as VoiceCallbackTestRequestInfo,
|
|
@@ -49,12 +45,10 @@ export declare namespace Channels {
|
|
|
49
45
|
type VoiceNumber as VoiceNumber,
|
|
50
46
|
type VoiceNumberCreated as VoiceNumberCreated,
|
|
51
47
|
type VoiceSecret as VoiceSecret,
|
|
52
|
-
type VoiceToken as VoiceToken,
|
|
53
48
|
type VoiceCreateParams as VoiceCreateParams,
|
|
54
49
|
type VoiceRetrieveParams as VoiceRetrieveParams,
|
|
55
50
|
type VoiceUpdateParams as VoiceUpdateParams,
|
|
56
51
|
type VoiceListParams as VoiceListParams,
|
|
57
|
-
type VoiceCreateTokenParams as VoiceCreateTokenParams,
|
|
58
52
|
type VoiceRotateSecretParams as VoiceRotateSecretParams,
|
|
59
53
|
type VoiceTestParams as VoiceTestParams,
|
|
60
54
|
};
|
|
@@ -8,7 +8,6 @@ export {
|
|
|
8
8
|
type APIResponseOfVoiceNumber,
|
|
9
9
|
type APIResponseOfVoiceNumberCreated,
|
|
10
10
|
type APIResponseOfVoiceSecret,
|
|
11
|
-
type APIResponseOfVoiceToken,
|
|
12
11
|
type VoiceCallbackTest,
|
|
13
12
|
type VoiceCallbackTestErrorInfo,
|
|
14
13
|
type VoiceCallbackTestRequestInfo,
|
|
@@ -16,12 +15,10 @@ export {
|
|
|
16
15
|
type VoiceNumber,
|
|
17
16
|
type VoiceNumberCreated,
|
|
18
17
|
type VoiceSecret,
|
|
19
|
-
type VoiceToken,
|
|
20
18
|
type VoiceCreateParams,
|
|
21
19
|
type VoiceRetrieveParams,
|
|
22
20
|
type VoiceUpdateParams,
|
|
23
21
|
type VoiceListParams,
|
|
24
|
-
type VoiceCreateTokenParams,
|
|
25
22
|
type VoiceRotateSecretParams,
|
|
26
23
|
type VoiceTestParams,
|
|
27
24
|
} from './voice';
|
|
@@ -10,7 +10,7 @@ import { path } from '../../internal/utils/path';
|
|
|
10
10
|
/**
|
|
11
11
|
* The senders you send from, one per channel.
|
|
12
12
|
*
|
|
13
|
-
* **SMS is a list of markets**, each keyed by `(country, number_type)` — a customer can hold `us/10dlc` and `gb/alphanumeric` at once, so a market is addressed by the pair rather than by country alone. **WhatsApp and RCS are single**: a customer has one business account and one agent. **Voice is per number**: each number you hold can carry phone calls on its own (`POST /v3/channels/voice`), each with the callback URL Sent asks what to do with its calls, one of them is the default line for calls placed from your app, and voice tokens are minted
|
|
13
|
+
* **SMS is a list of markets**, each keyed by `(country, number_type)` — a customer can hold `us/10dlc` and `gb/alphanumeric` at once, so a market is addressed by the pair rather than by country alone. **WhatsApp and RCS are single**: a customer has one business account and one agent. **Voice is per number**: each number you hold can carry phone calls on its own (`POST /v3/channels/voice`), each with the callback URL Sent asks what to do with its calls, one of them is the default line for calls placed from your app, and voice tokens are minted with `POST /v3/voice/tokens`. Read your voice numbers with `GET /v3/channels/voice` and change one with `PATCH /v3/channels/voice/{number}`.
|
|
14
14
|
*
|
|
15
15
|
* ## Compliance lives on the market
|
|
16
16
|
*
|
|
@@ -109,19 +109,23 @@ export class Voice extends APIResource {
|
|
|
109
109
|
*
|
|
110
110
|
* ## What it changes
|
|
111
111
|
*
|
|
112
|
-
* | Body | Effect
|
|
113
|
-
* | --------------------------------------------- |
|
|
114
|
-
* | `"status": "ACTIVE"` | turns calls on again for a number you turned off; the callback URL and the secret it had are kept
|
|
115
|
-
* | `"status": "INACTIVE"` | turns calls off; the callback URL and the secret stay on the number
|
|
116
|
-
* | `"default_for_app_calls": true` | makes this the line app-originated calls are placed from when a voice token names no number
|
|
117
|
-
* | `"callback_url": "https://example.com/voice"` | replaces where Sent asks what to do with each call on the number; the signing secret
|
|
118
|
-
* | key omitted | left exactly as it is
|
|
112
|
+
* | Body | Effect |
|
|
113
|
+
* | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
114
|
+
* | `"status": "ACTIVE"` | turns calls on again for a number you turned off; the callback URL and the secret it had are kept |
|
|
115
|
+
* | `"status": "INACTIVE"` | turns calls off; the callback URL and the secret stay on the number |
|
|
116
|
+
* | `"default_for_app_calls": true` | makes this the line app-originated calls are placed from when a voice token names no number |
|
|
117
|
+
* | `"callback_url": "https://example.com/voice"` | replaces where Sent asks what to do with each call on the number; the signing secret and the status are kept |
|
|
118
|
+
* | key omitted | left exactly as it is |
|
|
119
119
|
*
|
|
120
120
|
* `status` is matched ignoring case. Any combination is accepted:
|
|
121
121
|
* `status: "ACTIVE"` with `default_for_app_calls: true` turns a number on as the
|
|
122
122
|
* new default, and a `callback_url` sent with either status is written too. A body
|
|
123
123
|
* that names none of the three is refused.
|
|
124
124
|
*
|
|
125
|
+
* A number can be on without a callback URL: calls placed from your app then
|
|
126
|
+
* connect straight to the number or user they dial, and calls to the number are
|
|
127
|
+
* declined.
|
|
128
|
+
*
|
|
125
129
|
* ## What it will refuse
|
|
126
130
|
*
|
|
127
131
|
* **`default_for_app_calls: false` is `400`.** An account with active voice
|
|
@@ -135,11 +139,6 @@ export class Voice extends APIResource {
|
|
|
135
139
|
* **Making an inactive number the default is `400`.** Send `status: "ACTIVE"` in
|
|
136
140
|
* the same call.
|
|
137
141
|
*
|
|
138
|
-
* A number added without a `callback_url` is `INACTIVE` for that one reason, so
|
|
139
|
-
* sending it a `callback_url` turns it on by itself, and it becomes your default
|
|
140
|
-
* line if you have no other active voice number. A number you turned off while it
|
|
141
|
-
* had a URL stays off.
|
|
142
|
-
*
|
|
143
142
|
* **A number you never turned voice on for is `404`.** Add it with
|
|
144
143
|
* `POST /v3/channels/voice`.
|
|
145
144
|
*
|
|
@@ -206,35 +205,6 @@ export class Voice extends APIResource {
|
|
|
206
205
|
});
|
|
207
206
|
}
|
|
208
207
|
|
|
209
|
-
/**
|
|
210
|
-
* Mints a short-lived token for one of your app users. Call this from your backend
|
|
211
|
-
* and return the token to your app, which passes it to the voice client SDK to
|
|
212
|
-
* register. The identity is bound to the given number, or to your default app-call
|
|
213
|
-
* number when omitted, and calls placed by that identity are routed through the
|
|
214
|
-
* bound number. Minting again re-binds the identity, so an identity can move
|
|
215
|
-
* between numbers.
|
|
216
|
-
*
|
|
217
|
-
* @example
|
|
218
|
-
* ```ts
|
|
219
|
-
* const apiResponseOfVoiceToken =
|
|
220
|
-
* await client.channels.voice.createToken();
|
|
221
|
-
* ```
|
|
222
|
-
*/
|
|
223
|
-
createToken(params: VoiceCreateTokenParams, options?: RequestOptions): APIPromise<APIResponseOfVoiceToken> {
|
|
224
|
-
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
225
|
-
return this._client.post('/v3/channels/voice/tokens', {
|
|
226
|
-
body,
|
|
227
|
-
...options,
|
|
228
|
-
headers: buildHeaders([
|
|
229
|
-
{
|
|
230
|
-
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
231
|
-
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
232
|
-
},
|
|
233
|
-
options?.headers,
|
|
234
|
-
]),
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
|
|
238
208
|
/**
|
|
239
209
|
* Generates a new signing secret for the questions Sent sends to this number's
|
|
240
210
|
* callback URL and returns it. The previous secret stops signing immediately, so
|
|
@@ -434,31 +404,6 @@ export interface APIResponseOfVoiceSecret {
|
|
|
434
404
|
success?: boolean;
|
|
435
405
|
}
|
|
436
406
|
|
|
437
|
-
/**
|
|
438
|
-
* Standard API response envelope for all v3 endpoints
|
|
439
|
-
*/
|
|
440
|
-
export interface APIResponseOfVoiceToken {
|
|
441
|
-
/**
|
|
442
|
-
* A short-lived token your app passes to the voice client SDK to register
|
|
443
|
-
*/
|
|
444
|
-
data?: VoiceToken | null;
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* Error information
|
|
448
|
-
*/
|
|
449
|
-
error?: WebhooksAPI.ErrorDetail | null;
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Request and response metadata
|
|
453
|
-
*/
|
|
454
|
-
meta?: WebhooksAPI.APIMeta;
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Indicates whether the request was successful
|
|
458
|
-
*/
|
|
459
|
-
success?: boolean;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
407
|
/**
|
|
463
408
|
* The verdict of a test question sent to your callback URL
|
|
464
409
|
*/
|
|
@@ -614,31 +559,6 @@ export interface VoiceSecret {
|
|
|
614
559
|
callback_secret?: string;
|
|
615
560
|
}
|
|
616
561
|
|
|
617
|
-
/**
|
|
618
|
-
* A short-lived token your app passes to the voice client SDK to register
|
|
619
|
-
*/
|
|
620
|
-
export interface VoiceToken {
|
|
621
|
-
/**
|
|
622
|
-
* The signed token. Hand it to the client SDK unchanged.
|
|
623
|
-
*/
|
|
624
|
-
token?: string;
|
|
625
|
-
|
|
626
|
-
/**
|
|
627
|
-
* When the token expires (UTC)
|
|
628
|
-
*/
|
|
629
|
-
expires_at?: string;
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* The identity the token was minted for
|
|
633
|
-
*/
|
|
634
|
-
identity?: string;
|
|
635
|
-
|
|
636
|
-
/**
|
|
637
|
-
* The phone number this identity is now bound to, in E.164 format
|
|
638
|
-
*/
|
|
639
|
-
number?: string;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
562
|
export interface VoiceCreateParams {
|
|
643
563
|
/**
|
|
644
564
|
* Body param: Where Sent asks what to do with each call on this number: an
|
|
@@ -753,46 +673,6 @@ export interface VoiceListParams {
|
|
|
753
673
|
'x-profile-id'?: string;
|
|
754
674
|
}
|
|
755
675
|
|
|
756
|
-
export interface VoiceCreateTokenParams {
|
|
757
|
-
/**
|
|
758
|
-
* Body param: Your identifier for the app user, such as an agent or account id.
|
|
759
|
-
* Letters, digits, hyphens and underscores only, up to 200 characters.
|
|
760
|
-
*/
|
|
761
|
-
identity?: string;
|
|
762
|
-
|
|
763
|
-
/**
|
|
764
|
-
* Body param: One of your voice-enabled phone numbers in E.164 format. Calls
|
|
765
|
-
* placed by this identity are routed through that number. Omit to use your default
|
|
766
|
-
* app-call number.
|
|
767
|
-
*/
|
|
768
|
-
number?: string | null;
|
|
769
|
-
|
|
770
|
-
/**
|
|
771
|
-
* Body param: Sandbox flag - when true, the operation is simulated without side
|
|
772
|
-
* effects Useful for testing integrations without actual execution
|
|
773
|
-
*/
|
|
774
|
-
sandbox?: boolean;
|
|
775
|
-
|
|
776
|
-
/**
|
|
777
|
-
* Body param: Token lifetime in seconds. Defaults to 600 and cannot exceed 3600.
|
|
778
|
-
*/
|
|
779
|
-
ttl?: number | null;
|
|
780
|
-
|
|
781
|
-
/**
|
|
782
|
-
* Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
783
|
-
* alphanumeric characters, hyphens, or underscores. Responses are cached for 24
|
|
784
|
-
* hours per key per customer.
|
|
785
|
-
*/
|
|
786
|
-
'Idempotency-Key'?: string;
|
|
787
|
-
|
|
788
|
-
/**
|
|
789
|
-
* Header param: Profile UUID to scope the request to a child profile. Only
|
|
790
|
-
* organization API keys can use this header. The profile must belong to the
|
|
791
|
-
* calling organization.
|
|
792
|
-
*/
|
|
793
|
-
'x-profile-id'?: string;
|
|
794
|
-
}
|
|
795
|
-
|
|
796
676
|
export interface VoiceRotateSecretParams {
|
|
797
677
|
/**
|
|
798
678
|
* Body param: Sandbox flag - when true, the operation is simulated without side
|
|
@@ -844,7 +724,6 @@ export declare namespace Voice {
|
|
|
844
724
|
type APIResponseOfVoiceNumber as APIResponseOfVoiceNumber,
|
|
845
725
|
type APIResponseOfVoiceNumberCreated as APIResponseOfVoiceNumberCreated,
|
|
846
726
|
type APIResponseOfVoiceSecret as APIResponseOfVoiceSecret,
|
|
847
|
-
type APIResponseOfVoiceToken as APIResponseOfVoiceToken,
|
|
848
727
|
type VoiceCallbackTest as VoiceCallbackTest,
|
|
849
728
|
type VoiceCallbackTestErrorInfo as VoiceCallbackTestErrorInfo,
|
|
850
729
|
type VoiceCallbackTestRequestInfo as VoiceCallbackTestRequestInfo,
|
|
@@ -852,12 +731,10 @@ export declare namespace Voice {
|
|
|
852
731
|
type VoiceNumber as VoiceNumber,
|
|
853
732
|
type VoiceNumberCreated as VoiceNumberCreated,
|
|
854
733
|
type VoiceSecret as VoiceSecret,
|
|
855
|
-
type VoiceToken as VoiceToken,
|
|
856
734
|
type VoiceCreateParams as VoiceCreateParams,
|
|
857
735
|
type VoiceRetrieveParams as VoiceRetrieveParams,
|
|
858
736
|
type VoiceUpdateParams as VoiceUpdateParams,
|
|
859
737
|
type VoiceListParams as VoiceListParams,
|
|
860
|
-
type VoiceCreateTokenParams as VoiceCreateTokenParams,
|
|
861
738
|
type VoiceRotateSecretParams as VoiceRotateSecretParams,
|
|
862
739
|
type VoiceTestParams as VoiceTestParams,
|
|
863
740
|
};
|
package/src/resources/index.ts
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
export {
|
|
4
|
-
Calls,
|
|
5
|
-
type APIResponseOfCall,
|
|
6
|
-
type APIResponseOfCallRecordings,
|
|
7
|
-
type APIResponseOfCallsList,
|
|
8
|
-
type Call,
|
|
9
|
-
type CallParty,
|
|
10
|
-
type CallRecording,
|
|
11
|
-
type CallRecordings,
|
|
12
|
-
type CallTimelineEntry,
|
|
13
|
-
type CallsList,
|
|
14
|
-
type CallRetrieveParams,
|
|
15
|
-
type CallListParams,
|
|
16
|
-
type CallHangupParams,
|
|
17
|
-
type CallListRecordingsParams,
|
|
18
|
-
type CallRecordParams,
|
|
19
|
-
type CallsCallsPage,
|
|
20
|
-
} from './calls/calls';
|
|
21
3
|
export { Channels } from './channels/channels';
|
|
22
4
|
export {
|
|
23
5
|
Contacts,
|
|
@@ -105,6 +87,7 @@ export {
|
|
|
105
87
|
type UserRemoveParams,
|
|
106
88
|
type UserUpdateRoleParams,
|
|
107
89
|
} from './users';
|
|
90
|
+
export { Voice } from './voice/voice';
|
|
108
91
|
export {
|
|
109
92
|
Webhooks,
|
|
110
93
|
type APIMeta,
|
|
@@ -646,6 +646,11 @@ export interface MessageSendParams {
|
|
|
646
646
|
* itself is unchanged: the same rules are scored and ranked the same way, with
|
|
647
647
|
* routes pinned to numbers you did not list removed from the running.
|
|
648
648
|
*
|
|
649
|
+
* Each channel's list is independent: an sms list does not restrict MMS. To choose
|
|
650
|
+
* the numbers a message may go out from as MMS, name them under mms. MMS sends
|
|
651
|
+
* from your SMS numbers, so an mms list may name any of your active SMS numbers
|
|
652
|
+
* whose market carries MMS — the ones listed under mms in your channels.
|
|
653
|
+
*
|
|
649
654
|
* Every number must be an active sender on your account. The request itself is
|
|
650
655
|
* still accepted (202) if one is not — like every other send-time rule, that is
|
|
651
656
|
* decided per message, so each affected message is recorded BLOCKED with error
|
|
@@ -663,7 +668,9 @@ export interface MessageSendParams {
|
|
|
663
668
|
*
|
|
664
669
|
* Their presence is also what makes a message eligible for MMS on an auto-detect
|
|
665
670
|
* send: a message with nothing attached is delivered as SMS, because an MMS with
|
|
666
|
-
* no media is a more expensive text message.
|
|
671
|
+
* no media is a more expensive text message. For the same reason a send that names
|
|
672
|
+
* mms in channel with nothing attached, here or on the template, is refused with
|
|
673
|
+
* a 400.
|
|
667
674
|
*
|
|
668
675
|
* The recipient's carrier fetches each URL after the send is accepted, so it must
|
|
669
676
|
* stay publicly reachable — a link that expires, or one behind auth, arrives as a
|
|
@@ -216,6 +216,13 @@ export class Profiles extends APIResource {
|
|
|
216
216
|
* deregistered, and its routing rules stop being used. Requires admin role in the
|
|
217
217
|
* organization.
|
|
218
218
|
*
|
|
219
|
+
* A number it holds that your WhatsApp Business Account still carries refuses the
|
|
220
|
+
* delete with a `409 CONFLICT_012`, and nothing is deleted: the number would
|
|
221
|
+
* return to our shared inventory while Meta still routes WhatsApp to it, and only
|
|
222
|
+
* you can take it off the account — deregister **and** delete it in WhatsApp
|
|
223
|
+
* Manager, then try again. A `409 CONFLICT_013` means the account could not be
|
|
224
|
+
* read, so we cannot tell.
|
|
225
|
+
*
|
|
219
226
|
* @deprecated
|
|
220
227
|
*/
|
|
221
228
|
delete(profileID: string, params: ProfileDeleteParams, options?: RequestOptions): APIPromise<void> {
|
|
@@ -255,17 +255,18 @@ export interface Template {
|
|
|
255
255
|
|
|
256
256
|
/**
|
|
257
257
|
* The channels this template's definition can render on, in canonical order: sms,
|
|
258
|
-
* whatsapp, rcs.
|
|
258
|
+
* whatsapp, rcs, mms.
|
|
259
259
|
*
|
|
260
260
|
* Derived from the definition's body, mirroring each channel's send-time fallback
|
|
261
261
|
* chain, so a channel is listed only when a real body would be produced for it:
|
|
262
262
|
* SMS reads sms ?? multiChannel, WhatsApp reads whatsapp ?? multiChannel, and RCS
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
* too.
|
|
263
|
+
* and MMS read rcs ?? multiChannel ?? sms and mms ?? multiChannel ?? sms. A
|
|
264
|
+
* multiChannel body therefore reports all four, and the extra SMS fallback is why
|
|
265
|
+
* an sms/whatsapp pair reports RCS and MMS too.
|
|
266
266
|
*
|
|
267
267
|
* This says what the content can render on, not what may be sent: sending also
|
|
268
|
-
* needs the template approved for that channel
|
|
268
|
+
* needs the template approved for that channel, and MMS needs an attachment, from
|
|
269
|
+
* media_urls or the template's mms body.
|
|
269
270
|
*/
|
|
270
271
|
channels?: Array<string> | null;
|
|
271
272
|
|
|
@@ -323,10 +324,10 @@ export interface TemplateBody {
|
|
|
323
324
|
* MMS-specific content — subject, text and attachments.
|
|
324
325
|
*
|
|
325
326
|
* Like Rcs, an override that cannot stand on its own: a template still needs a
|
|
326
|
-
* MultiChannel body or the Sms + Whatsapp pair to be deliverable at all.
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
327
|
+
* MultiChannel body or the Sms + Whatsapp pair to be deliverable at all. Without
|
|
328
|
+
* this slot MMS renders the shared or SMS body, so it is only needed for
|
|
329
|
+
* MMS-specific copy, a subject or attachments. When present it replaces that body
|
|
330
|
+
* on MMS rather than adding to it.
|
|
330
331
|
*/
|
|
331
332
|
mms?: TemplateBody.Mms | null;
|
|
332
333
|
|
|
@@ -358,10 +359,10 @@ export namespace TemplateBody {
|
|
|
358
359
|
* MMS-specific content — subject, text and attachments.
|
|
359
360
|
*
|
|
360
361
|
* Like Rcs, an override that cannot stand on its own: a template still needs a
|
|
361
|
-
* MultiChannel body or the Sms + Whatsapp pair to be deliverable at all.
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
362
|
+
* MultiChannel body or the Sms + Whatsapp pair to be deliverable at all. Without
|
|
363
|
+
* this slot MMS renders the shared or SMS body, so it is only needed for
|
|
364
|
+
* MMS-specific copy, a subject or attachments. When present it replaces that body
|
|
365
|
+
* on MMS rather than adding to it.
|
|
365
366
|
*/
|
|
366
367
|
export interface Mms extends TemplatesAPI.TemplateBodyContent {
|
|
367
368
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from '
|
|
4
|
-
import * as WebhooksAPI from '
|
|
3
|
+
import { APIResource } from '../../../core/resource';
|
|
4
|
+
import * as WebhooksAPI from '../../webhooks';
|
|
5
5
|
import * as ParticipantsAPI from './participants';
|
|
6
6
|
import {
|
|
7
7
|
APIResponseOfListOfCallParticipant,
|
|
@@ -14,18 +14,18 @@ import {
|
|
|
14
14
|
ParticipantUpdateParams,
|
|
15
15
|
Participants,
|
|
16
16
|
} from './participants';
|
|
17
|
-
import { APIPromise } from '
|
|
18
|
-
import { CallsPage, type CallsPageParams, PagePromise } from '
|
|
19
|
-
import { buildHeaders } from '
|
|
20
|
-
import { RequestOptions } from '
|
|
21
|
-
import { path } from '
|
|
17
|
+
import { APIPromise } from '../../../core/api-promise';
|
|
18
|
+
import { CallsPage, type CallsPageParams, PagePromise } from '../../../core/pagination';
|
|
19
|
+
import { buildHeaders } from '../../../internal/headers';
|
|
20
|
+
import { RequestOptions } from '../../../internal/request-options';
|
|
21
|
+
import { path } from '../../../internal/utils/path';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Phone calls from the numbers you hold, driven by your own callback URL.
|
|
25
25
|
*
|
|
26
|
-
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/
|
|
26
|
+
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/voice/tokens` mints a short-lived token that lets a user of your app place and receive calls as that number. When a call arrives or a caller presses a key, a signed question is POSTed to the callback URL and the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events themselves (`call.completed` and the rest) arrive through your webhooks.
|
|
27
27
|
*
|
|
28
|
-
* Every call is a record under `/v3/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
|
|
28
|
+
* Every call is a record under `/v3/voice/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
|
|
29
29
|
*/
|
|
30
30
|
export class Calls extends APIResource {
|
|
31
31
|
participants: ParticipantsAPI.Participants = new ParticipantsAPI.Participants(this._client);
|
|
@@ -37,7 +37,7 @@ export class Calls extends APIResource {
|
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
39
|
* ```ts
|
|
40
|
-
* const apiResponseOfCall = await client.calls.retrieve(
|
|
40
|
+
* const apiResponseOfCall = await client.voice.calls.retrieve(
|
|
41
41
|
* 'call_9f2ab000-0000-4000-8000-000000000001',
|
|
42
42
|
* );
|
|
43
43
|
* ```
|
|
@@ -48,7 +48,7 @@ export class Calls extends APIResource {
|
|
|
48
48
|
options?: RequestOptions,
|
|
49
49
|
): APIPromise<APIResponseOfCall> {
|
|
50
50
|
const { 'x-profile-id': xProfileID } = params ?? {};
|
|
51
|
-
return this._client.get(path`/v3/calls/${id}`, {
|
|
51
|
+
return this._client.get(path`/v3/voice/calls/${id}`, {
|
|
52
52
|
...options,
|
|
53
53
|
headers: buildHeaders([
|
|
54
54
|
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
@@ -66,7 +66,7 @@ export class Calls extends APIResource {
|
|
|
66
66
|
* @example
|
|
67
67
|
* ```ts
|
|
68
68
|
* // Automatically fetches more pages as needed.
|
|
69
|
-
* for await (const call of client.calls.list()) {
|
|
69
|
+
* for await (const call of client.voice.calls.list()) {
|
|
70
70
|
* // ...
|
|
71
71
|
* }
|
|
72
72
|
* ```
|
|
@@ -76,7 +76,7 @@ export class Calls extends APIResource {
|
|
|
76
76
|
options?: RequestOptions,
|
|
77
77
|
): PagePromise<CallsCallsPage, Call> {
|
|
78
78
|
const { 'x-profile-id': xProfileID, ...query } = params ?? {};
|
|
79
|
-
return this._client.getAPIList('/v3/calls', CallsPage<Call>, {
|
|
79
|
+
return this._client.getAPIList('/v3/voice/calls', CallsPage<Call>, {
|
|
80
80
|
query,
|
|
81
81
|
...options,
|
|
82
82
|
headers: buildHeaders([
|
|
@@ -95,14 +95,14 @@ export class Calls extends APIResource {
|
|
|
95
95
|
*
|
|
96
96
|
* @example
|
|
97
97
|
* ```ts
|
|
98
|
-
* await client.calls.hangup(
|
|
98
|
+
* await client.voice.calls.hangup(
|
|
99
99
|
* 'call_9f2ab000-0000-4000-8000-000000000001',
|
|
100
100
|
* );
|
|
101
101
|
* ```
|
|
102
102
|
*/
|
|
103
103
|
hangup(id: string, params: CallHangupParams, options?: RequestOptions): APIPromise<void> {
|
|
104
104
|
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
105
|
-
return this._client.post(path`/v3/calls/${id}/hangup`, {
|
|
105
|
+
return this._client.post(path`/v3/voice/calls/${id}/hangup`, {
|
|
106
106
|
body,
|
|
107
107
|
...options,
|
|
108
108
|
headers: buildHeaders([
|
|
@@ -128,7 +128,7 @@ export class Calls extends APIResource {
|
|
|
128
128
|
* @example
|
|
129
129
|
* ```ts
|
|
130
130
|
* const apiResponseOfCallRecordings =
|
|
131
|
-
* await client.calls.listRecordings(
|
|
131
|
+
* await client.voice.calls.listRecordings(
|
|
132
132
|
* 'call_9f2ab000-0000-4000-8000-000000000001',
|
|
133
133
|
* );
|
|
134
134
|
* ```
|
|
@@ -139,7 +139,7 @@ export class Calls extends APIResource {
|
|
|
139
139
|
options?: RequestOptions,
|
|
140
140
|
): APIPromise<APIResponseOfCallRecordings> {
|
|
141
141
|
const { 'x-profile-id': xProfileID } = params ?? {};
|
|
142
|
-
return this._client.get(path`/v3/calls/${id}/recordings`, {
|
|
142
|
+
return this._client.get(path`/v3/voice/calls/${id}/recordings`, {
|
|
143
143
|
...options,
|
|
144
144
|
headers: buildHeaders([
|
|
145
145
|
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
@@ -157,14 +157,14 @@ export class Calls extends APIResource {
|
|
|
157
157
|
*
|
|
158
158
|
* @example
|
|
159
159
|
* ```ts
|
|
160
|
-
* await client.calls.record(
|
|
160
|
+
* await client.voice.calls.record(
|
|
161
161
|
* 'call_9f2ab000-0000-4000-8000-000000000001',
|
|
162
162
|
* );
|
|
163
163
|
* ```
|
|
164
164
|
*/
|
|
165
165
|
record(id: string, params: CallRecordParams, options?: RequestOptions): APIPromise<void> {
|
|
166
166
|
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
167
|
-
return this._client.post(path`/v3/calls/${id}/recordings`, {
|
|
167
|
+
return this._client.post(path`/v3/voice/calls/${id}/recordings`, {
|
|
168
168
|
body,
|
|
169
169
|
...options,
|
|
170
170
|
headers: buildHeaders([
|
|
@@ -301,6 +301,12 @@ export interface Call {
|
|
|
301
301
|
*/
|
|
302
302
|
from?: CallParty;
|
|
303
303
|
|
|
304
|
+
/**
|
|
305
|
+
* The calling mode: inapp for a call between people in your app and phone numbers,
|
|
306
|
+
* routed by your number's callback URL
|
|
307
|
+
*/
|
|
308
|
+
mode?: string;
|
|
309
|
+
|
|
304
310
|
/**
|
|
305
311
|
* Your number that owns the call, in E.164 format: the dialed number for an
|
|
306
312
|
* inbound call, the caller's bound number for a call placed from your app
|