@sentdm/sentdm 0.45.0 → 0.47.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 +19 -0
- package/client.d.mts +6 -11
- package/client.d.mts.map +1 -1
- package/client.d.ts +6 -11
- 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/core/pagination.d.mts +25 -0
- package/core/pagination.d.mts.map +1 -1
- package/core/pagination.d.ts +25 -0
- package/core/pagination.d.ts.map +1 -1
- package/core/pagination.js +28 -1
- package/core/pagination.js.map +1 -1
- package/core/pagination.mjs +26 -0
- package/core/pagination.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 +72 -115
- package/resources/channels/voice.d.mts.map +1 -1
- package/resources/channels/voice.d.ts +72 -115
- package/resources/channels/voice.d.ts.map +1 -1
- package/resources/channels/voice.js +35 -45
- package/resources/channels/voice.js.map +1 -1
- package/resources/channels/voice.mjs +35 -45
- 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/campaigns.d.mts +3 -2
- package/resources/profiles/campaigns.d.mts.map +1 -1
- package/resources/profiles/campaigns.d.ts +3 -2
- package/resources/profiles/campaigns.d.ts.map +1 -1
- package/resources/profiles/campaigns.js +3 -2
- package/resources/profiles/campaigns.js.map +1 -1
- package/resources/profiles/campaigns.mjs +3 -2
- package/resources/profiles/campaigns.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/voice/agents.d.mts +524 -0
- package/resources/voice/agents.d.mts.map +1 -0
- package/resources/voice/agents.d.ts +524 -0
- package/resources/voice/agents.d.ts.map +1 -0
- package/resources/voice/agents.js +193 -0
- package/resources/voice/agents.js.map +1 -0
- package/resources/voice/agents.mjs +189 -0
- package/resources/voice/agents.mjs.map +1 -0
- package/resources/{calls → voice/calls}/calls.d.mts +103 -26
- package/resources/voice/calls/calls.d.mts.map +1 -0
- package/resources/{calls → voice/calls}/calls.d.ts +103 -26
- package/resources/voice/calls/calls.d.ts.map +1 -0
- package/resources/{calls → voice/calls}/calls.js +35 -28
- package/resources/voice/calls/calls.js.map +1 -0
- package/resources/{calls → voice/calls}/calls.mjs +34 -27
- 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 +16 -14
- package/resources/voice/calls/participants.d.mts.map +1 -0
- package/resources/{calls → voice/calls}/participants.d.ts +16 -14
- package/resources/voice/calls/participants.d.ts.map +1 -0
- package/resources/{calls → voice/calls}/participants.js +19 -17
- package/resources/voice/calls/participants.js.map +1 -0
- package/resources/{calls → voice/calls}/participants.mjs +19 -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/catalogue.d.mts +86 -0
- package/resources/voice/catalogue.d.mts.map +1 -0
- package/resources/voice/catalogue.d.ts +86 -0
- package/resources/voice/catalogue.d.ts.map +1 -0
- package/resources/voice/catalogue.js +40 -0
- package/resources/voice/catalogue.js.map +1 -0
- package/resources/voice/catalogue.mjs +36 -0
- package/resources/voice/catalogue.mjs.map +1 -0
- package/resources/voice/index.d.mts +6 -0
- package/resources/voice/index.d.mts.map +1 -0
- package/resources/voice/index.d.ts +6 -0
- package/resources/voice/index.d.ts.map +1 -0
- package/resources/voice/index.js +15 -0
- package/resources/voice/index.js.map +1 -0
- package/resources/voice/index.mjs +7 -0
- package/resources/voice/index.mjs.map +1 -0
- package/resources/voice/tokens.d.mts +111 -0
- package/resources/voice/tokens.d.mts.map +1 -0
- package/resources/voice/tokens.d.ts +111 -0
- package/resources/voice/tokens.d.ts.map +1 -0
- package/resources/voice/tokens.js +47 -0
- package/resources/voice/tokens.js.map +1 -0
- package/resources/voice/tokens.mjs +43 -0
- package/resources/voice/tokens.mjs.map +1 -0
- package/resources/voice/voice.d.mts +22 -0
- package/resources/voice/voice.d.mts.map +1 -0
- package/resources/voice/voice.d.ts +22 -0
- package/resources/voice/voice.d.ts.map +1 -0
- package/resources/voice/voice.js +29 -0
- package/resources/voice/voice.js.map +1 -0
- package/resources/voice/voice.mjs +24 -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 +154 -31
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +154 -31
- package/resources/webhooks.d.ts.map +1 -1
- package/resources/webhooks.js +51 -11
- package/resources/webhooks.js.map +1 -1
- package/resources/webhooks.mjs +51 -11
- package/resources/webhooks.mjs.map +1 -1
- package/src/client.ts +12 -45
- package/src/core/pagination.ts +64 -0
- package/src/resources/channels/channels.ts +0 -6
- package/src/resources/channels/index.ts +0 -3
- package/src/resources/channels/voice.ts +74 -144
- package/src/resources/index.ts +1 -18
- package/src/resources/messages.ts +8 -1
- package/src/resources/profiles/campaigns.ts +3 -2
- package/src/resources/templates.ts +14 -13
- package/src/resources/voice/agents.ts +729 -0
- package/src/resources/{calls → voice/calls}/calls.ts +122 -33
- package/src/resources/{calls → voice/calls}/participants.ts +23 -21
- package/src/resources/voice/catalogue.ts +118 -0
- package/src/resources/voice/index.ts +55 -0
- package/src/resources/voice/tokens.ts +146 -0
- package/src/resources/voice/voice.ts +134 -0
- package/src/resources/voice.ts +3 -0
- package/src/resources/webhooks.ts +162 -31
- 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.d.mts.map +0 -1
- package/resources/calls/index.d.ts.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
|
@@ -0,0 +1,729 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import * as WebhooksAPI from '../webhooks';
|
|
5
|
+
import { APIPromise } from '../../core/api-promise';
|
|
6
|
+
import { PagePromise, VoiceAgentsPage, type VoiceAgentsPageParams } from '../../core/pagination';
|
|
7
|
+
import { buildHeaders } from '../../internal/headers';
|
|
8
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
9
|
+
import { path } from '../../internal/utils/path';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Phone calls from the numbers you hold, driven by your own callback URL.
|
|
13
|
+
*
|
|
14
|
+
* `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.
|
|
15
|
+
*
|
|
16
|
+
* 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.
|
|
17
|
+
*
|
|
18
|
+
* **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls through the Sent Voice Gateway: `session_type` says whether Sent carries the call as text (speech recognised and spoken for the agent) or as audio, `websocket_url` is where the gateway dials the agent for each call (leave it out and the agent dials in with your API key), and `tools`, `transfer_targets`, `fallback` and `limits` say what it may do on a call. The agent's `signing_secret` is shown on create and on `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once it is bound to it on `/v3/channels/voice`.
|
|
19
|
+
*/
|
|
20
|
+
export class Agents extends APIResource {
|
|
21
|
+
/**
|
|
22
|
+
* Creates an agent that answers phone calls through the Sent Voice Gateway.
|
|
23
|
+
* `session_type` says whether Sent carries the call as text (the caller's speech
|
|
24
|
+
* recognised for the agent, the agent's text spoken) or as audio. With
|
|
25
|
+
* `websocket_url` the gateway dials your agent for each call and signs the
|
|
26
|
+
* handshake with the `signing_secret` this response returns; without it, your
|
|
27
|
+
* agent dials in with your API key and this agent's `id`.
|
|
28
|
+
*
|
|
29
|
+
* `tools`, `transfer_targets`, `fallback` and `limits` say what the agent may do
|
|
30
|
+
* on a call. Voices and languages for text sessions come from
|
|
31
|
+
* `GET /v3/voice/voices`. Calls reach the agent once a number is bound to it on
|
|
32
|
+
* `/v3/channels/voice`.
|
|
33
|
+
*
|
|
34
|
+
* `signing_secret` is shown here and on `POST /v3/voice/agents/{id}/rotate-secret`
|
|
35
|
+
* only; store it now. With `sandbox: true` the request is validated and the agent
|
|
36
|
+
* reported with `202`; nothing is written.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const apiResponseOfVoiceAgent =
|
|
41
|
+
* await client.voice.agents.create();
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
create(params: AgentCreateParams, options?: RequestOptions): APIPromise<APIResponseOfVoiceAgent> {
|
|
45
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
46
|
+
return this._client.post('/v3/voice/agents', {
|
|
47
|
+
body,
|
|
48
|
+
...options,
|
|
49
|
+
headers: buildHeaders([
|
|
50
|
+
{
|
|
51
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
52
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
53
|
+
},
|
|
54
|
+
options?.headers,
|
|
55
|
+
]),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The agent as stored, without its signing secret.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const apiResponseOfVoiceAgent =
|
|
65
|
+
* await client.voice.agents.retrieve('id');
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
retrieve(
|
|
69
|
+
id: string,
|
|
70
|
+
params: AgentRetrieveParams | null | undefined = {},
|
|
71
|
+
options?: RequestOptions,
|
|
72
|
+
): APIPromise<APIResponseOfVoiceAgent> {
|
|
73
|
+
const { 'x-profile-id': xProfileID } = params ?? {};
|
|
74
|
+
return this._client.get(path`/v3/voice/agents/${id}`, {
|
|
75
|
+
...options,
|
|
76
|
+
headers: buildHeaders([
|
|
77
|
+
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
78
|
+
options?.headers,
|
|
79
|
+
]),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Changes the fields you name and answers with the agent as stored, the same shape
|
|
85
|
+
* `GET` returns.
|
|
86
|
+
*
|
|
87
|
+
* A key left out is left alone. A key sent as `null` clears an optional field
|
|
88
|
+
* (`websocket_url` makes the agent dial in, `greeting` and `fallback` go,
|
|
89
|
+
* `speech`, `audio`, `tools`, `limits` and `transcripts` return to their
|
|
90
|
+
* defaults). A key sent with a value replaces that field whole: send the whole
|
|
91
|
+
* `limits` object, not one of its keys. Changing `session_type` drops `speech`,
|
|
92
|
+
* `audio` and `greeting` unless the body sends them, since the other type cannot
|
|
93
|
+
* carry them. The result is checked like a new agent, and a body that changes
|
|
94
|
+
* nothing is `400`.
|
|
95
|
+
*
|
|
96
|
+
* With `sandbox: true` nothing is written: the request is validated against the
|
|
97
|
+
* stored agent and the agent is reported with `200` as it would read after the
|
|
98
|
+
* change.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* const apiResponseOfVoiceAgent =
|
|
103
|
+
* await client.voice.agents.update('id');
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
update(
|
|
107
|
+
id: string,
|
|
108
|
+
params: AgentUpdateParams,
|
|
109
|
+
options?: RequestOptions,
|
|
110
|
+
): APIPromise<APIResponseOfVoiceAgent> {
|
|
111
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
112
|
+
return this._client.patch(path`/v3/voice/agents/${id}`, {
|
|
113
|
+
body,
|
|
114
|
+
...options,
|
|
115
|
+
headers: buildHeaders([
|
|
116
|
+
{
|
|
117
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
118
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
119
|
+
},
|
|
120
|
+
options?.headers,
|
|
121
|
+
]),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Your voice agents, newest first. `page` and `page_size` (1 to 100, default 20)
|
|
127
|
+
* page the list. Signing secrets are never listed.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* // Automatically fetches more pages as needed.
|
|
132
|
+
* for await (const voiceAgent of client.voice.agents.list()) {
|
|
133
|
+
* // ...
|
|
134
|
+
* }
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
list(
|
|
138
|
+
params: AgentListParams | null | undefined = {},
|
|
139
|
+
options?: RequestOptions,
|
|
140
|
+
): PagePromise<VoiceAgentsVoiceAgentsPage, VoiceAgent> {
|
|
141
|
+
const { 'x-profile-id': xProfileID, ...query } = params ?? {};
|
|
142
|
+
return this._client.getAPIList('/v3/voice/agents', VoiceAgentsPage<VoiceAgent>, {
|
|
143
|
+
query,
|
|
144
|
+
...options,
|
|
145
|
+
headers: buildHeaders([
|
|
146
|
+
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
147
|
+
options?.headers,
|
|
148
|
+
]),
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Removes the agent. Calls it already took keep their `agent_id`.
|
|
154
|
+
*
|
|
155
|
+
* An agent that one of your voice numbers routes to, or that another of your
|
|
156
|
+
* agents lists in `transfer_targets`, is not deleted: the answer is `409` with a
|
|
157
|
+
* message naming those numbers and agents. Unbind the numbers
|
|
158
|
+
* (`PATCH /v3/channels/voice/{number}` with `"agent_id": null`), take the agent
|
|
159
|
+
* out of the others' `transfer_targets` or delete them, and try again.
|
|
160
|
+
*
|
|
161
|
+
* With `sandbox: true` nothing is written: the agent is looked up and the answer
|
|
162
|
+
* is the one a real delete would give.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```ts
|
|
166
|
+
* await client.voice.agents.delete('id');
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
delete(id: string, params: AgentDeleteParams, options?: RequestOptions): APIPromise<void> {
|
|
170
|
+
const { 'x-profile-id': xProfileID, ...body } = params;
|
|
171
|
+
return this._client.delete(path`/v3/voice/agents/${id}`, {
|
|
172
|
+
body,
|
|
173
|
+
...options,
|
|
174
|
+
headers: buildHeaders([
|
|
175
|
+
{ Accept: '*/*', ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
176
|
+
options?.headers,
|
|
177
|
+
]),
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Generates a new `signing_secret` for the agent and returns it. The previous
|
|
183
|
+
* secret stops signing immediately, so update your agent before the next call
|
|
184
|
+
* reaches it.
|
|
185
|
+
*
|
|
186
|
+
* With `sandbox: true` a secret is generated and returned with `202`, and nothing
|
|
187
|
+
* is written.
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```ts
|
|
191
|
+
* const apiResponseOfVoiceAgentSecret =
|
|
192
|
+
* await client.voice.agents.rotateSecret('id');
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
rotateSecret(
|
|
196
|
+
id: string,
|
|
197
|
+
params: AgentRotateSecretParams,
|
|
198
|
+
options?: RequestOptions,
|
|
199
|
+
): APIPromise<APIResponseOfVoiceAgentSecret> {
|
|
200
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
201
|
+
return this._client.post(path`/v3/voice/agents/${id}/rotate-secret`, {
|
|
202
|
+
body,
|
|
203
|
+
...options,
|
|
204
|
+
headers: buildHeaders([
|
|
205
|
+
{
|
|
206
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
207
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
208
|
+
},
|
|
209
|
+
options?.headers,
|
|
210
|
+
]),
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export type VoiceAgentsVoiceAgentsPage = VoiceAgentsPage<VoiceAgent>;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Standard API response envelope for all v3 endpoints
|
|
219
|
+
*/
|
|
220
|
+
export interface APIResponseOfVoiceAgent {
|
|
221
|
+
/**
|
|
222
|
+
* A voice agent as stored: what was written with every default filled in, plus the
|
|
223
|
+
* signing secret the one time it is shown (on create, and on rotate). The one
|
|
224
|
+
* shape every read of an agent answers with, on /v3/voice/agents and on the admin
|
|
225
|
+
* API the dashboard uses, so the two cannot drift.
|
|
226
|
+
*/
|
|
227
|
+
data?: VoiceAgent | null;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Error information
|
|
231
|
+
*/
|
|
232
|
+
error?: WebhooksAPI.ErrorDetail | null;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Request and response metadata
|
|
236
|
+
*/
|
|
237
|
+
meta?: WebhooksAPI.APIMeta;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Indicates whether the request was successful
|
|
241
|
+
*/
|
|
242
|
+
success?: boolean;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Standard API response envelope for all v3 endpoints
|
|
247
|
+
*/
|
|
248
|
+
export interface APIResponseOfVoiceAgentSecret {
|
|
249
|
+
/**
|
|
250
|
+
* A freshly rotated signing secret.
|
|
251
|
+
*/
|
|
252
|
+
data?: VoiceAgentSecret | null;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Error information
|
|
256
|
+
*/
|
|
257
|
+
error?: WebhooksAPI.ErrorDetail | null;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Request and response metadata
|
|
261
|
+
*/
|
|
262
|
+
meta?: WebhooksAPI.APIMeta;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Indicates whether the request was successful
|
|
266
|
+
*/
|
|
267
|
+
success?: boolean;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Standard API response envelope for all v3 endpoints
|
|
272
|
+
*/
|
|
273
|
+
export interface APIResponseOfVoiceAgentsList {
|
|
274
|
+
/**
|
|
275
|
+
* A page of the account's agents. The agent itself is VoiceAgentResponse, shared
|
|
276
|
+
* with the admin API.
|
|
277
|
+
*/
|
|
278
|
+
data?: VoiceAgentsList | null;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Error information
|
|
282
|
+
*/
|
|
283
|
+
error?: WebhooksAPI.ErrorDetail | null;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Request and response metadata
|
|
287
|
+
*/
|
|
288
|
+
meta?: WebhooksAPI.APIMeta;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Indicates whether the request was successful
|
|
292
|
+
*/
|
|
293
|
+
success?: boolean;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* A voice agent as stored: what was written with every default filled in, plus the
|
|
298
|
+
* signing secret the one time it is shown (on create, and on rotate). The one
|
|
299
|
+
* shape every read of an agent answers with, on /v3/voice/agents and on the admin
|
|
300
|
+
* API the dashboard uses, so the two cannot drift.
|
|
301
|
+
*/
|
|
302
|
+
export interface VoiceAgent {
|
|
303
|
+
/**
|
|
304
|
+
* The agent's id, agent\_ and a UUID. It is also what the agent connects to the
|
|
305
|
+
* gateway as.
|
|
306
|
+
*/
|
|
307
|
+
id?: string;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Audio sessions: the sample rate in use.
|
|
311
|
+
*/
|
|
312
|
+
audio?: VoiceAgentAudio | null;
|
|
313
|
+
|
|
314
|
+
created_at?: string;
|
|
315
|
+
|
|
316
|
+
fallback?: VoiceAgentParty | null;
|
|
317
|
+
|
|
318
|
+
greeting?: string | null;
|
|
319
|
+
|
|
320
|
+
limits?: VoiceAgentLimits;
|
|
321
|
+
|
|
322
|
+
name?: string;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* text or audio.
|
|
326
|
+
*/
|
|
327
|
+
session_type?: string;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* The whsec\_ secret the gateway signs its handshake to websocket_url with.
|
|
331
|
+
* Present on create and after a rotate-secret; absent on every other read. Store
|
|
332
|
+
* it now.
|
|
333
|
+
*/
|
|
334
|
+
signing_secret?: string | null;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Text sessions: the speech setting, voice and language in use.
|
|
338
|
+
*/
|
|
339
|
+
speech?: VoiceAgentSpeech | null;
|
|
340
|
+
|
|
341
|
+
tools?: Array<string>;
|
|
342
|
+
|
|
343
|
+
transcripts?: VoiceAgentTranscripts;
|
|
344
|
+
|
|
345
|
+
transfer_targets?: Array<VoiceAgentParty>;
|
|
346
|
+
|
|
347
|
+
updated_at?: string | null;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Where the gateway dials the agent; null when the agent dials in with your API
|
|
351
|
+
* key.
|
|
352
|
+
*/
|
|
353
|
+
websocket_url?: string | null;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export interface VoiceAgentAudio {
|
|
357
|
+
sample_rate?: number;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export interface VoiceAgentAudioSpec {
|
|
361
|
+
/**
|
|
362
|
+
* Samples per second of the audio exchanged: 8000, 16000 or 24000. Default 16000.
|
|
363
|
+
*/
|
|
364
|
+
sample_rate?: number | null;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export interface VoiceAgentLimits {
|
|
368
|
+
allowed_countries?: Array<string> | null;
|
|
369
|
+
|
|
370
|
+
max_call_seconds?: number;
|
|
371
|
+
|
|
372
|
+
max_concurrent_calls?: number;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export interface VoiceAgentLimitsSpec {
|
|
376
|
+
/**
|
|
377
|
+
* ISO 3166-1 alpha-2 codes of the countries the agent may call or transfer to.
|
|
378
|
+
* Omit it to allow every country. Stored now, applied when the agent places calls.
|
|
379
|
+
*/
|
|
380
|
+
allowed_countries?: Array<string> | null;
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* The longest a call may last, 60 to 14,400 seconds. Default 3,600.
|
|
384
|
+
*/
|
|
385
|
+
max_call_seconds?: number | null;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* How many calls the agent may have going at once, from 1. Default 10.
|
|
389
|
+
*/
|
|
390
|
+
max_concurrent_calls?: number | null;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export interface VoiceAgentParty {
|
|
394
|
+
kind?: string;
|
|
395
|
+
|
|
396
|
+
value?: string;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export interface VoiceAgentPartySpec {
|
|
400
|
+
/**
|
|
401
|
+
* number, user or agent.
|
|
402
|
+
*/
|
|
403
|
+
kind?: string | null;
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* The E.164 number, the app user's identity, or the agent id (agent\_…).
|
|
407
|
+
*/
|
|
408
|
+
value?: string | null;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* A freshly rotated signing secret.
|
|
413
|
+
*/
|
|
414
|
+
export interface VoiceAgentSecret {
|
|
415
|
+
/**
|
|
416
|
+
* The new whsec\_ secret. The previous one stopped signing the moment this was
|
|
417
|
+
* returned. Shown once.
|
|
418
|
+
*/
|
|
419
|
+
signing_secret?: string;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export interface VoiceAgentSpeech {
|
|
423
|
+
language?: string;
|
|
424
|
+
|
|
425
|
+
setting?: string;
|
|
426
|
+
|
|
427
|
+
voice?: string;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export interface VoiceAgentSpeechSpec {
|
|
431
|
+
/**
|
|
432
|
+
* The language spoken and listened for, a BCP 47 tag from GET /v3/voice/voices.
|
|
433
|
+
* Default en-US.
|
|
434
|
+
*/
|
|
435
|
+
language?: string | null;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* standard, Sent's speech. Other settings are not available yet.
|
|
439
|
+
*/
|
|
440
|
+
setting?: string | null;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* A voice name from GET /v3/voice/voices. Default: the catalogue's default voice.
|
|
444
|
+
*/
|
|
445
|
+
voice?: string | null;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export interface VoiceAgentTranscripts {
|
|
449
|
+
retention_days?: number;
|
|
450
|
+
|
|
451
|
+
store?: boolean;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export interface VoiceAgentTranscriptsSpec {
|
|
455
|
+
/**
|
|
456
|
+
* How long a stored transcript is kept, 1 to 365 days. Default 30.
|
|
457
|
+
*/
|
|
458
|
+
retention_days?: number | null;
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Whether Sent keeps the call's transcript. Default false. Stored now, applied
|
|
462
|
+
* when transcripts land.
|
|
463
|
+
*/
|
|
464
|
+
store?: boolean | null;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* A page of the account's agents. The agent itself is VoiceAgentResponse, shared
|
|
469
|
+
* with the admin API.
|
|
470
|
+
*/
|
|
471
|
+
export interface VoiceAgentsList {
|
|
472
|
+
agents?: Array<VoiceAgent>;
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Pagination metadata for list responses
|
|
476
|
+
*/
|
|
477
|
+
pagination?: WebhooksAPI.PaginationMeta;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
export interface AgentCreateParams {
|
|
481
|
+
/**
|
|
482
|
+
* Body param: Audio sessions only: the sound format.
|
|
483
|
+
*/
|
|
484
|
+
audio?: VoiceAgentAudioSpec | null;
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Body param: Who takes the call when the agent cannot: a phone number (kind:
|
|
488
|
+
* number). Omit it and such a call hangs up.
|
|
489
|
+
*/
|
|
490
|
+
fallback?: VoiceAgentPartySpec | null;
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Body param: Text sessions only: what the caller hears as soon as the call is
|
|
494
|
+
* answered, before the agent's first turn. 1 to 4,096 characters. Omit it and the
|
|
495
|
+
* agent speaks first.
|
|
496
|
+
*/
|
|
497
|
+
greeting?: string | null;
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Body param
|
|
501
|
+
*/
|
|
502
|
+
limits?: VoiceAgentLimitsSpec | null;
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Body param: A name for your own reference, 1 to 100 characters.
|
|
506
|
+
*/
|
|
507
|
+
name?: string | null;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Body param: Sandbox flag - when true, the operation is simulated without side
|
|
511
|
+
* effects Useful for testing integrations without actual execution
|
|
512
|
+
*/
|
|
513
|
+
sandbox?: boolean;
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Body param: text: Sent turns the caller's speech into text and the agent's text
|
|
517
|
+
* into speech, so the agent exchanges text frames. audio: the agent receives and
|
|
518
|
+
* sends the sound itself.
|
|
519
|
+
*/
|
|
520
|
+
session_type?: string | null;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Body param: Text sessions only: how the caller is spoken to and listened to.
|
|
524
|
+
*/
|
|
525
|
+
speech?: VoiceAgentSpeechSpec | null;
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Body param: What the agent may do to the call: any of transfer, hangup,
|
|
529
|
+
* send_dtmf and hold. Default ["hangup"]. transfer needs at least one
|
|
530
|
+
* transfer_targets entry.
|
|
531
|
+
*/
|
|
532
|
+
tools?: Array<string> | null;
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Body param
|
|
536
|
+
*/
|
|
537
|
+
transcripts?: VoiceAgentTranscriptsSpec | null;
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Body param: Where the agent may transfer a call to, up to 20 parties: a phone
|
|
541
|
+
* number (kind: number, E.164), one of your app users (kind: user, the identity)
|
|
542
|
+
* or another of your agents (kind: agent, its id). The agent can only transfer to
|
|
543
|
+
* a party listed here.
|
|
544
|
+
*/
|
|
545
|
+
transfer_targets?: Array<VoiceAgentPartySpec> | null;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Body param: Where the gateway connects to the agent for each call: an absolute
|
|
549
|
+
* wss:// URL on a public host, at most 2,048 characters. The handshake is signed
|
|
550
|
+
* with the agent's signing_secret. Leave it out and the agent dials in instead,
|
|
551
|
+
* connecting to the gateway with your API key.
|
|
552
|
+
*/
|
|
553
|
+
websocket_url?: string | null;
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
557
|
+
* alphanumeric characters, hyphens, or underscores. Responses are cached for 24
|
|
558
|
+
* hours per key per customer.
|
|
559
|
+
*/
|
|
560
|
+
'Idempotency-Key'?: string;
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Header param: Profile UUID to scope the request to a child profile. Only
|
|
564
|
+
* organization API keys can use this header. The profile must belong to the
|
|
565
|
+
* calling organization.
|
|
566
|
+
*/
|
|
567
|
+
'x-profile-id'?: string;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
export interface AgentRetrieveParams {
|
|
571
|
+
/**
|
|
572
|
+
* Profile UUID to scope the request to a child profile. Only organization API keys
|
|
573
|
+
* can use this header. The profile must belong to the calling organization.
|
|
574
|
+
*/
|
|
575
|
+
'x-profile-id'?: string;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
export interface AgentUpdateParams {
|
|
579
|
+
/**
|
|
580
|
+
* Body param: Audio sessions: { sample_rate }; null restores the default.
|
|
581
|
+
*/
|
|
582
|
+
audio?: VoiceAgentAudioSpec | null;
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Body param: A new fallback party, or null for none.
|
|
586
|
+
*/
|
|
587
|
+
fallback?: VoiceAgentPartySpec | null;
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Body param: A new greeting, or null for none.
|
|
591
|
+
*/
|
|
592
|
+
greeting?: string | null;
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Body param: The whole limits object; null restores the defaults.
|
|
596
|
+
*/
|
|
597
|
+
limits?: VoiceAgentLimitsSpec | null;
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Body param: A new name, 1 to 100 characters.
|
|
601
|
+
*/
|
|
602
|
+
name?: string;
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Body param: Sandbox flag - when true, the operation is simulated without side
|
|
606
|
+
* effects Useful for testing integrations without actual execution
|
|
607
|
+
*/
|
|
608
|
+
sandbox?: boolean;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Body param: text or audio. Changing it drops the settings the other type cannot
|
|
612
|
+
* have (speech, audio, greeting) unless the body sends them.
|
|
613
|
+
*/
|
|
614
|
+
session_type?: string;
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Body param: Text sessions: { setting, voice, language }, replaced whole; null
|
|
618
|
+
* restores the defaults.
|
|
619
|
+
*/
|
|
620
|
+
speech?: VoiceAgentSpeechSpec | null;
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Body param: The whole list of tools; null restores the default.
|
|
624
|
+
*/
|
|
625
|
+
tools?: Array<string> | null;
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* Body param: The whole transcripts object; null restores the defaults.
|
|
629
|
+
*/
|
|
630
|
+
transcripts?: VoiceAgentTranscriptsSpec | null;
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Body param: The whole list of parties; null clears it.
|
|
634
|
+
*/
|
|
635
|
+
transfer_targets?: Array<VoiceAgentPartySpec> | null;
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Body param: A new wss:// URL, or null for an agent that dials in.
|
|
639
|
+
*/
|
|
640
|
+
websocket_url?: string | null;
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
644
|
+
* alphanumeric characters, hyphens, or underscores. Responses are cached for 24
|
|
645
|
+
* hours per key per customer.
|
|
646
|
+
*/
|
|
647
|
+
'Idempotency-Key'?: string;
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Header param: Profile UUID to scope the request to a child profile. Only
|
|
651
|
+
* organization API keys can use this header. The profile must belong to the
|
|
652
|
+
* calling organization.
|
|
653
|
+
*/
|
|
654
|
+
'x-profile-id'?: string;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
export interface AgentListParams extends VoiceAgentsPageParams {
|
|
658
|
+
/**
|
|
659
|
+
* Header param: Profile UUID to scope the request to a child profile. Only
|
|
660
|
+
* organization API keys can use this header. The profile must belong to the
|
|
661
|
+
* calling organization.
|
|
662
|
+
*/
|
|
663
|
+
'x-profile-id'?: string;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
export interface AgentDeleteParams {
|
|
667
|
+
/**
|
|
668
|
+
* Body param: Sandbox flag - when true, the operation is simulated without side
|
|
669
|
+
* effects Useful for testing integrations without actual execution
|
|
670
|
+
*/
|
|
671
|
+
sandbox?: boolean;
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Header param: Profile UUID to scope the request to a child profile. Only
|
|
675
|
+
* organization API keys can use this header. The profile must belong to the
|
|
676
|
+
* calling organization.
|
|
677
|
+
*/
|
|
678
|
+
'x-profile-id'?: string;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
export interface AgentRotateSecretParams {
|
|
682
|
+
/**
|
|
683
|
+
* Body param: Sandbox flag - when true, the operation is simulated without side
|
|
684
|
+
* effects Useful for testing integrations without actual execution
|
|
685
|
+
*/
|
|
686
|
+
sandbox?: boolean;
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
690
|
+
* alphanumeric characters, hyphens, or underscores. Responses are cached for 24
|
|
691
|
+
* hours per key per customer.
|
|
692
|
+
*/
|
|
693
|
+
'Idempotency-Key'?: string;
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Header param: Profile UUID to scope the request to a child profile. Only
|
|
697
|
+
* organization API keys can use this header. The profile must belong to the
|
|
698
|
+
* calling organization.
|
|
699
|
+
*/
|
|
700
|
+
'x-profile-id'?: string;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export declare namespace Agents {
|
|
704
|
+
export {
|
|
705
|
+
type APIResponseOfVoiceAgent as APIResponseOfVoiceAgent,
|
|
706
|
+
type APIResponseOfVoiceAgentSecret as APIResponseOfVoiceAgentSecret,
|
|
707
|
+
type APIResponseOfVoiceAgentsList as APIResponseOfVoiceAgentsList,
|
|
708
|
+
type VoiceAgent as VoiceAgent,
|
|
709
|
+
type VoiceAgentAudio as VoiceAgentAudio,
|
|
710
|
+
type VoiceAgentAudioSpec as VoiceAgentAudioSpec,
|
|
711
|
+
type VoiceAgentLimits as VoiceAgentLimits,
|
|
712
|
+
type VoiceAgentLimitsSpec as VoiceAgentLimitsSpec,
|
|
713
|
+
type VoiceAgentParty as VoiceAgentParty,
|
|
714
|
+
type VoiceAgentPartySpec as VoiceAgentPartySpec,
|
|
715
|
+
type VoiceAgentSecret as VoiceAgentSecret,
|
|
716
|
+
type VoiceAgentSpeech as VoiceAgentSpeech,
|
|
717
|
+
type VoiceAgentSpeechSpec as VoiceAgentSpeechSpec,
|
|
718
|
+
type VoiceAgentTranscripts as VoiceAgentTranscripts,
|
|
719
|
+
type VoiceAgentTranscriptsSpec as VoiceAgentTranscriptsSpec,
|
|
720
|
+
type VoiceAgentsList as VoiceAgentsList,
|
|
721
|
+
type VoiceAgentsVoiceAgentsPage as VoiceAgentsVoiceAgentsPage,
|
|
722
|
+
type AgentCreateParams as AgentCreateParams,
|
|
723
|
+
type AgentRetrieveParams as AgentRetrieveParams,
|
|
724
|
+
type AgentUpdateParams as AgentUpdateParams,
|
|
725
|
+
type AgentListParams as AgentListParams,
|
|
726
|
+
type AgentDeleteParams as AgentDeleteParams,
|
|
727
|
+
type AgentRotateSecretParams as AgentRotateSecretParams,
|
|
728
|
+
};
|
|
729
|
+
}
|