@sentdm/sentdm 0.41.0 → 0.43.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.
Files changed (120) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/client.d.mts +20 -3
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +20 -3
  5. package/client.d.ts.map +1 -1
  6. package/client.js +15 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +15 -0
  9. package/client.mjs.map +1 -1
  10. package/core/pagination.d.mts +25 -0
  11. package/core/pagination.d.mts.map +1 -1
  12. package/core/pagination.d.ts +25 -0
  13. package/core/pagination.d.ts.map +1 -1
  14. package/core/pagination.js +28 -1
  15. package/core/pagination.js.map +1 -1
  16. package/core/pagination.mjs +26 -0
  17. package/core/pagination.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/resources/calls/calls.d.mts +388 -0
  20. package/resources/calls/calls.d.mts.map +1 -0
  21. package/resources/calls/calls.d.ts +388 -0
  22. package/resources/calls/calls.d.ts.map +1 -0
  23. package/resources/calls/calls.js +159 -0
  24. package/resources/calls/calls.js.map +1 -0
  25. package/resources/calls/calls.mjs +154 -0
  26. package/resources/calls/calls.mjs.map +1 -0
  27. package/resources/calls/index.d.mts +3 -0
  28. package/resources/calls/index.d.mts.map +1 -0
  29. package/resources/calls/index.d.ts +3 -0
  30. package/resources/calls/index.d.ts.map +1 -0
  31. package/resources/calls/index.js +9 -0
  32. package/resources/calls/index.js.map +1 -0
  33. package/resources/calls/index.mjs +4 -0
  34. package/resources/calls/index.mjs.map +1 -0
  35. package/resources/calls/participants.d.mts +258 -0
  36. package/resources/calls/participants.d.mts.map +1 -0
  37. package/resources/calls/participants.d.ts +258 -0
  38. package/resources/calls/participants.d.ts.map +1 -0
  39. package/resources/calls/participants.js +158 -0
  40. package/resources/calls/participants.js.map +1 -0
  41. package/resources/calls/participants.mjs +154 -0
  42. package/resources/calls/participants.mjs.map +1 -0
  43. package/resources/calls.d.mts +2 -0
  44. package/resources/calls.d.mts.map +1 -0
  45. package/resources/calls.d.ts +2 -0
  46. package/resources/calls.d.ts.map +1 -0
  47. package/resources/calls.js +6 -0
  48. package/resources/calls.js.map +1 -0
  49. package/resources/calls.mjs +3 -0
  50. package/resources/calls.mjs.map +1 -0
  51. package/resources/channels/channels.d.mts +10 -0
  52. package/resources/channels/channels.d.mts.map +1 -0
  53. package/resources/channels/channels.d.ts +10 -0
  54. package/resources/channels/channels.d.ts.map +1 -0
  55. package/resources/channels/channels.js +17 -0
  56. package/resources/channels/channels.js.map +1 -0
  57. package/resources/channels/channels.mjs +12 -0
  58. package/resources/channels/channels.mjs.map +1 -0
  59. package/resources/channels/index.d.mts +3 -0
  60. package/resources/channels/index.d.mts.map +1 -0
  61. package/resources/channels/index.d.ts +3 -0
  62. package/resources/channels/index.d.ts.map +1 -0
  63. package/resources/channels/index.js +9 -0
  64. package/resources/channels/index.js.map +1 -0
  65. package/resources/channels/index.mjs +4 -0
  66. package/resources/channels/index.mjs.map +1 -0
  67. package/resources/channels/voice.d.mts +654 -0
  68. package/resources/channels/voice.d.mts.map +1 -0
  69. package/resources/channels/voice.d.ts +654 -0
  70. package/resources/channels/voice.d.ts.map +1 -0
  71. package/resources/channels/voice.js +285 -0
  72. package/resources/channels/voice.js.map +1 -0
  73. package/resources/channels/voice.mjs +281 -0
  74. package/resources/channels/voice.mjs.map +1 -0
  75. package/resources/channels.d.mts +2 -0
  76. package/resources/channels.d.mts.map +1 -0
  77. package/resources/channels.d.ts +2 -0
  78. package/resources/channels.d.ts.map +1 -0
  79. package/resources/channels.js +6 -0
  80. package/resources/channels.js.map +1 -0
  81. package/resources/channels.mjs +3 -0
  82. package/resources/channels.mjs.map +1 -0
  83. package/resources/index.d.mts +3 -1
  84. package/resources/index.d.mts.map +1 -1
  85. package/resources/index.d.ts +3 -1
  86. package/resources/index.d.ts.map +1 -1
  87. package/resources/index.js +5 -1
  88. package/resources/index.js.map +1 -1
  89. package/resources/index.mjs +2 -0
  90. package/resources/index.mjs.map +1 -1
  91. package/resources/messages.d.mts +13 -8
  92. package/resources/messages.d.mts.map +1 -1
  93. package/resources/messages.d.ts +13 -8
  94. package/resources/messages.d.ts.map +1 -1
  95. package/resources/messages.js +7 -4
  96. package/resources/messages.js.map +1 -1
  97. package/resources/messages.mjs +7 -4
  98. package/resources/messages.mjs.map +1 -1
  99. package/resources/webhooks.d.mts +112 -109
  100. package/resources/webhooks.d.mts.map +1 -1
  101. package/resources/webhooks.d.ts +112 -109
  102. package/resources/webhooks.d.ts.map +1 -1
  103. package/src/client.ts +62 -0
  104. package/src/core/pagination.ts +59 -0
  105. package/src/resources/calls/calls.ts +556 -0
  106. package/src/resources/calls/index.ts +31 -0
  107. package/src/resources/calls/participants.ts +367 -0
  108. package/src/resources/calls.ts +3 -0
  109. package/src/resources/channels/channels.ts +61 -0
  110. package/src/resources/channels/index.ts +27 -0
  111. package/src/resources/channels/voice.ts +864 -0
  112. package/src/resources/channels.ts +3 -0
  113. package/src/resources/index.ts +21 -0
  114. package/src/resources/messages.ts +13 -8
  115. package/src/resources/webhooks.ts +127 -122
  116. package/src/version.ts +1 -1
  117. package/version.d.mts +1 -1
  118. package/version.d.ts +1 -1
  119. package/version.js +1 -1
  120. package/version.mjs +1 -1
@@ -0,0 +1,864 @@
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 { buildHeaders } from '../../internal/headers';
7
+ import { RequestOptions } from '../../internal/request-options';
8
+ import { path } from '../../internal/utils/path';
9
+
10
+ /**
11
+ * The senders you send from, one per channel.
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 under `POST /v3/channels/voice/tokens`. Read your voice numbers with `GET /v3/channels/voice` and change one with `PATCH /v3/channels/voice/{number}`.
14
+ *
15
+ * ## Compliance lives on the market
16
+ *
17
+ * Adding a market records everything that market registers with, in its `compliance` object. Only **US `TEN_DLC`** registers with a regime — The Campaign Registry — and it is the only market whose compliance carries `brand` and `campaign`. Everywhere else compliance is documents, and many markets ask for none at all.
18
+ *
19
+ * `GET` and `PATCH` on a market return and accept the same shape, so what comes back can be sent back: an omitted key is left alone, and a key reported in `requirements` is the path into the body that clears it.
20
+ *
21
+ * Call `GET /v3/compliance/requirements` first — it answers what a market demands before you hold it, with a body you can fill in and post.
22
+ */
23
+ export class Voice extends APIResource {
24
+ /**
25
+ * Adds voice to one of the numbers you hold, or gives you a new one. Send `number`
26
+ * for a number that is already yours (see `GET /v3/channels`); leave it out to be
27
+ * given a new US number, optionally in a particular `area_code`. Sending both is
28
+ * refused. Nothing registers, so the number can carry calls as soon as this
29
+ * returns.
30
+ *
31
+ * What happens on a call is decided by your `callback_url`: when a call arrives on
32
+ * the number, or a caller presses a key on a menu, Sent POSTs a signed question
33
+ * there and follows the answer. The response carries the `callback_secret` the
34
+ * questions are signed with, the one time it is shown without rotating; verify a
35
+ * question the way you verify a webhook. `POST /v3/channels/voice/{number}/test`
36
+ * sends a test question and reports the verdict.
37
+ *
38
+ * Your first voice number becomes the line app-originated calls are placed from
39
+ * when a voice token names no number; send `default_for_app_calls: true` to give
40
+ * that role to another number. A number you turned off earlier is turned back on,
41
+ * and the same number with a different `callback_url` has its URL replaced and
42
+ * keeps its secret.
43
+ *
44
+ * Read the number's settings with `GET /v3/channels/voice` and change them with
45
+ * `PATCH /v3/channels/voice/{number}`.
46
+ *
47
+ * With `sandbox: true` the request is validated and a simulated number reported
48
+ * with `202`; nothing is written and no number is bought.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * const apiResponseOfVoiceNumberCreated =
53
+ * await client.channels.voice.create({
54
+ * callback_url: 'https://example.com/voice',
55
+ * number: '+12125550100',
56
+ * });
57
+ * ```
58
+ */
59
+ create(params: VoiceCreateParams, options?: RequestOptions): APIPromise<APIResponseOfVoiceNumberCreated> {
60
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
61
+ return this._client.post('/v3/channels/voice', {
62
+ body,
63
+ ...options,
64
+ headers: buildHeaders([
65
+ {
66
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
67
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
68
+ },
69
+ options?.headers,
70
+ ]),
71
+ });
72
+ }
73
+
74
+ /**
75
+ * Reads one of your voice numbers, active or inactive: its status, whether it is
76
+ * the default line for calls placed from your app, and its callback URL. The
77
+ * signing secret is not on this read.
78
+ *
79
+ * The same shape `GET /v3/channels/voice` lists, and the same shape `PATCH` on
80
+ * this path accepts and returns, so what comes back can be sent back.
81
+ *
82
+ * The number is the E.164 value in the path with the plus sign URL-encoded
83
+ * (`%2B`).
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const apiResponseOfVoiceNumber =
88
+ * await client.channels.voice.retrieve('+12125550100');
89
+ * ```
90
+ */
91
+ retrieve(
92
+ number: string,
93
+ params: VoiceRetrieveParams | null | undefined = {},
94
+ options?: RequestOptions,
95
+ ): APIPromise<APIResponseOfVoiceNumber> {
96
+ const { 'x-profile-id': xProfileID } = params ?? {};
97
+ return this._client.get(path`/v3/channels/voice/${number}`, {
98
+ ...options,
99
+ headers: buildHeaders([
100
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
101
+ options?.headers,
102
+ ]),
103
+ });
104
+ }
105
+
106
+ /**
107
+ * Changes one of your voice numbers and answers with the number as stored, the
108
+ * same shape `GET` on this path returns, so what comes back can be sent back.
109
+ *
110
+ * ## What it changes
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 is kept, and a number that was waiting for its first URL is turned on |
118
+ * | key omitted | left exactly as it is |
119
+ *
120
+ * `status` is matched ignoring case. Any combination is accepted:
121
+ * `status: "ACTIVE"` with `default_for_app_calls: true` turns a number on as the
122
+ * new default, and a `callback_url` sent with either status is written too. A body
123
+ * that names none of the three is refused.
124
+ *
125
+ * ## What it will refuse
126
+ *
127
+ * **`default_for_app_calls: false` is `400`.** An account with active voice
128
+ * numbers always has exactly one default, so the default moves by giving it to
129
+ * another number.
130
+ *
131
+ * **Turning the default line off is `409`** while other active voice numbers
132
+ * remain. Move the default to another number first. Turning off your last voice
133
+ * number is allowed; that turns phone calls off.
134
+ *
135
+ * **Making an inactive number the default is `400`.** Send `status: "ACTIVE"` in
136
+ * the same call.
137
+ *
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
+ * **A number you never turned voice on for is `404`.** Add it with
144
+ * `POST /v3/channels/voice`.
145
+ *
146
+ * The number is the E.164 value in the path with the plus sign URL-encoded
147
+ * (`%2B`).
148
+ *
149
+ * With `sandbox: true` nothing is written: the request is validated against the
150
+ * stored number and the number is reported with `200` as it would read after the
151
+ * change.
152
+ *
153
+ * @example
154
+ * ```ts
155
+ * const apiResponseOfVoiceNumber =
156
+ * await client.channels.voice.update('+12125550100');
157
+ * ```
158
+ */
159
+ update(
160
+ number: string,
161
+ params: VoiceUpdateParams,
162
+ options?: RequestOptions,
163
+ ): APIPromise<APIResponseOfVoiceNumber> {
164
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
165
+ return this._client.patch(path`/v3/channels/voice/${number}`, {
166
+ body,
167
+ ...options,
168
+ headers: buildHeaders([
169
+ {
170
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
171
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
172
+ },
173
+ options?.headers,
174
+ ]),
175
+ });
176
+ }
177
+
178
+ /**
179
+ * Every number you turned phone calls on for, active or inactive, oldest first.
180
+ * Each entry carries the number's status, whether it is the default line for calls
181
+ * placed from your app, and its callback URL. The signing secret is never on a
182
+ * read; it is shown when voice is turned on and by
183
+ * `POST /v3/channels/voice/{number}/rotate-secret`.
184
+ *
185
+ * The same entries `GET /v3/channels` reports under `voice`, and the same shape
186
+ * `GET /v3/channels/voice/{number}` returns for one of them. Change a number with
187
+ * `PATCH /v3/channels/voice/{number}`.
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * const apiResponseOfListOfVoiceNumber =
192
+ * await client.channels.voice.list();
193
+ * ```
194
+ */
195
+ list(
196
+ params: VoiceListParams | null | undefined = {},
197
+ options?: RequestOptions,
198
+ ): APIPromise<APIResponseOfListOfVoiceNumber> {
199
+ const { 'x-profile-id': xProfileID } = params ?? {};
200
+ return this._client.get('/v3/channels/voice', {
201
+ ...options,
202
+ headers: buildHeaders([
203
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
204
+ options?.headers,
205
+ ]),
206
+ });
207
+ }
208
+
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
+ /**
239
+ * Generates a new signing secret for the questions Sent sends to this number's
240
+ * callback URL and returns it. The previous secret stops signing immediately, so
241
+ * update your backend before the next call reaches it. The number is the E.164
242
+ * value in the path with the plus sign URL-encoded (`%2B`).
243
+ *
244
+ * With `sandbox: true` a secret is generated and returned with `202`, and nothing
245
+ * is written.
246
+ *
247
+ * @example
248
+ * ```ts
249
+ * const apiResponseOfVoiceSecret =
250
+ * await client.channels.voice.rotateSecret('+12125550100');
251
+ * ```
252
+ */
253
+ rotateSecret(
254
+ number: string,
255
+ params: VoiceRotateSecretParams,
256
+ options?: RequestOptions,
257
+ ): APIPromise<APIResponseOfVoiceSecret> {
258
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
259
+ return this._client.post(path`/v3/channels/voice/${number}/rotate-secret`, {
260
+ body,
261
+ ...options,
262
+ headers: buildHeaders([
263
+ {
264
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
265
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
266
+ },
267
+ options?.headers,
268
+ ]),
269
+ });
270
+ }
271
+
272
+ /**
273
+ * Sends a synthetic call.request question, flagged "test": true, to the number's
274
+ * callback URL, signed with that number's real secret, and reports what came back.
275
+ * Use it to build and debug your callback endpoint without placing calls: no call
276
+ * is placed, nothing is billed, and nothing is stored. One attempt with the same
277
+ * deadline as a live call, no retry. The outcome is ok when your endpoint answered
278
+ * 2xx with a valid answer; otherwise it is timeout, connection_failed, http_error
279
+ * or invalid_answer, with the reason and, for an invalid answer, the field at
280
+ * fault. The number is the E.164 value in the path with the plus sign URL-encoded
281
+ * (`%2B`).
282
+ *
283
+ * With `sandbox: true` nothing is sent: the verdict comes back ok with `202` and
284
+ * no request or response in it.
285
+ *
286
+ * @example
287
+ * ```ts
288
+ * const apiResponseOfVoiceCallbackTest =
289
+ * await client.channels.voice.test('+12025550123');
290
+ * ```
291
+ */
292
+ test(
293
+ number: string,
294
+ params: VoiceTestParams,
295
+ options?: RequestOptions,
296
+ ): APIPromise<APIResponseOfVoiceCallbackTest> {
297
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
298
+ return this._client.post(path`/v3/channels/voice/${number}/test`, {
299
+ body,
300
+ ...options,
301
+ headers: buildHeaders([
302
+ {
303
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
304
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
305
+ },
306
+ options?.headers,
307
+ ]),
308
+ });
309
+ }
310
+ }
311
+
312
+ /**
313
+ * Standard API response envelope for all v3 endpoints
314
+ */
315
+ export interface APIResponseOfListOfVoiceNumber {
316
+ /**
317
+ * The response data (null if error)
318
+ */
319
+ data?: Array<VoiceNumber> | null;
320
+
321
+ /**
322
+ * Error information
323
+ */
324
+ error?: WebhooksAPI.ErrorDetail | null;
325
+
326
+ /**
327
+ * Request and response metadata
328
+ */
329
+ meta?: WebhooksAPI.APIMeta;
330
+
331
+ /**
332
+ * Indicates whether the request was successful
333
+ */
334
+ success?: boolean;
335
+ }
336
+
337
+ /**
338
+ * Standard API response envelope for all v3 endpoints
339
+ */
340
+ export interface APIResponseOfVoiceCallbackTest {
341
+ /**
342
+ * The verdict of a test question sent to your callback URL
343
+ */
344
+ data?: VoiceCallbackTest | null;
345
+
346
+ /**
347
+ * Error information
348
+ */
349
+ error?: WebhooksAPI.ErrorDetail | null;
350
+
351
+ /**
352
+ * Request and response metadata
353
+ */
354
+ meta?: WebhooksAPI.APIMeta;
355
+
356
+ /**
357
+ * Indicates whether the request was successful
358
+ */
359
+ success?: boolean;
360
+ }
361
+
362
+ /**
363
+ * Standard API response envelope for all v3 endpoints
364
+ */
365
+ export interface APIResponseOfVoiceNumber {
366
+ /**
367
+ * One number the profile carries phone calls on.
368
+ */
369
+ data?: VoiceNumber | null;
370
+
371
+ /**
372
+ * Error information
373
+ */
374
+ error?: WebhooksAPI.ErrorDetail | null;
375
+
376
+ /**
377
+ * Request and response metadata
378
+ */
379
+ meta?: WebhooksAPI.APIMeta;
380
+
381
+ /**
382
+ * Indicates whether the request was successful
383
+ */
384
+ success?: boolean;
385
+ }
386
+
387
+ /**
388
+ * Standard API response envelope for all v3 endpoints
389
+ */
390
+ export interface APIResponseOfVoiceNumberCreated {
391
+ /**
392
+ * The response data (null if error)
393
+ */
394
+ data?: VoiceNumberCreated | null;
395
+
396
+ /**
397
+ * Error information
398
+ */
399
+ error?: WebhooksAPI.ErrorDetail | null;
400
+
401
+ /**
402
+ * Request and response metadata
403
+ */
404
+ meta?: WebhooksAPI.APIMeta;
405
+
406
+ /**
407
+ * Indicates whether the request was successful
408
+ */
409
+ success?: boolean;
410
+ }
411
+
412
+ /**
413
+ * Standard API response envelope for all v3 endpoints
414
+ */
415
+ export interface APIResponseOfVoiceSecret {
416
+ /**
417
+ * A freshly rotated callback signing secret
418
+ */
419
+ data?: VoiceSecret | null;
420
+
421
+ /**
422
+ * Error information
423
+ */
424
+ error?: WebhooksAPI.ErrorDetail | null;
425
+
426
+ /**
427
+ * Request and response metadata
428
+ */
429
+ meta?: WebhooksAPI.APIMeta;
430
+
431
+ /**
432
+ * Indicates whether the request was successful
433
+ */
434
+ success?: boolean;
435
+ }
436
+
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
+ /**
463
+ * The verdict of a test question sent to your callback URL
464
+ */
465
+ export interface VoiceCallbackTest {
466
+ /**
467
+ * Your answer as Sent read it, with numbers in E.164 and a missing caller id
468
+ * filled in. Set only when the outcome is ok.
469
+ */
470
+ answer?: unknown | null;
471
+
472
+ /**
473
+ * The call id the test question carried. It does not exist anywhere else and
474
+ * cannot be looked up.
475
+ */
476
+ call_id?: string;
477
+
478
+ /**
479
+ * Why the test did not end with ok
480
+ */
481
+ error?: VoiceCallbackTestErrorInfo | null;
482
+
483
+ /**
484
+ * What happened: ok, timeout, connection_failed, http_error or invalid_answer
485
+ */
486
+ outcome?: string;
487
+
488
+ /**
489
+ * The test question exactly as it was sent
490
+ */
491
+ request?: VoiceCallbackTestRequestInfo | null;
492
+
493
+ /**
494
+ * What your endpoint answered
495
+ */
496
+ response?: VoiceCallbackTestResponseInfo | null;
497
+ }
498
+
499
+ /**
500
+ * Why the test did not end with ok
501
+ */
502
+ export interface VoiceCallbackTestErrorInfo {
503
+ /**
504
+ * What to fix
505
+ */
506
+ message?: string;
507
+
508
+ /**
509
+ * Dotted path of the answer field at fault, such as action.action, when one field
510
+ * is to blame
511
+ */
512
+ path?: string | null;
513
+
514
+ /**
515
+ * Machine-readable reason, such as timeout, http_error, malformed_json,
516
+ * missing_action or unknown_action
517
+ */
518
+ reason?: string;
519
+ }
520
+
521
+ /**
522
+ * The test question exactly as it was sent
523
+ */
524
+ export interface VoiceCallbackTestRequestInfo {
525
+ /**
526
+ * The request body byte for byte. This is what the signature covers.
527
+ */
528
+ body?: string;
529
+
530
+ /**
531
+ * Every header Sent added, the signature included, so you can compare against what
532
+ * your endpoint verified. The signing secret itself is never included.
533
+ */
534
+ headers?: { [key: string]: string };
535
+
536
+ /**
537
+ * The callback URL that was called
538
+ */
539
+ url?: string;
540
+ }
541
+
542
+ /**
543
+ * What your endpoint answered
544
+ */
545
+ export interface VoiceCallbackTestResponseInfo {
546
+ /**
547
+ * The start of the raw response body, capped at 2048 characters
548
+ */
549
+ body?: string | null;
550
+
551
+ /**
552
+ * The HTTP status your endpoint returned
553
+ */
554
+ status_code?: number;
555
+ }
556
+
557
+ /**
558
+ * One number the profile carries phone calls on.
559
+ */
560
+ export interface VoiceNumber {
561
+ /**
562
+ * Where Sent asks what to do with each call on this number: a signed question is
563
+ * POSTed here when a call arrives or a caller presses a key, and the answer
564
+ * decides the call. The signing secret is not on this read; it is shown when voice
565
+ * is turned on and by the rotate endpoint.
566
+ */
567
+ callback_url?: string | null;
568
+
569
+ created_at?: string;
570
+
571
+ /**
572
+ * Whether this is the line app-originated calls are placed from when a voice token
573
+ * names no number. Exactly one active voice number carries it while the profile
574
+ * has any.
575
+ */
576
+ default_for_app_calls?: boolean;
577
+
578
+ /**
579
+ * The number, in E.164.
580
+ */
581
+ number?: string;
582
+
583
+ /**
584
+ * ACTIVE while the number carries calls, INACTIVE once it was turned off. Nothing
585
+ * provisions: a number the customer holds can carry calls the moment voice is
586
+ * turned on for it.
587
+ */
588
+ status?: string;
589
+
590
+ updated_at?: string;
591
+ }
592
+
593
+ /**
594
+ * One number the profile carries phone calls on.
595
+ */
596
+ export interface VoiceNumberCreated extends VoiceNumber {
597
+ /**
598
+ * The whsec\_ secret every question to callback_url is signed with. Shown here and
599
+ * by POST /v3/channels/voice/{number}/rotate-secret, nowhere else: store it now.
600
+ * Verify a question exactly as you verify a webhook, with X-Webhook-ID,
601
+ * X-Webhook-Timestamp and the body.
602
+ */
603
+ callback_secret?: string;
604
+ }
605
+
606
+ /**
607
+ * A freshly rotated callback signing secret
608
+ */
609
+ export interface VoiceSecret {
610
+ /**
611
+ * The new whsec\_ secret. The previous one stopped signing the moment this was
612
+ * returned, so update your backend before the next call reaches it. Shown once.
613
+ */
614
+ callback_secret?: string;
615
+ }
616
+
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
+ export interface VoiceCreateParams {
643
+ /**
644
+ * Body param: Where Sent asks what to do with each call on this number: an
645
+ * absolute HTTP or HTTPS URL on a public host. A signed question is POSTed here
646
+ * when a call arrives or a caller presses a key, and the answer decides the call.
647
+ * Every question is signed with the callback_secret the response returns, the same
648
+ * way your webhooks are signed. Turning the number on again with a different URL
649
+ * replaces it and keeps the secret.
650
+ */
651
+ callback_url: string;
652
+
653
+ /**
654
+ * Body param: The US area code a new number should be in, as 212. Only for a
655
+ * request that leaves number out — sending both says two different things about
656
+ * which number to use, and is refused. Omit it too and the number comes from
657
+ * anywhere in the country.
658
+ */
659
+ area_code?: string | null;
660
+
661
+ /**
662
+ * Body param: Make this the line app-originated calls are placed from when a voice
663
+ * token names no number. Omit it and your first voice number takes that role; a
664
+ * later one leaves it where it is.
665
+ */
666
+ default_for_app_calls?: boolean | null;
667
+
668
+ /**
669
+ * Body param: One of your phone numbers, in E.164 format. Leave the field out
670
+ * entirely to be given a new one instead; sending it empty is a refused request
671
+ * rather than a request for a new number.
672
+ */
673
+ number?: string | null;
674
+
675
+ /**
676
+ * Body param: Sandbox flag - when true, the operation is simulated without side
677
+ * effects Useful for testing integrations without actual execution
678
+ */
679
+ sandbox?: boolean;
680
+
681
+ /**
682
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
683
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
684
+ * hours per key per customer.
685
+ */
686
+ 'Idempotency-Key'?: string;
687
+
688
+ /**
689
+ * Header param: Profile UUID to scope the request to a child profile. Only
690
+ * organization API keys can use this header. The profile must belong to the
691
+ * calling organization.
692
+ */
693
+ 'x-profile-id'?: string;
694
+ }
695
+
696
+ export interface VoiceRetrieveParams {
697
+ /**
698
+ * Profile UUID to scope the request to a child profile. Only organization API keys
699
+ * can use this header. The profile must belong to the calling organization.
700
+ */
701
+ 'x-profile-id'?: string;
702
+ }
703
+
704
+ export interface VoiceUpdateParams {
705
+ /**
706
+ * Body param: A new callback URL for the number, active or not: an absolute HTTP
707
+ * or HTTPS URL on a public host, where Sent asks what to do with each call. The
708
+ * signing secret is kept.
709
+ */
710
+ callback_url?: string | null;
711
+
712
+ /**
713
+ * Body param: true makes this the line app-originated calls are placed from when a
714
+ * voice token names no number. false is refused: an account with active voice
715
+ * numbers always has exactly one default, so the default moves by giving it to
716
+ * another number.
717
+ */
718
+ default_for_app_calls?: boolean | null;
719
+
720
+ /**
721
+ * Body param: Sandbox flag - when true, the operation is simulated without side
722
+ * effects Useful for testing integrations without actual execution
723
+ */
724
+ sandbox?: boolean;
725
+
726
+ /**
727
+ * Body param: ACTIVE turns calls on for the number again, INACTIVE turns them off.
728
+ * Matched ignoring case. Turning the default line off is refused while other
729
+ * active voice numbers remain.
730
+ */
731
+ status?: 'ACTIVE' | 'INACTIVE' | null;
732
+
733
+ /**
734
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
735
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
736
+ * hours per key per customer.
737
+ */
738
+ 'Idempotency-Key'?: string;
739
+
740
+ /**
741
+ * Header param: Profile UUID to scope the request to a child profile. Only
742
+ * organization API keys can use this header. The profile must belong to the
743
+ * calling organization.
744
+ */
745
+ 'x-profile-id'?: string;
746
+ }
747
+
748
+ export interface VoiceListParams {
749
+ /**
750
+ * Profile UUID to scope the request to a child profile. Only organization API keys
751
+ * can use this header. The profile must belong to the calling organization.
752
+ */
753
+ 'x-profile-id'?: string;
754
+ }
755
+
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
+ export interface VoiceRotateSecretParams {
797
+ /**
798
+ * Body param: Sandbox flag - when true, the operation is simulated without side
799
+ * effects Useful for testing integrations without actual execution
800
+ */
801
+ sandbox?: boolean;
802
+
803
+ /**
804
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
805
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
806
+ * hours per key per customer.
807
+ */
808
+ 'Idempotency-Key'?: string;
809
+
810
+ /**
811
+ * Header param: Profile UUID to scope the request to a child profile. Only
812
+ * organization API keys can use this header. The profile must belong to the
813
+ * calling organization.
814
+ */
815
+ 'x-profile-id'?: string;
816
+ }
817
+
818
+ export interface VoiceTestParams {
819
+ /**
820
+ * Body param: Sandbox flag - when true, the operation is simulated without side
821
+ * effects Useful for testing integrations without actual execution
822
+ */
823
+ sandbox?: boolean;
824
+
825
+ /**
826
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
827
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
828
+ * hours per key per customer.
829
+ */
830
+ 'Idempotency-Key'?: string;
831
+
832
+ /**
833
+ * Header param: Profile UUID to scope the request to a child profile. Only
834
+ * organization API keys can use this header. The profile must belong to the
835
+ * calling organization.
836
+ */
837
+ 'x-profile-id'?: string;
838
+ }
839
+
840
+ export declare namespace Voice {
841
+ export {
842
+ type APIResponseOfListOfVoiceNumber as APIResponseOfListOfVoiceNumber,
843
+ type APIResponseOfVoiceCallbackTest as APIResponseOfVoiceCallbackTest,
844
+ type APIResponseOfVoiceNumber as APIResponseOfVoiceNumber,
845
+ type APIResponseOfVoiceNumberCreated as APIResponseOfVoiceNumberCreated,
846
+ type APIResponseOfVoiceSecret as APIResponseOfVoiceSecret,
847
+ type APIResponseOfVoiceToken as APIResponseOfVoiceToken,
848
+ type VoiceCallbackTest as VoiceCallbackTest,
849
+ type VoiceCallbackTestErrorInfo as VoiceCallbackTestErrorInfo,
850
+ type VoiceCallbackTestRequestInfo as VoiceCallbackTestRequestInfo,
851
+ type VoiceCallbackTestResponseInfo as VoiceCallbackTestResponseInfo,
852
+ type VoiceNumber as VoiceNumber,
853
+ type VoiceNumberCreated as VoiceNumberCreated,
854
+ type VoiceSecret as VoiceSecret,
855
+ type VoiceToken as VoiceToken,
856
+ type VoiceCreateParams as VoiceCreateParams,
857
+ type VoiceRetrieveParams as VoiceRetrieveParams,
858
+ type VoiceUpdateParams as VoiceUpdateParams,
859
+ type VoiceListParams as VoiceListParams,
860
+ type VoiceCreateTokenParams as VoiceCreateTokenParams,
861
+ type VoiceRotateSecretParams as VoiceRotateSecretParams,
862
+ type VoiceTestParams as VoiceTestParams,
863
+ };
864
+ }