@sentdm/sentdm 0.46.0 → 0.48.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 (113) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/client.d.mts +3 -1
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +3 -1
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/core/pagination.d.mts +25 -0
  9. package/core/pagination.d.mts.map +1 -1
  10. package/core/pagination.d.ts +25 -0
  11. package/core/pagination.d.ts.map +1 -1
  12. package/core/pagination.js +28 -1
  13. package/core/pagination.js.map +1 -1
  14. package/core/pagination.mjs +26 -0
  15. package/core/pagination.mjs.map +1 -1
  16. package/package.json +1 -1
  17. package/resources/channels/voice.d.mts +68 -19
  18. package/resources/channels/voice.d.mts.map +1 -1
  19. package/resources/channels/voice.d.ts +68 -19
  20. package/resources/channels/voice.d.ts.map +1 -1
  21. package/resources/channels/voice.js +31 -12
  22. package/resources/channels/voice.js.map +1 -1
  23. package/resources/channels/voice.mjs +31 -12
  24. package/resources/channels/voice.mjs.map +1 -1
  25. package/resources/profiles/campaigns.d.mts +3 -2
  26. package/resources/profiles/campaigns.d.mts.map +1 -1
  27. package/resources/profiles/campaigns.d.ts +3 -2
  28. package/resources/profiles/campaigns.d.ts.map +1 -1
  29. package/resources/profiles/campaigns.js +3 -2
  30. package/resources/profiles/campaigns.js.map +1 -1
  31. package/resources/profiles/campaigns.mjs +3 -2
  32. package/resources/profiles/campaigns.mjs.map +1 -1
  33. package/resources/voice/agents.d.mts +524 -0
  34. package/resources/voice/agents.d.mts.map +1 -0
  35. package/resources/voice/agents.d.ts +524 -0
  36. package/resources/voice/agents.d.ts.map +1 -0
  37. package/resources/voice/agents.js +193 -0
  38. package/resources/voice/agents.js.map +1 -0
  39. package/resources/voice/agents.mjs +189 -0
  40. package/resources/voice/agents.mjs.map +1 -0
  41. package/resources/voice/calls/calls.d.mts +87 -15
  42. package/resources/voice/calls/calls.d.mts.map +1 -1
  43. package/resources/voice/calls/calls.d.ts +87 -15
  44. package/resources/voice/calls/calls.d.ts.map +1 -1
  45. package/resources/voice/calls/calls.js +18 -11
  46. package/resources/voice/calls/calls.js.map +1 -1
  47. package/resources/voice/calls/calls.mjs +18 -11
  48. package/resources/voice/calls/calls.mjs.map +1 -1
  49. package/resources/voice/calls/participants.d.mts +2 -0
  50. package/resources/voice/calls/participants.d.mts.map +1 -1
  51. package/resources/voice/calls/participants.d.ts +2 -0
  52. package/resources/voice/calls/participants.d.ts.map +1 -1
  53. package/resources/voice/calls/participants.js +2 -0
  54. package/resources/voice/calls/participants.js.map +1 -1
  55. package/resources/voice/calls/participants.mjs +2 -0
  56. package/resources/voice/calls/participants.mjs.map +1 -1
  57. package/resources/voice/catalogue.d.mts +86 -0
  58. package/resources/voice/catalogue.d.mts.map +1 -0
  59. package/resources/voice/catalogue.d.ts +86 -0
  60. package/resources/voice/catalogue.d.ts.map +1 -0
  61. package/resources/voice/catalogue.js +40 -0
  62. package/resources/voice/catalogue.js.map +1 -0
  63. package/resources/voice/catalogue.mjs +36 -0
  64. package/resources/voice/catalogue.mjs.map +1 -0
  65. package/resources/voice/index.d.mts +2 -0
  66. package/resources/voice/index.d.mts.map +1 -1
  67. package/resources/voice/index.d.ts +2 -0
  68. package/resources/voice/index.d.ts.map +1 -1
  69. package/resources/voice/index.js +5 -1
  70. package/resources/voice/index.js.map +1 -1
  71. package/resources/voice/index.mjs +2 -0
  72. package/resources/voice/index.mjs.map +1 -1
  73. package/resources/voice/tokens.d.mts +2 -0
  74. package/resources/voice/tokens.d.mts.map +1 -1
  75. package/resources/voice/tokens.d.ts +2 -0
  76. package/resources/voice/tokens.d.ts.map +1 -1
  77. package/resources/voice/tokens.js +2 -0
  78. package/resources/voice/tokens.js.map +1 -1
  79. package/resources/voice/tokens.mjs +2 -0
  80. package/resources/voice/tokens.mjs.map +1 -1
  81. package/resources/voice/voice.d.mts +8 -0
  82. package/resources/voice/voice.d.mts.map +1 -1
  83. package/resources/voice/voice.d.ts +8 -0
  84. package/resources/voice/voice.d.ts.map +1 -1
  85. package/resources/voice/voice.js +8 -0
  86. package/resources/voice/voice.js.map +1 -1
  87. package/resources/voice/voice.mjs +8 -0
  88. package/resources/voice/voice.mjs.map +1 -1
  89. package/resources/webhooks.d.mts +151 -29
  90. package/resources/webhooks.d.mts.map +1 -1
  91. package/resources/webhooks.d.ts +151 -29
  92. package/resources/webhooks.d.ts.map +1 -1
  93. package/resources/webhooks.js +51 -11
  94. package/resources/webhooks.js.map +1 -1
  95. package/resources/webhooks.mjs +51 -11
  96. package/resources/webhooks.mjs.map +1 -1
  97. package/src/client.ts +8 -0
  98. package/src/core/pagination.ts +64 -0
  99. package/src/resources/channels/voice.ts +72 -19
  100. package/src/resources/profiles/campaigns.ts +3 -2
  101. package/src/resources/voice/agents.ts +729 -0
  102. package/src/resources/voice/calls/calls.ts +98 -15
  103. package/src/resources/voice/calls/participants.ts +2 -0
  104. package/src/resources/voice/catalogue.ts +118 -0
  105. package/src/resources/voice/index.ts +33 -0
  106. package/src/resources/voice/tokens.ts +2 -0
  107. package/src/resources/voice/voice.ts +74 -0
  108. package/src/resources/webhooks.ts +159 -29
  109. package/src/version.ts +1 -1
  110. package/version.d.mts +1 -1
  111. package/version.d.ts +1 -1
  112. package/version.js +1 -1
  113. package/version.mjs +1 -1
@@ -12,11 +12,29 @@ import { path } from "../internal/utils/path.mjs";
12
12
  */
13
13
  export class Webhooks extends APIResource {
14
14
  /**
15
- * Creates a new webhook endpoint for the authenticated customer.
15
+ * Creates a new webhook endpoint for the authenticated customer. A webhook is
16
+ * version 2 unless the request sets webhook_version to 1: Svix delivers it, signed
17
+ * with the webhook-id, webhook-timestamp and webhook-signature headers, and
18
+ * retries it on its own schedule, so retry_count and timeout_seconds apply to
19
+ * version 1 only. sender_profile applies to version 1 only and is ignored on
20
+ * version 2; is_inheritable applies to version 2 only. A version 1 webhook's
21
+ * response returns its sender_profile selection, with an empty event_types when it
22
+ * is not cloned onto sender profiles; a version 2 webhook's response leaves
23
+ * sender_profile out.
16
24
  *
17
25
  * @example
18
26
  * ```ts
19
- * const apiResponseWebhook = await client.webhooks.create();
27
+ * const apiResponseWebhook = await client.webhooks.create({
28
+ * display_name: 'Order Notifications',
29
+ * endpoint_url: 'https://example.com/webhooks/orders',
30
+ * event_filters: {
31
+ * message: ['delivered', 'failed'],
32
+ * templates: ['approved', 'rejected'],
33
+ * },
34
+ * event_types: ['contact', 'message', 'templates'],
35
+ * retry_count: 3,
36
+ * timeout_seconds: 30,
37
+ * });
20
38
  * ```
21
39
  */
22
40
  create(params, options) {
@@ -34,7 +52,8 @@ export class Webhooks extends APIResource {
34
52
  });
35
53
  }
36
54
  /**
37
- * Retrieves a single webhook by ID for the authenticated customer.
55
+ * Retrieves a single webhook by ID for the authenticated customer. A version 1
56
+ * webhook includes its sender_profile selection.
38
57
  *
39
58
  * @example
40
59
  * ```ts
@@ -54,12 +73,24 @@ export class Webhooks extends APIResource {
54
73
  });
55
74
  }
56
75
  /**
57
- * Updates an existing webhook for the authenticated customer.
76
+ * Updates an existing webhook for the authenticated customer. Its version does not
77
+ * change. sender_profile applies to a version 1 webhook and is_inheritable to a
78
+ * version 2 one; retry_count and timeout_seconds apply to version 1 only. A
79
+ * version 1 webhook's response returns its sender_profile selection as saved; a
80
+ * version 2 webhook's response leaves sender_profile out.
58
81
  *
59
82
  * @example
60
83
  * ```ts
61
84
  * const apiResponseWebhook = await client.webhooks.update(
62
85
  * 'd4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8',
86
+ * {
87
+ * display_name: 'Updated Order Notifications',
88
+ * endpoint_url: 'https://example.com/webhooks/orders-v2',
89
+ * event_filters: { message: ['delivered', 'failed'] },
90
+ * event_types: ['contact', 'message', 'templates'],
91
+ * retry_count: 5,
92
+ * timeout_seconds: 60,
93
+ * },
63
94
  * );
64
95
  * ```
65
96
  */
@@ -78,7 +109,8 @@ export class Webhooks extends APIResource {
78
109
  });
79
110
  }
80
111
  /**
81
- * Retrieves a paginated list of webhooks for the authenticated customer.
112
+ * Retrieves a paginated list of webhooks for the authenticated customer. Each
113
+ * version 1 webhook includes its sender_profile selection.
82
114
  *
83
115
  * @example
84
116
  * ```ts
@@ -138,9 +170,11 @@ export class Webhooks extends APIResource {
138
170
  });
139
171
  }
140
172
  /**
141
- * Retrieves a paginated list of delivery events for the specified webhook. If the
142
- * webhook is cloned onto your sender profiles, the list includes what those clones
143
- * received; read payload.account_id to tell whose event it is.
173
+ * Retrieves a paginated list of delivery events for the specified webhook, newest
174
+ * first. If the webhook is cloned onto your sender profiles (version 1) or
175
+ * inheritable by them (version 2, is_inheritable), the list includes their events;
176
+ * read payload.account_id to tell whose event it is. A sender profile may read its
177
+ * organization's inheritable webhook too, and gets the events about itself.
144
178
  *
145
179
  * @example
146
180
  * ```ts
@@ -164,8 +198,11 @@ export class Webhooks extends APIResource {
164
198
  });
165
199
  }
166
200
  /**
167
- * Generates a new signing secret for the specified webhook. The old secret is
168
- * immediately invalidated.
201
+ * Generates a new signing secret for the specified webhook. A version 1 webhook's
202
+ * old secret stops verifying at once. A version 2 webhook's deliveries are signed
203
+ * with the new secret at once, and with the old one as well for the next 24 hours,
204
+ * so a receiver can switch over without rejecting any; after that the old secret
205
+ * no longer verifies.
169
206
  *
170
207
  * @example
171
208
  * ```ts
@@ -189,7 +226,10 @@ export class Webhooks extends APIResource {
189
226
  });
190
227
  }
191
228
  /**
192
- * Sends a test event to the specified webhook endpoint to verify connectivity.
229
+ * Sends a test event to the specified webhook endpoint to verify connectivity. A
230
+ * version 1 webhook is tested at once and the answer says whether it was
231
+ * delivered; a version 2 webhook's test is queued with Svix, which delivers it
232
+ * right after, and the answer says it was queued.
193
233
  *
194
234
  * @example
195
235
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"webhooks.mjs","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"AAA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C,CAAC;IACL,CAAC;IAED;;;;;;;;;;OAUG;IACH,YAAY,CACV,EAAU,EACV,MAAiC,EACjC,OAAwB;QAExB,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC1F,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAA,gBAAgB,EAAE,gBAAgB,EAAE;YAChE,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC;gBACpB;oBACE,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;oBAC/E,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;iBACrE;gBACD,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF"}
package/src/client.ts CHANGED
@@ -25,6 +25,8 @@ import {
25
25
  ConversationsPageResponse,
26
26
  type TemplatesPageParams,
27
27
  TemplatesPageResponse,
28
+ type VoiceAgentsPageParams,
29
+ VoiceAgentsPageResponse,
28
30
  type WebhookEventsPageParams,
29
31
  WebhookEventsPageResponse,
30
32
  type WebhooksPageParams,
@@ -1017,6 +1019,12 @@ export declare namespace Sent {
1017
1019
  export import CallsPage = Pagination.CallsPage;
1018
1020
  export { type CallsPageParams as CallsPageParams, type CallsPageResponse as CallsPageResponse };
1019
1021
 
1022
+ export import VoiceAgentsPage = Pagination.VoiceAgentsPage;
1023
+ export {
1024
+ type VoiceAgentsPageParams as VoiceAgentsPageParams,
1025
+ type VoiceAgentsPageResponse as VoiceAgentsPageResponse,
1026
+ };
1027
+
1020
1028
  export {
1021
1029
  Webhooks as Webhooks,
1022
1030
  type APIMeta as APIMeta,
@@ -485,3 +485,67 @@ export class CallsPage<Item> extends AbstractPage<Item> implements CallsPageResp
485
485
  };
486
486
  }
487
487
  }
488
+
489
+ export interface VoiceAgentsPageResponse<Item> {
490
+ data: VoiceAgentsPageResponse.Data<Item>;
491
+ }
492
+
493
+ export namespace VoiceAgentsPageResponse {
494
+ export interface Data<Item> {
495
+ agents?: Array<Item>;
496
+
497
+ pagination?: Data.Pagination;
498
+ }
499
+
500
+ export namespace Data {
501
+ export interface Pagination {
502
+ has_more?: boolean;
503
+ }
504
+ }
505
+ }
506
+
507
+ export interface VoiceAgentsPageParams {
508
+ page?: number;
509
+
510
+ page_size?: number;
511
+ }
512
+
513
+ export class VoiceAgentsPage<Item> extends AbstractPage<Item> implements VoiceAgentsPageResponse<Item> {
514
+ data: VoiceAgentsPageResponse.Data<Item>;
515
+
516
+ constructor(
517
+ client: Sent,
518
+ response: Response,
519
+ body: VoiceAgentsPageResponse<Item>,
520
+ options: FinalRequestOptions,
521
+ ) {
522
+ super(client, response, body, options);
523
+
524
+ this.data = body.data || {};
525
+ }
526
+
527
+ getPaginatedItems(): Item[] {
528
+ return this.data?.agents ?? [];
529
+ }
530
+
531
+ override hasNextPage(): boolean {
532
+ if (this.data?.pagination?.has_more === false) {
533
+ return false;
534
+ }
535
+
536
+ return super.hasNextPage();
537
+ }
538
+
539
+ nextPageRequestOptions(): PageRequestOptions | null {
540
+ const query = this.options.query as VoiceAgentsPageParams;
541
+ const currentPage = query?.page ?? 1;
542
+
543
+ return {
544
+ ...this.options,
545
+ query: {
546
+ ...maybeObj(this.options.query),
547
+ page: currentPage + 1,
548
+ },
549
+ };
550
+ }
551
+ }
@@ -35,6 +35,16 @@ export class Voice extends APIResource {
35
35
  * question the way you verify a webhook. `POST /v3/channels/voice/{number}/test`
36
36
  * sends a test question and reports the verdict.
37
37
  *
38
+ * Send `agent_id` instead of `callback_url`, or with it, to have one of your voice
39
+ * agents (`GET /v3/voice/agents`) answer calls to the number. The agent wins over
40
+ * the callback URL for calls to the number; calls your app places from it still
41
+ * follow your app. `routes_to` in the response says which answers, and reads
42
+ * `agent_pending` while the number is still being moved to the agent. Calls follow
43
+ * the move within about an hour, as the provider applies it on its own clock.
44
+ * While numbers cannot be bound to agents, a request with `agent_id` is refused
45
+ * with `502` before any number is obtained or anything is written; send
46
+ * `callback_url` instead.
47
+ *
38
48
  * Your first voice number becomes the line app-originated calls are placed from
39
49
  * when a voice token names no number; send `default_for_app_calls: true` to give
40
50
  * that role to another number. A number you turned off earlier is turned back on,
@@ -109,18 +119,23 @@ export class Voice extends APIResource {
109
119
  *
110
120
  * ## What it changes
111
121
  *
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 |
122
+ * | Body | Effect |
123
+ * | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
124
+ * | `"status": "ACTIVE"` | turns calls on again for a number you turned off; the callback URL and the secret it had are kept |
125
+ * | `"status": "INACTIVE"` | turns calls off; the callback URL and the secret stay on the number |
126
+ * | `"default_for_app_calls": true` | makes this the line app-originated calls are placed from when a voice token names no number |
127
+ * | `"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 |
128
+ * | `"agent_id": "agent_…"` | one of your voice agents answers calls to the number, within about an hour of the change (the provider applies the move on its own clock, and `routes_to` reads `agent` as soon as it has recorded it); it wins over `callback_url` for calls to the number, and calls your app places from it still follow your app. `routes_to` reads `agent_pending` while the number is still being moved to the agent |
129
+ * | `"agent_id": null` | unbinds the agent, so `callback_url` answers calls to the number again |
130
+ * | key omitted | left exactly as it is |
119
131
  *
120
132
  * `status` is matched ignoring case. Any combination is accepted:
121
133
  * `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.
134
+ * new default, and a `callback_url` sent with either status is written too.
135
+ * `agent_id` is applied first, so a refusal to move the number to or from the
136
+ * agent leaves everything as it was, and the `409` and `400` refusals below are
137
+ * decided before anything is written, so they leave everything as it was too. A
138
+ * body that names none of them is refused.
124
139
  *
125
140
  * A number can be on without a callback URL: calls placed from your app then
126
141
  * connect straight to the number or user they dial, and calls to the number are
@@ -139,8 +154,12 @@ export class Voice extends APIResource {
139
154
  * **Making an inactive number the default is `400`.** Send `status: "ACTIVE"` in
140
155
  * the same call.
141
156
  *
142
- * **A number you never turned voice on for is `404`.** Add it with
143
- * `POST /v3/channels/voice`.
157
+ * **A number you never turned voice on for is `404`**, and so is an `agent_id`
158
+ * that is not one of your agents. Add the number with `POST /v3/channels/voice`.
159
+ *
160
+ * **`502` means the number could not be moved to or from the agent**, or an
161
+ * `agent_id` was sent while numbers cannot be bound to agents; nothing was
162
+ * written.
144
163
  *
145
164
  * The number is the E.164 value in the path with the plus sign URL-encoded
146
165
  * (`%2B`).
@@ -152,7 +171,7 @@ export class Voice extends APIResource {
152
171
  * @example
153
172
  * ```ts
154
173
  * const apiResponseOfVoiceNumber =
155
- * await client.channels.voice.update('+12125550100');
174
+ * await client.channels.voice.update('number');
156
175
  * ```
157
176
  */
158
177
  update(
@@ -503,6 +522,14 @@ export interface VoiceCallbackTestResponseInfo {
503
522
  * One number the profile carries phone calls on.
504
523
  */
505
524
  export interface VoiceNumber {
525
+ /**
526
+ * The voice agent calls to this number go to, such as
527
+ * agent_9f2ab000-0000-4000-8000-000000000001. It wins over callback_url for calls
528
+ * to the number; calls your app places from the number still follow your app. Null
529
+ * when no agent answers the number.
530
+ */
531
+ agent_id?: string | null;
532
+
506
533
  /**
507
534
  * Where Sent asks what to do with each call on this number: a signed question is
508
535
  * POSTed here when a call arrives or a caller presses a key, and the answer
@@ -525,6 +552,14 @@ export interface VoiceNumber {
525
552
  */
526
553
  number?: string;
527
554
 
555
+ /**
556
+ * Who answers calls to this number: agent, the voice agent in agent_id;
557
+ * agent_pending, that agent once the number has finished moving to it, with calls
558
+ * possibly unanswered until then; callback, your callback_url; or none, in which
559
+ * case calls to it are declined.
560
+ */
561
+ routes_to?: string;
562
+
528
563
  /**
529
564
  * ACTIVE while the number carries calls, INACTIVE once it was turned off. Nothing
530
565
  * provisions: a number the customer holds can carry calls the moment voice is
@@ -561,14 +596,13 @@ export interface VoiceSecret {
561
596
 
562
597
  export interface VoiceCreateParams {
563
598
  /**
564
- * Body param: Where Sent asks what to do with each call on this number: an
565
- * absolute HTTP or HTTPS URL on a public host. A signed question is POSTed here
566
- * when a call arrives or a caller presses a key, and the answer decides the call.
567
- * Every question is signed with the callback_secret the response returns, the same
568
- * way your webhooks are signed. Turning the number on again with a different URL
569
- * replaces it and keeps the secret.
599
+ * Body param: One of your voice agents (GET /v3/voice/agents), such as
600
+ * agent_9f2ab000-0000-4000-8000-000000000001, to answer calls to this number. It
601
+ * wins over callback_url for calls to the number, and both may be sent; calls your
602
+ * app places from the number still follow your app. Send it instead of
603
+ * callback_url for a number only an agent answers.
570
604
  */
571
- callback_url: string;
605
+ agent_id?: string | null;
572
606
 
573
607
  /**
574
608
  * Body param: The US area code a new number should be in, as 212. Only for a
@@ -578,6 +612,16 @@ export interface VoiceCreateParams {
578
612
  */
579
613
  area_code?: string | null;
580
614
 
615
+ /**
616
+ * Body param: Where Sent asks what to do with each call on this number: an
617
+ * absolute HTTP or HTTPS URL on a public host. A signed question is POSTed here
618
+ * when a call arrives or a caller presses a key, and the answer decides the call.
619
+ * Every question is signed with the callback_secret the response returns, the same
620
+ * way your webhooks are signed. Turning the number on again with a different URL
621
+ * replaces it and keeps the secret. Required unless agent_id is sent.
622
+ */
623
+ callback_url?: string | null;
624
+
581
625
  /**
582
626
  * Body param: Make this the line app-originated calls are placed from when a voice
583
627
  * token names no number. Omit it and your first voice number takes that role; a
@@ -622,6 +666,15 @@ export interface VoiceRetrieveParams {
622
666
  }
623
667
 
624
668
  export interface VoiceUpdateParams {
669
+ /**
670
+ * Body param: One of your voice agents, such as
671
+ * agent_9f2ab000-0000-4000-8000-000000000001, to answer calls to the number, or
672
+ * null to unbind it so the callback URL answers them again. The agent wins over
673
+ * callback_url for calls to the number; calls your app places from it still follow
674
+ * your app.
675
+ */
676
+ agent_id?: string | null;
677
+
625
678
  /**
626
679
  * Body param: A new callback URL for the number, active or not: an absolute HTTP
627
680
  * or HTTPS URL on a public host, where Sent asks what to do with each call. The
@@ -53,8 +53,9 @@ export class Campaigns extends APIResource {
53
53
  * which models a profile's markets, compliance, brand, campaigns and billing
54
54
  * explicitly.
55
55
  *
56
- * Updates an existing campaign under the brand of the specified profile. Cannot
57
- * update campaigns that have already been submitted to TCR.
56
+ * Updates an existing campaign under the brand of the specified profile. Once the
57
+ * campaign has been submitted to TCR its volume can no longer move between low
58
+ * volume (under 2,000 messages a day) and high volume.
58
59
  *
59
60
  * @deprecated
60
61
  */