@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.
- package/CHANGELOG.md +14 -0
- package/client.d.mts +20 -3
- package/client.d.mts.map +1 -1
- package/client.d.ts +20 -3
- package/client.d.ts.map +1 -1
- package/client.js +15 -0
- package/client.js.map +1 -1
- package/client.mjs +15 -0
- 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/calls/calls.d.mts +388 -0
- package/resources/calls/calls.d.mts.map +1 -0
- package/resources/calls/calls.d.ts +388 -0
- package/resources/calls/calls.d.ts.map +1 -0
- package/resources/calls/calls.js +159 -0
- package/resources/calls/calls.js.map +1 -0
- package/resources/calls/calls.mjs +154 -0
- package/resources/calls/calls.mjs.map +1 -0
- package/resources/calls/index.d.mts +3 -0
- package/resources/calls/index.d.mts.map +1 -0
- package/resources/calls/index.d.ts +3 -0
- package/resources/calls/index.d.ts.map +1 -0
- package/resources/calls/index.js +9 -0
- package/resources/calls/index.js.map +1 -0
- package/resources/calls/index.mjs +4 -0
- package/resources/calls/index.mjs.map +1 -0
- package/resources/calls/participants.d.mts +258 -0
- package/resources/calls/participants.d.mts.map +1 -0
- package/resources/calls/participants.d.ts +258 -0
- package/resources/calls/participants.d.ts.map +1 -0
- package/resources/calls/participants.js +158 -0
- package/resources/calls/participants.js.map +1 -0
- package/resources/calls/participants.mjs +154 -0
- package/resources/calls/participants.mjs.map +1 -0
- package/resources/calls.d.mts +2 -0
- package/resources/calls.d.mts.map +1 -0
- package/resources/calls.d.ts +2 -0
- package/resources/calls.d.ts.map +1 -0
- package/resources/calls.js +6 -0
- package/resources/calls.js.map +1 -0
- package/resources/calls.mjs +3 -0
- package/resources/calls.mjs.map +1 -0
- package/resources/channels/channels.d.mts +10 -0
- package/resources/channels/channels.d.mts.map +1 -0
- package/resources/channels/channels.d.ts +10 -0
- package/resources/channels/channels.d.ts.map +1 -0
- package/resources/channels/channels.js +17 -0
- package/resources/channels/channels.js.map +1 -0
- package/resources/channels/channels.mjs +12 -0
- package/resources/channels/channels.mjs.map +1 -0
- package/resources/channels/index.d.mts +3 -0
- package/resources/channels/index.d.mts.map +1 -0
- package/resources/channels/index.d.ts +3 -0
- package/resources/channels/index.d.ts.map +1 -0
- package/resources/channels/index.js +9 -0
- package/resources/channels/index.js.map +1 -0
- package/resources/channels/index.mjs +4 -0
- package/resources/channels/index.mjs.map +1 -0
- package/resources/channels/voice.d.mts +654 -0
- package/resources/channels/voice.d.mts.map +1 -0
- package/resources/channels/voice.d.ts +654 -0
- package/resources/channels/voice.d.ts.map +1 -0
- package/resources/channels/voice.js +285 -0
- package/resources/channels/voice.js.map +1 -0
- package/resources/channels/voice.mjs +281 -0
- package/resources/channels/voice.mjs.map +1 -0
- package/resources/channels.d.mts +2 -0
- package/resources/channels.d.mts.map +1 -0
- package/resources/channels.d.ts +2 -0
- package/resources/channels.d.ts.map +1 -0
- package/resources/channels.js +6 -0
- package/resources/channels.js.map +1 -0
- package/resources/channels.mjs +3 -0
- package/resources/channels.mjs.map +1 -0
- package/resources/index.d.mts +3 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -0
- package/resources/index.mjs.map +1 -1
- package/resources/messages.d.mts +13 -8
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +13 -8
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +7 -4
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +7 -4
- package/resources/messages.mjs.map +1 -1
- package/resources/webhooks.d.mts +112 -109
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +112 -109
- package/resources/webhooks.d.ts.map +1 -1
- package/src/client.ts +62 -0
- package/src/core/pagination.ts +59 -0
- package/src/resources/calls/calls.ts +556 -0
- package/src/resources/calls/index.ts +31 -0
- package/src/resources/calls/participants.ts +367 -0
- package/src/resources/calls.ts +3 -0
- package/src/resources/channels/channels.ts +61 -0
- package/src/resources/channels/index.ts +27 -0
- package/src/resources/channels/voice.ts +864 -0
- package/src/resources/channels.ts +3 -0
- package/src/resources/index.ts +21 -0
- package/src/resources/messages.ts +13 -8
- package/src/resources/webhooks.ts +127 -122
- 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
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Voice = void 0;
|
|
5
|
+
const resource_1 = require("../../core/resource.js");
|
|
6
|
+
const headers_1 = require("../../internal/headers.js");
|
|
7
|
+
const path_1 = require("../../internal/utils/path.js");
|
|
8
|
+
/**
|
|
9
|
+
* The senders you send from, one per channel.
|
|
10
|
+
*
|
|
11
|
+
* **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}`.
|
|
12
|
+
*
|
|
13
|
+
* ## Compliance lives on the market
|
|
14
|
+
*
|
|
15
|
+
* 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.
|
|
16
|
+
*
|
|
17
|
+
* `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.
|
|
18
|
+
*
|
|
19
|
+
* 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.
|
|
20
|
+
*/
|
|
21
|
+
class Voice extends resource_1.APIResource {
|
|
22
|
+
/**
|
|
23
|
+
* Adds voice to one of the numbers you hold, or gives you a new one. Send `number`
|
|
24
|
+
* for a number that is already yours (see `GET /v3/channels`); leave it out to be
|
|
25
|
+
* given a new US number, optionally in a particular `area_code`. Sending both is
|
|
26
|
+
* refused. Nothing registers, so the number can carry calls as soon as this
|
|
27
|
+
* returns.
|
|
28
|
+
*
|
|
29
|
+
* What happens on a call is decided by your `callback_url`: when a call arrives on
|
|
30
|
+
* the number, or a caller presses a key on a menu, Sent POSTs a signed question
|
|
31
|
+
* there and follows the answer. The response carries the `callback_secret` the
|
|
32
|
+
* questions are signed with, the one time it is shown without rotating; verify a
|
|
33
|
+
* question the way you verify a webhook. `POST /v3/channels/voice/{number}/test`
|
|
34
|
+
* sends a test question and reports the verdict.
|
|
35
|
+
*
|
|
36
|
+
* Your first voice number becomes the line app-originated calls are placed from
|
|
37
|
+
* when a voice token names no number; send `default_for_app_calls: true` to give
|
|
38
|
+
* that role to another number. A number you turned off earlier is turned back on,
|
|
39
|
+
* and the same number with a different `callback_url` has its URL replaced and
|
|
40
|
+
* keeps its secret.
|
|
41
|
+
*
|
|
42
|
+
* Read the number's settings with `GET /v3/channels/voice` and change them with
|
|
43
|
+
* `PATCH /v3/channels/voice/{number}`.
|
|
44
|
+
*
|
|
45
|
+
* With `sandbox: true` the request is validated and a simulated number reported
|
|
46
|
+
* with `202`; nothing is written and no number is bought.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const apiResponseOfVoiceNumberCreated =
|
|
51
|
+
* await client.channels.voice.create({
|
|
52
|
+
* callback_url: 'https://example.com/voice',
|
|
53
|
+
* number: '+12125550100',
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
create(params, options) {
|
|
58
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
59
|
+
return this._client.post('/v3/channels/voice', {
|
|
60
|
+
body,
|
|
61
|
+
...options,
|
|
62
|
+
headers: (0, headers_1.buildHeaders)([
|
|
63
|
+
{
|
|
64
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
65
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
66
|
+
},
|
|
67
|
+
options?.headers,
|
|
68
|
+
]),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Reads one of your voice numbers, active or inactive: its status, whether it is
|
|
73
|
+
* the default line for calls placed from your app, and its callback URL. The
|
|
74
|
+
* signing secret is not on this read.
|
|
75
|
+
*
|
|
76
|
+
* The same shape `GET /v3/channels/voice` lists, and the same shape `PATCH` on
|
|
77
|
+
* this path accepts and returns, so what comes back can be sent back.
|
|
78
|
+
*
|
|
79
|
+
* The number is the E.164 value in the path with the plus sign URL-encoded
|
|
80
|
+
* (`%2B`).
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const apiResponseOfVoiceNumber =
|
|
85
|
+
* await client.channels.voice.retrieve('+12125550100');
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
retrieve(number, params = {}, options) {
|
|
89
|
+
const { 'x-profile-id': xProfileID } = params ?? {};
|
|
90
|
+
return this._client.get((0, path_1.path) `/v3/channels/voice/${number}`, {
|
|
91
|
+
...options,
|
|
92
|
+
headers: (0, headers_1.buildHeaders)([
|
|
93
|
+
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
94
|
+
options?.headers,
|
|
95
|
+
]),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Changes one of your voice numbers and answers with the number as stored, the
|
|
100
|
+
* same shape `GET` on this path returns, so what comes back can be sent back.
|
|
101
|
+
*
|
|
102
|
+
* ## What it changes
|
|
103
|
+
*
|
|
104
|
+
* | Body | Effect |
|
|
105
|
+
* | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
106
|
+
* | `"status": "ACTIVE"` | turns calls on again for a number you turned off; the callback URL and the secret it had are kept |
|
|
107
|
+
* | `"status": "INACTIVE"` | turns calls off; the callback URL and the secret stay on the number |
|
|
108
|
+
* | `"default_for_app_calls": true` | makes this the line app-originated calls are placed from when a voice token names no number |
|
|
109
|
+
* | `"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 |
|
|
110
|
+
* | key omitted | left exactly as it is |
|
|
111
|
+
*
|
|
112
|
+
* `status` is matched ignoring case. Any combination is accepted:
|
|
113
|
+
* `status: "ACTIVE"` with `default_for_app_calls: true` turns a number on as the
|
|
114
|
+
* new default, and a `callback_url` sent with either status is written too. A body
|
|
115
|
+
* that names none of the three is refused.
|
|
116
|
+
*
|
|
117
|
+
* ## What it will refuse
|
|
118
|
+
*
|
|
119
|
+
* **`default_for_app_calls: false` is `400`.** An account with active voice
|
|
120
|
+
* numbers always has exactly one default, so the default moves by giving it to
|
|
121
|
+
* another number.
|
|
122
|
+
*
|
|
123
|
+
* **Turning the default line off is `409`** while other active voice numbers
|
|
124
|
+
* remain. Move the default to another number first. Turning off your last voice
|
|
125
|
+
* number is allowed; that turns phone calls off.
|
|
126
|
+
*
|
|
127
|
+
* **Making an inactive number the default is `400`.** Send `status: "ACTIVE"` in
|
|
128
|
+
* the same call.
|
|
129
|
+
*
|
|
130
|
+
* A number added without a `callback_url` is `INACTIVE` for that one reason, so
|
|
131
|
+
* sending it a `callback_url` turns it on by itself, and it becomes your default
|
|
132
|
+
* line if you have no other active voice number. A number you turned off while it
|
|
133
|
+
* had a URL stays off.
|
|
134
|
+
*
|
|
135
|
+
* **A number you never turned voice on for is `404`.** Add it with
|
|
136
|
+
* `POST /v3/channels/voice`.
|
|
137
|
+
*
|
|
138
|
+
* The number is the E.164 value in the path with the plus sign URL-encoded
|
|
139
|
+
* (`%2B`).
|
|
140
|
+
*
|
|
141
|
+
* With `sandbox: true` nothing is written: the request is validated against the
|
|
142
|
+
* stored number and the number is reported with `200` as it would read after the
|
|
143
|
+
* change.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```ts
|
|
147
|
+
* const apiResponseOfVoiceNumber =
|
|
148
|
+
* await client.channels.voice.update('+12125550100');
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
update(number, params, options) {
|
|
152
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
153
|
+
return this._client.patch((0, path_1.path) `/v3/channels/voice/${number}`, {
|
|
154
|
+
body,
|
|
155
|
+
...options,
|
|
156
|
+
headers: (0, headers_1.buildHeaders)([
|
|
157
|
+
{
|
|
158
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
159
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
160
|
+
},
|
|
161
|
+
options?.headers,
|
|
162
|
+
]),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Every number you turned phone calls on for, active or inactive, oldest first.
|
|
167
|
+
* Each entry carries the number's status, whether it is the default line for calls
|
|
168
|
+
* placed from your app, and its callback URL. The signing secret is never on a
|
|
169
|
+
* read; it is shown when voice is turned on and by
|
|
170
|
+
* `POST /v3/channels/voice/{number}/rotate-secret`.
|
|
171
|
+
*
|
|
172
|
+
* The same entries `GET /v3/channels` reports under `voice`, and the same shape
|
|
173
|
+
* `GET /v3/channels/voice/{number}` returns for one of them. Change a number with
|
|
174
|
+
* `PATCH /v3/channels/voice/{number}`.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```ts
|
|
178
|
+
* const apiResponseOfListOfVoiceNumber =
|
|
179
|
+
* await client.channels.voice.list();
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
list(params = {}, options) {
|
|
183
|
+
const { 'x-profile-id': xProfileID } = params ?? {};
|
|
184
|
+
return this._client.get('/v3/channels/voice', {
|
|
185
|
+
...options,
|
|
186
|
+
headers: (0, headers_1.buildHeaders)([
|
|
187
|
+
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
188
|
+
options?.headers,
|
|
189
|
+
]),
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Mints a short-lived token for one of your app users. Call this from your backend
|
|
194
|
+
* and return the token to your app, which passes it to the voice client SDK to
|
|
195
|
+
* register. The identity is bound to the given number, or to your default app-call
|
|
196
|
+
* number when omitted, and calls placed by that identity are routed through the
|
|
197
|
+
* bound number. Minting again re-binds the identity, so an identity can move
|
|
198
|
+
* between numbers.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```ts
|
|
202
|
+
* const apiResponseOfVoiceToken =
|
|
203
|
+
* await client.channels.voice.createToken();
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
createToken(params, options) {
|
|
207
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
208
|
+
return this._client.post('/v3/channels/voice/tokens', {
|
|
209
|
+
body,
|
|
210
|
+
...options,
|
|
211
|
+
headers: (0, headers_1.buildHeaders)([
|
|
212
|
+
{
|
|
213
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
214
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
215
|
+
},
|
|
216
|
+
options?.headers,
|
|
217
|
+
]),
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Generates a new signing secret for the questions Sent sends to this number's
|
|
222
|
+
* callback URL and returns it. The previous secret stops signing immediately, so
|
|
223
|
+
* update your backend before the next call reaches it. The number is the E.164
|
|
224
|
+
* value in the path with the plus sign URL-encoded (`%2B`).
|
|
225
|
+
*
|
|
226
|
+
* With `sandbox: true` a secret is generated and returned with `202`, and nothing
|
|
227
|
+
* is written.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```ts
|
|
231
|
+
* const apiResponseOfVoiceSecret =
|
|
232
|
+
* await client.channels.voice.rotateSecret('+12125550100');
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
rotateSecret(number, params, options) {
|
|
236
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
237
|
+
return this._client.post((0, path_1.path) `/v3/channels/voice/${number}/rotate-secret`, {
|
|
238
|
+
body,
|
|
239
|
+
...options,
|
|
240
|
+
headers: (0, headers_1.buildHeaders)([
|
|
241
|
+
{
|
|
242
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
243
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
244
|
+
},
|
|
245
|
+
options?.headers,
|
|
246
|
+
]),
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Sends a synthetic call.request question, flagged "test": true, to the number's
|
|
251
|
+
* callback URL, signed with that number's real secret, and reports what came back.
|
|
252
|
+
* Use it to build and debug your callback endpoint without placing calls: no call
|
|
253
|
+
* is placed, nothing is billed, and nothing is stored. One attempt with the same
|
|
254
|
+
* deadline as a live call, no retry. The outcome is ok when your endpoint answered
|
|
255
|
+
* 2xx with a valid answer; otherwise it is timeout, connection_failed, http_error
|
|
256
|
+
* or invalid_answer, with the reason and, for an invalid answer, the field at
|
|
257
|
+
* fault. The number is the E.164 value in the path with the plus sign URL-encoded
|
|
258
|
+
* (`%2B`).
|
|
259
|
+
*
|
|
260
|
+
* With `sandbox: true` nothing is sent: the verdict comes back ok with `202` and
|
|
261
|
+
* no request or response in it.
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* ```ts
|
|
265
|
+
* const apiResponseOfVoiceCallbackTest =
|
|
266
|
+
* await client.channels.voice.test('+12025550123');
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
test(number, params, options) {
|
|
270
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
271
|
+
return this._client.post((0, path_1.path) `/v3/channels/voice/${number}/test`, {
|
|
272
|
+
body,
|
|
273
|
+
...options,
|
|
274
|
+
headers: (0, headers_1.buildHeaders)([
|
|
275
|
+
{
|
|
276
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
277
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
278
|
+
},
|
|
279
|
+
options?.headers,
|
|
280
|
+
]),
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
exports.Voice = Voice;
|
|
285
|
+
//# sourceMappingURL=voice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice.js","sourceRoot":"","sources":["../../src/resources/channels/voice.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAGlD,uDAAsD;AAEtD,uDAAiD;AAEjD;;;;;;;;;;;;GAYG;AACH,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,MAAM,CAAC,MAAyB,EAAE,OAAwB;QACxD,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAA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G,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;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;AA/RD,sBA+RC"}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
+
import { buildHeaders } from "../../internal/headers.mjs";
|
|
4
|
+
import { path } from "../../internal/utils/path.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* The senders you send from, one per channel.
|
|
7
|
+
*
|
|
8
|
+
* **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}`.
|
|
9
|
+
*
|
|
10
|
+
* ## Compliance lives on the market
|
|
11
|
+
*
|
|
12
|
+
* 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.
|
|
13
|
+
*
|
|
14
|
+
* `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.
|
|
15
|
+
*
|
|
16
|
+
* 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.
|
|
17
|
+
*/
|
|
18
|
+
export class Voice extends APIResource {
|
|
19
|
+
/**
|
|
20
|
+
* Adds voice to one of the numbers you hold, or gives you a new one. Send `number`
|
|
21
|
+
* for a number that is already yours (see `GET /v3/channels`); leave it out to be
|
|
22
|
+
* given a new US number, optionally in a particular `area_code`. Sending both is
|
|
23
|
+
* refused. Nothing registers, so the number can carry calls as soon as this
|
|
24
|
+
* returns.
|
|
25
|
+
*
|
|
26
|
+
* What happens on a call is decided by your `callback_url`: when a call arrives on
|
|
27
|
+
* the number, or a caller presses a key on a menu, Sent POSTs a signed question
|
|
28
|
+
* there and follows the answer. The response carries the `callback_secret` the
|
|
29
|
+
* questions are signed with, the one time it is shown without rotating; verify a
|
|
30
|
+
* question the way you verify a webhook. `POST /v3/channels/voice/{number}/test`
|
|
31
|
+
* sends a test question and reports the verdict.
|
|
32
|
+
*
|
|
33
|
+
* Your first voice number becomes the line app-originated calls are placed from
|
|
34
|
+
* when a voice token names no number; send `default_for_app_calls: true` to give
|
|
35
|
+
* that role to another number. A number you turned off earlier is turned back on,
|
|
36
|
+
* and the same number with a different `callback_url` has its URL replaced and
|
|
37
|
+
* keeps its secret.
|
|
38
|
+
*
|
|
39
|
+
* Read the number's settings with `GET /v3/channels/voice` and change them with
|
|
40
|
+
* `PATCH /v3/channels/voice/{number}`.
|
|
41
|
+
*
|
|
42
|
+
* With `sandbox: true` the request is validated and a simulated number reported
|
|
43
|
+
* with `202`; nothing is written and no number is bought.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const apiResponseOfVoiceNumberCreated =
|
|
48
|
+
* await client.channels.voice.create({
|
|
49
|
+
* callback_url: 'https://example.com/voice',
|
|
50
|
+
* number: '+12125550100',
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
create(params, options) {
|
|
55
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
56
|
+
return this._client.post('/v3/channels/voice', {
|
|
57
|
+
body,
|
|
58
|
+
...options,
|
|
59
|
+
headers: buildHeaders([
|
|
60
|
+
{
|
|
61
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
62
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
63
|
+
},
|
|
64
|
+
options?.headers,
|
|
65
|
+
]),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Reads one of your voice numbers, active or inactive: its status, whether it is
|
|
70
|
+
* the default line for calls placed from your app, and its callback URL. The
|
|
71
|
+
* signing secret is not on this read.
|
|
72
|
+
*
|
|
73
|
+
* The same shape `GET /v3/channels/voice` lists, and the same shape `PATCH` on
|
|
74
|
+
* this path accepts and returns, so what comes back can be sent back.
|
|
75
|
+
*
|
|
76
|
+
* The number is the E.164 value in the path with the plus sign URL-encoded
|
|
77
|
+
* (`%2B`).
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const apiResponseOfVoiceNumber =
|
|
82
|
+
* await client.channels.voice.retrieve('+12125550100');
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
retrieve(number, params = {}, options) {
|
|
86
|
+
const { 'x-profile-id': xProfileID } = params ?? {};
|
|
87
|
+
return this._client.get(path `/v3/channels/voice/${number}`, {
|
|
88
|
+
...options,
|
|
89
|
+
headers: buildHeaders([
|
|
90
|
+
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
91
|
+
options?.headers,
|
|
92
|
+
]),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Changes one of your voice numbers and answers with the number as stored, the
|
|
97
|
+
* same shape `GET` on this path returns, so what comes back can be sent back.
|
|
98
|
+
*
|
|
99
|
+
* ## What it changes
|
|
100
|
+
*
|
|
101
|
+
* | Body | Effect |
|
|
102
|
+
* | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
103
|
+
* | `"status": "ACTIVE"` | turns calls on again for a number you turned off; the callback URL and the secret it had are kept |
|
|
104
|
+
* | `"status": "INACTIVE"` | turns calls off; the callback URL and the secret stay on the number |
|
|
105
|
+
* | `"default_for_app_calls": true` | makes this the line app-originated calls are placed from when a voice token names no number |
|
|
106
|
+
* | `"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 |
|
|
107
|
+
* | key omitted | left exactly as it is |
|
|
108
|
+
*
|
|
109
|
+
* `status` is matched ignoring case. Any combination is accepted:
|
|
110
|
+
* `status: "ACTIVE"` with `default_for_app_calls: true` turns a number on as the
|
|
111
|
+
* new default, and a `callback_url` sent with either status is written too. A body
|
|
112
|
+
* that names none of the three is refused.
|
|
113
|
+
*
|
|
114
|
+
* ## What it will refuse
|
|
115
|
+
*
|
|
116
|
+
* **`default_for_app_calls: false` is `400`.** An account with active voice
|
|
117
|
+
* numbers always has exactly one default, so the default moves by giving it to
|
|
118
|
+
* another number.
|
|
119
|
+
*
|
|
120
|
+
* **Turning the default line off is `409`** while other active voice numbers
|
|
121
|
+
* remain. Move the default to another number first. Turning off your last voice
|
|
122
|
+
* number is allowed; that turns phone calls off.
|
|
123
|
+
*
|
|
124
|
+
* **Making an inactive number the default is `400`.** Send `status: "ACTIVE"` in
|
|
125
|
+
* the same call.
|
|
126
|
+
*
|
|
127
|
+
* A number added without a `callback_url` is `INACTIVE` for that one reason, so
|
|
128
|
+
* sending it a `callback_url` turns it on by itself, and it becomes your default
|
|
129
|
+
* line if you have no other active voice number. A number you turned off while it
|
|
130
|
+
* had a URL stays off.
|
|
131
|
+
*
|
|
132
|
+
* **A number you never turned voice on for is `404`.** Add it with
|
|
133
|
+
* `POST /v3/channels/voice`.
|
|
134
|
+
*
|
|
135
|
+
* The number is the E.164 value in the path with the plus sign URL-encoded
|
|
136
|
+
* (`%2B`).
|
|
137
|
+
*
|
|
138
|
+
* With `sandbox: true` nothing is written: the request is validated against the
|
|
139
|
+
* stored number and the number is reported with `200` as it would read after the
|
|
140
|
+
* change.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* const apiResponseOfVoiceNumber =
|
|
145
|
+
* await client.channels.voice.update('+12125550100');
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
update(number, params, options) {
|
|
149
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
150
|
+
return this._client.patch(path `/v3/channels/voice/${number}`, {
|
|
151
|
+
body,
|
|
152
|
+
...options,
|
|
153
|
+
headers: buildHeaders([
|
|
154
|
+
{
|
|
155
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
156
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
157
|
+
},
|
|
158
|
+
options?.headers,
|
|
159
|
+
]),
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Every number you turned phone calls on for, active or inactive, oldest first.
|
|
164
|
+
* Each entry carries the number's status, whether it is the default line for calls
|
|
165
|
+
* placed from your app, and its callback URL. The signing secret is never on a
|
|
166
|
+
* read; it is shown when voice is turned on and by
|
|
167
|
+
* `POST /v3/channels/voice/{number}/rotate-secret`.
|
|
168
|
+
*
|
|
169
|
+
* The same entries `GET /v3/channels` reports under `voice`, and the same shape
|
|
170
|
+
* `GET /v3/channels/voice/{number}` returns for one of them. Change a number with
|
|
171
|
+
* `PATCH /v3/channels/voice/{number}`.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* const apiResponseOfListOfVoiceNumber =
|
|
176
|
+
* await client.channels.voice.list();
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
list(params = {}, options) {
|
|
180
|
+
const { 'x-profile-id': xProfileID } = params ?? {};
|
|
181
|
+
return this._client.get('/v3/channels/voice', {
|
|
182
|
+
...options,
|
|
183
|
+
headers: buildHeaders([
|
|
184
|
+
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
185
|
+
options?.headers,
|
|
186
|
+
]),
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Mints a short-lived token for one of your app users. Call this from your backend
|
|
191
|
+
* and return the token to your app, which passes it to the voice client SDK to
|
|
192
|
+
* register. The identity is bound to the given number, or to your default app-call
|
|
193
|
+
* number when omitted, and calls placed by that identity are routed through the
|
|
194
|
+
* bound number. Minting again re-binds the identity, so an identity can move
|
|
195
|
+
* between numbers.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```ts
|
|
199
|
+
* const apiResponseOfVoiceToken =
|
|
200
|
+
* await client.channels.voice.createToken();
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
createToken(params, options) {
|
|
204
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
205
|
+
return this._client.post('/v3/channels/voice/tokens', {
|
|
206
|
+
body,
|
|
207
|
+
...options,
|
|
208
|
+
headers: buildHeaders([
|
|
209
|
+
{
|
|
210
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
211
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
212
|
+
},
|
|
213
|
+
options?.headers,
|
|
214
|
+
]),
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Generates a new signing secret for the questions Sent sends to this number's
|
|
219
|
+
* callback URL and returns it. The previous secret stops signing immediately, so
|
|
220
|
+
* update your backend before the next call reaches it. The number is the E.164
|
|
221
|
+
* value in the path with the plus sign URL-encoded (`%2B`).
|
|
222
|
+
*
|
|
223
|
+
* With `sandbox: true` a secret is generated and returned with `202`, and nothing
|
|
224
|
+
* is written.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* const apiResponseOfVoiceSecret =
|
|
229
|
+
* await client.channels.voice.rotateSecret('+12125550100');
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
rotateSecret(number, params, options) {
|
|
233
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
234
|
+
return this._client.post(path `/v3/channels/voice/${number}/rotate-secret`, {
|
|
235
|
+
body,
|
|
236
|
+
...options,
|
|
237
|
+
headers: buildHeaders([
|
|
238
|
+
{
|
|
239
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
240
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
241
|
+
},
|
|
242
|
+
options?.headers,
|
|
243
|
+
]),
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Sends a synthetic call.request question, flagged "test": true, to the number's
|
|
248
|
+
* callback URL, signed with that number's real secret, and reports what came back.
|
|
249
|
+
* Use it to build and debug your callback endpoint without placing calls: no call
|
|
250
|
+
* is placed, nothing is billed, and nothing is stored. One attempt with the same
|
|
251
|
+
* deadline as a live call, no retry. The outcome is ok when your endpoint answered
|
|
252
|
+
* 2xx with a valid answer; otherwise it is timeout, connection_failed, http_error
|
|
253
|
+
* or invalid_answer, with the reason and, for an invalid answer, the field at
|
|
254
|
+
* fault. The number is the E.164 value in the path with the plus sign URL-encoded
|
|
255
|
+
* (`%2B`).
|
|
256
|
+
*
|
|
257
|
+
* With `sandbox: true` nothing is sent: the verdict comes back ok with `202` and
|
|
258
|
+
* no request or response in it.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* ```ts
|
|
262
|
+
* const apiResponseOfVoiceCallbackTest =
|
|
263
|
+
* await client.channels.voice.test('+12025550123');
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
test(number, params, options) {
|
|
267
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
268
|
+
return this._client.post(path `/v3/channels/voice/${number}/test`, {
|
|
269
|
+
body,
|
|
270
|
+
...options,
|
|
271
|
+
headers: buildHeaders([
|
|
272
|
+
{
|
|
273
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
274
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
275
|
+
},
|
|
276
|
+
options?.headers,
|
|
277
|
+
]),
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
//# sourceMappingURL=voice.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice.mjs","sourceRoot":"","sources":["../../src/resources/channels/voice.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAGlD,OAAO,EAAE,YAAY,EAAE,mCAA+B;AAEtD,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAEjD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,MAAM,CAAC,MAAyB,EAAE,OAAwB;QACxD,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC1F,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC7C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC;gBACpB;oBACE,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,cAAc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AAC;SACH,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.d.mts","sourceRoot":"","sources":["../src/resources/channels.ts"],"names":[],"mappings":"AAEA,qCAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../src/resources/channels.ts"],"names":[],"mappings":"AAEA,oCAAiC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
5
|
+
tslib_1.__exportStar(require("./channels/index.js"), exports);
|
|
6
|
+
//# sourceMappingURL=channels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.js","sourceRoot":"","sources":["../src/resources/channels.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,8DAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.mjs","sourceRoot":"","sources":["../src/resources/channels.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,qCAAiC"}
|
package/resources/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { Calls, type APIResponseOfCall, type APIResponseOfCallRecordings, type APIResponseOfCallsList, type Call, type CallParty, type CallRecording, type CallRecordings, type CallTimelineEntry, type CallsList, type CallRetrieveParams, type CallListParams, type CallHangupParams, type CallListRecordingsParams, type CallRecordParams, type CallsCallsPage, } from "./calls/calls.mjs";
|
|
2
|
+
export { Channels } from "./channels/channels.mjs";
|
|
1
3
|
export { Contacts, type APIResponseOfContact, type APIResponseOfContactMessageSummary, type ContactMessageSummary, type ContactResponse, type ContactCreateParams, type ContactRetrieveParams, type ContactUpdateParams, type ContactListParams, type ContactDeleteParams, type ContactRetrieveMessageSummaryParams, type ContactResponsesContactsPage, } from "./contacts.mjs";
|
|
2
4
|
export { Conversations, type APIResponseOfConversationMessagesList, type ConversationMessagesList, type ConversationListParams, type ConversationListMessagesParams, type ConversationMessagesListMessagesConversationsPage, } from "./conversations.mjs";
|
|
3
5
|
export { Me, type ProfileSettings, type MeRetrieveResponse, type MeRetrieveParams } from "./me.mjs";
|
|
@@ -6,5 +8,5 @@ export { Numbers, type NumberLookupResponse, type NumberLookupParams } from "./n
|
|
|
6
8
|
export { Profiles, type APIResponseOfProfileDetail, type BillingContactInfo, type BrandBusinessInfo, type BrandComplianceInfo, type BrandContactInfo, type BrandsBrandData, type DestinationCountry, type PaymentDetails, type ProfileDetail, type TcrBrandRelationship, type TcrVertical, type ProfileListResponse, type ProfileCompleteResponse, type ProfileCreateParams, type ProfileRetrieveParams, type ProfileUpdateParams, type ProfileListParams, type ProfileDeleteParams, type ProfileCompleteParams, } from "./profiles/profiles.mjs";
|
|
7
9
|
export { Templates, type APIResponseTemplate, type AuthenticationConfig, type Template, type TemplateBody, type TemplateBodyContent, type TemplateButton, type TemplateButtonProps, type TemplateDefinition, type TemplateFooter, type TemplateHeader, type TemplateVariable, type TemplateCreateParams, type TemplateRetrieveParams, type TemplateUpdateParams, type TemplateListParams, type TemplateDeleteParams, type TemplatesTemplatesPage, } from "./templates.mjs";
|
|
8
10
|
export { Users, type APIResponseOfUser, type UserResponse, type UserListResponse, type UserRetrieveParams, type UserListParams, type UserInviteParams, type UserRemoveParams, type UserUpdateRoleParams, } from "./users.mjs";
|
|
9
|
-
export { Webhooks, type APIMeta, type APIResponseWebhook, type ChannelEvent, type ChannelEventPayload, type ContactEvent, type ContactEventPayload, type ErrorDetail, type InboundMessageEvent, type InboundMessageEventPayload, type MessageEvent, type MessageEventPayload, type MutationRequest, type PaginationMeta, type TemplateEvent, type TemplateEventPayload, type WebhookEventType, type WebhookResponse, type WebhookListEventTypesResponse, type WebhookListEventsResponse, type WebhookRotateSecretResponse, type WebhookTestResponse, type WebhookCreateParams, type WebhookRetrieveParams, type WebhookUpdateParams, type WebhookListParams, type WebhookDeleteParams, type WebhookListEventTypesParams, type WebhookListEventsParams, type WebhookRotateSecretParams, type WebhookTestParams, type WebhookToggleStatusParams, type WebhookResponsesWebhooksPage, type WebhookListEventsResponsesWebhookEventsPage, } from "./webhooks.mjs";
|
|
11
|
+
export { Webhooks, type APIMeta, type APIResponseWebhook, type CallEvent, type CallEventPayload, type ChannelEvent, type ChannelEventPayload, type ContactEvent, type ContactEventPayload, type ErrorDetail, type InboundMessageEvent, type InboundMessageEventPayload, type MessageEvent, type MessageEventPayload, type MutationRequest, type PaginationMeta, type TemplateEvent, type TemplateEventPayload, type WebhookEventType, type WebhookResponse, type WebhookListEventTypesResponse, type WebhookListEventsResponse, type WebhookRotateSecretResponse, type WebhookTestResponse, type WebhookCreateParams, type WebhookRetrieveParams, type WebhookUpdateParams, type WebhookListParams, type WebhookDeleteParams, type WebhookListEventTypesParams, type WebhookListEventsParams, type WebhookRotateSecretParams, type WebhookTestParams, type WebhookToggleStatusParams, type WebhookResponsesWebhooksPage, type WebhookListEventsResponsesWebhookEventsPage, } from "./webhooks.mjs";
|
|
10
12
|
//# sourceMappingURL=index.d.mts.map
|