smswire 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +173 -2
- package/dist/index.cjs +420 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1754 -0
- package/dist/index.d.ts +1754 -0
- package/dist/index.js +388 -0
- package/dist/index.js.map +1 -0
- package/package.json +34 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1754 @@
|
|
|
1
|
+
/** A request that failed: the API's answer (status, code, message) or a network problem (status null). */
|
|
2
|
+
declare class SMSWireError extends Error {
|
|
3
|
+
/** HTTP status, or null when no answer arrived. */
|
|
4
|
+
readonly status: number | null;
|
|
5
|
+
/** Stable machine code, e.g. `invalid_request`, `rate_limited`, `network_error`, `timeout`. */
|
|
6
|
+
readonly code: string;
|
|
7
|
+
/** Seconds until trying again makes sense (from Retry-After), when the API said. */
|
|
8
|
+
readonly retryAfter: number | null;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
constructor(
|
|
11
|
+
/** HTTP status, or null when no answer arrived. */
|
|
12
|
+
status: number | null,
|
|
13
|
+
/** Stable machine code, e.g. `invalid_request`, `rate_limited`, `network_error`, `timeout`. */
|
|
14
|
+
code: string, message: string,
|
|
15
|
+
/** Seconds until trying again makes sense (from Retry-After), when the API said. */
|
|
16
|
+
retryAfter?: number | null, options?: {
|
|
17
|
+
cause?: unknown;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/** A webhook whose signature is missing, wrong or too old. Answer it with 400. */
|
|
21
|
+
declare class SMSWireSignatureError extends Error {
|
|
22
|
+
readonly name = "SMSWireSignatureError";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface Request {
|
|
26
|
+
method: 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
27
|
+
path: string;
|
|
28
|
+
query?: Record<string, unknown>;
|
|
29
|
+
body?: unknown;
|
|
30
|
+
headers?: Record<string, string>;
|
|
31
|
+
/** Safe to repeat after a 5xx or a dropped connection (GET, PATCH, DELETE, or a POST with an Idempotency-Key). */
|
|
32
|
+
idempotent: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface components {
|
|
36
|
+
schemas: {
|
|
37
|
+
AlertWebhookPayload: {
|
|
38
|
+
alert: {
|
|
39
|
+
created_at: string;
|
|
40
|
+
device: {
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
};
|
|
44
|
+
id: string;
|
|
45
|
+
kind: string;
|
|
46
|
+
message: string;
|
|
47
|
+
resolved_at?: string | null;
|
|
48
|
+
};
|
|
49
|
+
/** @enum {string} */
|
|
50
|
+
event: "alert.raised" | "alert.resolved" | "alert.test";
|
|
51
|
+
};
|
|
52
|
+
BulkItem: {
|
|
53
|
+
body?: string | null;
|
|
54
|
+
language?: string | null;
|
|
55
|
+
metadata?: components["schemas"]["Metadata"] | null;
|
|
56
|
+
tags?: components["schemas"]["Tags"] | null;
|
|
57
|
+
to: string;
|
|
58
|
+
type?: components["schemas"]["MessageType"] | null;
|
|
59
|
+
variables?: components["schemas"]["Variables"] | null;
|
|
60
|
+
};
|
|
61
|
+
BulkSendRequest: {
|
|
62
|
+
body?: string | null;
|
|
63
|
+
from?: string | null;
|
|
64
|
+
group_ids?: string[] | null;
|
|
65
|
+
language?: string | null;
|
|
66
|
+
messages?: components["schemas"]["BulkItem"][];
|
|
67
|
+
metadata?: components["schemas"]["Metadata"] | null;
|
|
68
|
+
name?: string | null;
|
|
69
|
+
phone?: string | null;
|
|
70
|
+
rate?: number | null;
|
|
71
|
+
send_at?: string | null;
|
|
72
|
+
sim?: number | null;
|
|
73
|
+
tags?: components["schemas"]["Tags"] | null;
|
|
74
|
+
template?: string | null;
|
|
75
|
+
type?: components["schemas"]["MessageType"] | null;
|
|
76
|
+
};
|
|
77
|
+
BulkSendResponse: {
|
|
78
|
+
accepted: number;
|
|
79
|
+
batch_id: string;
|
|
80
|
+
/** @default [] */
|
|
81
|
+
rejected: components["schemas"]["RejectedItem"][];
|
|
82
|
+
};
|
|
83
|
+
/** @enum {string} */
|
|
84
|
+
CampaignApiStatus: "draft" | "scheduled" | "sending" | "paused" | "done" | "cancelled";
|
|
85
|
+
CampaignApiView: {
|
|
86
|
+
audience: {
|
|
87
|
+
/** @default [] */
|
|
88
|
+
group_ids: string[];
|
|
89
|
+
/** @default [] */
|
|
90
|
+
messages: {
|
|
91
|
+
to: string;
|
|
92
|
+
/** @default {} */
|
|
93
|
+
variables: {
|
|
94
|
+
[key: string]: string;
|
|
95
|
+
};
|
|
96
|
+
}[];
|
|
97
|
+
/** @default [] */
|
|
98
|
+
numbers: string[];
|
|
99
|
+
};
|
|
100
|
+
body: string;
|
|
101
|
+
consent: boolean;
|
|
102
|
+
created_at: string;
|
|
103
|
+
cron?: string | null;
|
|
104
|
+
exclude: {
|
|
105
|
+
/** @default [] */
|
|
106
|
+
group_ids: string[];
|
|
107
|
+
no_reply_to_campaign_id?: string | null;
|
|
108
|
+
recent_days?: number | null;
|
|
109
|
+
};
|
|
110
|
+
id: string;
|
|
111
|
+
language?: string | null;
|
|
112
|
+
/** @default [] */
|
|
113
|
+
languages: string[];
|
|
114
|
+
last_run_at?: string | null;
|
|
115
|
+
name: string;
|
|
116
|
+
next_run_at?: string | null;
|
|
117
|
+
quiet_hours?: {
|
|
118
|
+
end: string;
|
|
119
|
+
start: string;
|
|
120
|
+
timezone: string;
|
|
121
|
+
} | null;
|
|
122
|
+
rate: number;
|
|
123
|
+
runs: number;
|
|
124
|
+
sim?: number | null;
|
|
125
|
+
status: components["schemas"]["CampaignApiStatus"];
|
|
126
|
+
stop_footer?: string | null;
|
|
127
|
+
tags: string[];
|
|
128
|
+
timezone?: string | null;
|
|
129
|
+
total: number;
|
|
130
|
+
type: components["schemas"]["MessageType"];
|
|
131
|
+
};
|
|
132
|
+
CampaignAudienceRequest: {
|
|
133
|
+
/** @default [] */
|
|
134
|
+
group_ids?: string[];
|
|
135
|
+
/** @default [] */
|
|
136
|
+
messages?: {
|
|
137
|
+
to: string;
|
|
138
|
+
/** @default {} */
|
|
139
|
+
variables?: {
|
|
140
|
+
[key: string]: string;
|
|
141
|
+
};
|
|
142
|
+
}[];
|
|
143
|
+
/** @default [] */
|
|
144
|
+
numbers?: string[];
|
|
145
|
+
};
|
|
146
|
+
CampaignControlRequest: {
|
|
147
|
+
/** @enum {string} */
|
|
148
|
+
status: "running" | "paused";
|
|
149
|
+
};
|
|
150
|
+
CampaignExcludeRequest: {
|
|
151
|
+
/** @default [] */
|
|
152
|
+
group_ids?: string[];
|
|
153
|
+
no_reply_to_campaign_id?: string | null;
|
|
154
|
+
recent_days?: number | null;
|
|
155
|
+
};
|
|
156
|
+
CampaignList: {
|
|
157
|
+
data: components["schemas"]["CampaignApiView"][];
|
|
158
|
+
};
|
|
159
|
+
CampaignPreviewResponse: {
|
|
160
|
+
excluded: {
|
|
161
|
+
duplicate: number;
|
|
162
|
+
group: number;
|
|
163
|
+
recent: number;
|
|
164
|
+
replied: number;
|
|
165
|
+
};
|
|
166
|
+
recipients: number;
|
|
167
|
+
};
|
|
168
|
+
CampaignQuietHours: {
|
|
169
|
+
end: string;
|
|
170
|
+
start: string;
|
|
171
|
+
timezone: string;
|
|
172
|
+
};
|
|
173
|
+
CampaignRequest: {
|
|
174
|
+
/**
|
|
175
|
+
* @default {
|
|
176
|
+
* "group_ids": [],
|
|
177
|
+
* "numbers": [],
|
|
178
|
+
* "messages": []
|
|
179
|
+
* }
|
|
180
|
+
*/
|
|
181
|
+
audience?: components["schemas"]["CampaignAudienceRequest"];
|
|
182
|
+
/** @default */
|
|
183
|
+
body?: string;
|
|
184
|
+
/** @default false */
|
|
185
|
+
consent?: boolean;
|
|
186
|
+
cron?: string | null;
|
|
187
|
+
ends_at?: string | null;
|
|
188
|
+
/**
|
|
189
|
+
* @default {
|
|
190
|
+
* "group_ids": [],
|
|
191
|
+
* "recent_days": null,
|
|
192
|
+
* "no_reply_to_campaign_id": null
|
|
193
|
+
* }
|
|
194
|
+
*/
|
|
195
|
+
exclude?: components["schemas"]["CampaignExcludeRequest"];
|
|
196
|
+
from?: string | null;
|
|
197
|
+
language?: string | null;
|
|
198
|
+
max_runs?: number | null;
|
|
199
|
+
name: string;
|
|
200
|
+
phone?: string | null;
|
|
201
|
+
quiet_hours?: components["schemas"]["CampaignQuietHours"] | null;
|
|
202
|
+
/** @default 30 */
|
|
203
|
+
rate?: number;
|
|
204
|
+
send_at?: string | null;
|
|
205
|
+
sim?: number | null;
|
|
206
|
+
stop_footer?: string | null;
|
|
207
|
+
/** @default [] */
|
|
208
|
+
tags?: string[];
|
|
209
|
+
template?: string;
|
|
210
|
+
timezone?: string | null;
|
|
211
|
+
/** @default marketing */
|
|
212
|
+
type?: components["schemas"]["MessageType"];
|
|
213
|
+
};
|
|
214
|
+
CampaignResultsView: {
|
|
215
|
+
awaiting: number;
|
|
216
|
+
delivered: number;
|
|
217
|
+
delivery_rate?: number | null;
|
|
218
|
+
failed: number;
|
|
219
|
+
opt_outs: number;
|
|
220
|
+
parts: number;
|
|
221
|
+
replies: number;
|
|
222
|
+
runs: components["schemas"]["CampaignRunView"][];
|
|
223
|
+
waiting: number;
|
|
224
|
+
};
|
|
225
|
+
CampaignRunView: {
|
|
226
|
+
batch_id: string;
|
|
227
|
+
created_at: string;
|
|
228
|
+
delivered: number;
|
|
229
|
+
failed: number;
|
|
230
|
+
total: number;
|
|
231
|
+
};
|
|
232
|
+
CampaignSendResponse: {
|
|
233
|
+
/** @default 0 */
|
|
234
|
+
accepted: number;
|
|
235
|
+
batch_id?: string | null;
|
|
236
|
+
/** @default [] */
|
|
237
|
+
rejected: components["schemas"]["RejectedItem"][];
|
|
238
|
+
/** @enum {string} */
|
|
239
|
+
status: "queued" | "scheduled";
|
|
240
|
+
};
|
|
241
|
+
CampaignUpdate: {
|
|
242
|
+
audience?: components["schemas"]["CampaignAudienceRequest"];
|
|
243
|
+
body?: string;
|
|
244
|
+
consent?: boolean;
|
|
245
|
+
cron?: string | null;
|
|
246
|
+
ends_at?: string | null;
|
|
247
|
+
exclude?: components["schemas"]["CampaignExcludeRequest"];
|
|
248
|
+
from?: string | null;
|
|
249
|
+
language?: string | null;
|
|
250
|
+
max_runs?: number | null;
|
|
251
|
+
name?: string;
|
|
252
|
+
phone?: string | null;
|
|
253
|
+
quiet_hours?: components["schemas"]["CampaignQuietHours"] | null;
|
|
254
|
+
rate?: number;
|
|
255
|
+
send_at?: string | null;
|
|
256
|
+
sim?: number | null;
|
|
257
|
+
stop_footer?: string | null;
|
|
258
|
+
tags?: string[];
|
|
259
|
+
template?: string;
|
|
260
|
+
timezone?: string | null;
|
|
261
|
+
type?: components["schemas"]["MessageType"];
|
|
262
|
+
};
|
|
263
|
+
Error: {
|
|
264
|
+
error: string;
|
|
265
|
+
message: string;
|
|
266
|
+
};
|
|
267
|
+
GroupApiView: {
|
|
268
|
+
created_at: string;
|
|
269
|
+
id: string;
|
|
270
|
+
join_reply?: string | null;
|
|
271
|
+
/** @default [] */
|
|
272
|
+
keywords: string[];
|
|
273
|
+
name: string;
|
|
274
|
+
size: number;
|
|
275
|
+
};
|
|
276
|
+
GroupJoinedWebhookPayload: {
|
|
277
|
+
contact_id: string;
|
|
278
|
+
/** @constant */
|
|
279
|
+
event: "group.joined";
|
|
280
|
+
group_id: string;
|
|
281
|
+
group_name: string;
|
|
282
|
+
joined_at: string;
|
|
283
|
+
keyword: string;
|
|
284
|
+
message_id: string;
|
|
285
|
+
phone: string;
|
|
286
|
+
project_id: string;
|
|
287
|
+
};
|
|
288
|
+
/** @enum {string} */
|
|
289
|
+
GroupJoinSource: "manual" | "import" | "keyword" | "api";
|
|
290
|
+
GroupList: {
|
|
291
|
+
data: components["schemas"]["GroupApiView"][];
|
|
292
|
+
};
|
|
293
|
+
GroupMemberInput: {
|
|
294
|
+
fields?: {
|
|
295
|
+
[key: string]: string;
|
|
296
|
+
} | null;
|
|
297
|
+
language?: string | null;
|
|
298
|
+
name?: string | null;
|
|
299
|
+
phone: string;
|
|
300
|
+
};
|
|
301
|
+
GroupMemberPage: {
|
|
302
|
+
data: components["schemas"]["GroupMemberView"][];
|
|
303
|
+
next_cursor?: string | null;
|
|
304
|
+
};
|
|
305
|
+
GroupMembersRequest: {
|
|
306
|
+
members: components["schemas"]["GroupMemberInput"][];
|
|
307
|
+
};
|
|
308
|
+
GroupMembersResponse: {
|
|
309
|
+
added: number;
|
|
310
|
+
already: number;
|
|
311
|
+
invalid: {
|
|
312
|
+
index: number;
|
|
313
|
+
phone: string;
|
|
314
|
+
}[];
|
|
315
|
+
};
|
|
316
|
+
GroupMemberView: {
|
|
317
|
+
contact_id: string;
|
|
318
|
+
/** @default {} */
|
|
319
|
+
fields: {
|
|
320
|
+
[key: string]: string;
|
|
321
|
+
};
|
|
322
|
+
joined_at: string;
|
|
323
|
+
name?: string | null;
|
|
324
|
+
opted_out: boolean;
|
|
325
|
+
phone: string;
|
|
326
|
+
source: components["schemas"]["GroupJoinSource"];
|
|
327
|
+
};
|
|
328
|
+
GroupRequest: {
|
|
329
|
+
join_reply?: string | null;
|
|
330
|
+
keywords?: string[] | null;
|
|
331
|
+
name: string;
|
|
332
|
+
};
|
|
333
|
+
GroupUpdate: {
|
|
334
|
+
join_reply?: string | null;
|
|
335
|
+
keywords?: string[] | null;
|
|
336
|
+
name?: string;
|
|
337
|
+
};
|
|
338
|
+
InboundWebhookPayload: {
|
|
339
|
+
body: string;
|
|
340
|
+
/** @constant */
|
|
341
|
+
event: "message.received";
|
|
342
|
+
from: string;
|
|
343
|
+
id: string;
|
|
344
|
+
project_id?: string | null;
|
|
345
|
+
received_at: string;
|
|
346
|
+
sim?: number | null;
|
|
347
|
+
};
|
|
348
|
+
MessagePage: {
|
|
349
|
+
data: components["schemas"]["MessageView"][];
|
|
350
|
+
next_cursor?: string | null;
|
|
351
|
+
};
|
|
352
|
+
/** @enum {string} */
|
|
353
|
+
MessageStatus: "queued" | "sending" | "sent" | "delivered" | "failed" | "cancelled";
|
|
354
|
+
/** @enum {string} */
|
|
355
|
+
MessageType: "otp" | "transactional" | "notification" | "marketing";
|
|
356
|
+
MessageView: {
|
|
357
|
+
batch_id?: string | null;
|
|
358
|
+
delivered_at?: string | null;
|
|
359
|
+
error?: string | null;
|
|
360
|
+
id: string;
|
|
361
|
+
language?: string | null;
|
|
362
|
+
metadata?: {
|
|
363
|
+
[key: string]: unknown;
|
|
364
|
+
} | null;
|
|
365
|
+
received_at: string;
|
|
366
|
+
redacted?: boolean;
|
|
367
|
+
scheduled_at?: string | null;
|
|
368
|
+
segments: number;
|
|
369
|
+
sent_at?: string | null;
|
|
370
|
+
status: components["schemas"]["MessageStatus"];
|
|
371
|
+
/** @default [] */
|
|
372
|
+
tags: string[];
|
|
373
|
+
to: string;
|
|
374
|
+
/** @default transactional */
|
|
375
|
+
type: components["schemas"]["MessageType"];
|
|
376
|
+
};
|
|
377
|
+
Metadata: {
|
|
378
|
+
[key: string]: unknown;
|
|
379
|
+
};
|
|
380
|
+
/** @enum {string} */
|
|
381
|
+
OtpFailure: "invalid" | "expired" | "too_many_attempts" | "already_used";
|
|
382
|
+
OtpRequest: {
|
|
383
|
+
body?: string | null;
|
|
384
|
+
from?: string | null;
|
|
385
|
+
language?: string | null;
|
|
386
|
+
/** @default 6 */
|
|
387
|
+
length?: number;
|
|
388
|
+
phone?: string | null;
|
|
389
|
+
sim?: number | null;
|
|
390
|
+
template?: string | null;
|
|
391
|
+
to: string;
|
|
392
|
+
/** @default 300 */
|
|
393
|
+
ttl?: number;
|
|
394
|
+
};
|
|
395
|
+
OtpResponse: {
|
|
396
|
+
expires_at: string;
|
|
397
|
+
id: string;
|
|
398
|
+
message_id: string;
|
|
399
|
+
to: string;
|
|
400
|
+
};
|
|
401
|
+
OtpVerifyRequest: {
|
|
402
|
+
code: string;
|
|
403
|
+
id: string;
|
|
404
|
+
};
|
|
405
|
+
OtpVerifyResponse: {
|
|
406
|
+
reason?: components["schemas"]["OtpFailure"] | null;
|
|
407
|
+
valid: boolean;
|
|
408
|
+
};
|
|
409
|
+
ProjectPhone: {
|
|
410
|
+
id: string;
|
|
411
|
+
name: string;
|
|
412
|
+
/** @default [] */
|
|
413
|
+
names: {
|
|
414
|
+
label?: string | null;
|
|
415
|
+
number?: string | null;
|
|
416
|
+
slot: number;
|
|
417
|
+
}[];
|
|
418
|
+
online: boolean;
|
|
419
|
+
/** @default [] */
|
|
420
|
+
sims: number[];
|
|
421
|
+
};
|
|
422
|
+
ProjectStatus: {
|
|
423
|
+
dashboard_url: string;
|
|
424
|
+
name: string;
|
|
425
|
+
phones: components["schemas"]["ProjectPhone"][];
|
|
426
|
+
project: string;
|
|
427
|
+
project_id: string;
|
|
428
|
+
ready: boolean;
|
|
429
|
+
workspace_id: string;
|
|
430
|
+
};
|
|
431
|
+
RejectedItem: {
|
|
432
|
+
index: number;
|
|
433
|
+
reason: string;
|
|
434
|
+
to: string;
|
|
435
|
+
};
|
|
436
|
+
SchedulePage: {
|
|
437
|
+
data: components["schemas"]["ScheduleView"][];
|
|
438
|
+
};
|
|
439
|
+
ScheduleRecipient: {
|
|
440
|
+
to: string;
|
|
441
|
+
variables?: components["schemas"]["Variables"] | null;
|
|
442
|
+
};
|
|
443
|
+
ScheduleRequest: {
|
|
444
|
+
body?: string | null;
|
|
445
|
+
cron: string;
|
|
446
|
+
/** @default true */
|
|
447
|
+
enabled?: boolean;
|
|
448
|
+
ends_at?: string | null;
|
|
449
|
+
from?: string | null;
|
|
450
|
+
group_ids?: string[] | null;
|
|
451
|
+
language?: string | null;
|
|
452
|
+
max_runs?: number | null;
|
|
453
|
+
messages?: components["schemas"]["ScheduleRecipient"][] | null;
|
|
454
|
+
metadata?: components["schemas"]["Metadata"] | null;
|
|
455
|
+
name?: string | null;
|
|
456
|
+
phone?: string | null;
|
|
457
|
+
rate?: number | null;
|
|
458
|
+
sim?: number | null;
|
|
459
|
+
tags?: components["schemas"]["Tags"] | null;
|
|
460
|
+
template?: string | null;
|
|
461
|
+
/** @default UTC */
|
|
462
|
+
timezone?: string;
|
|
463
|
+
to?: string | null;
|
|
464
|
+
type?: components["schemas"]["MessageType"] | null;
|
|
465
|
+
variables?: components["schemas"]["Variables"] | null;
|
|
466
|
+
};
|
|
467
|
+
ScheduleRunView: {
|
|
468
|
+
accepted: number;
|
|
469
|
+
at: string;
|
|
470
|
+
batch_id?: string | null;
|
|
471
|
+
error?: string | null;
|
|
472
|
+
message_id?: string | null;
|
|
473
|
+
rejected: number;
|
|
474
|
+
/** @enum {string} */
|
|
475
|
+
status: "sent" | "failed" | "skipped";
|
|
476
|
+
};
|
|
477
|
+
ScheduleUpdate: {
|
|
478
|
+
body?: string | null;
|
|
479
|
+
cron?: string | null;
|
|
480
|
+
enabled?: boolean | null;
|
|
481
|
+
ends_at?: string | null;
|
|
482
|
+
language?: string | null;
|
|
483
|
+
max_runs?: number | null;
|
|
484
|
+
name?: string | null;
|
|
485
|
+
template?: string | null;
|
|
486
|
+
timezone?: string | null;
|
|
487
|
+
type?: components["schemas"]["MessageType"] | null;
|
|
488
|
+
};
|
|
489
|
+
ScheduleView: {
|
|
490
|
+
body?: string | null;
|
|
491
|
+
created_at: string;
|
|
492
|
+
cron: string;
|
|
493
|
+
enabled: boolean;
|
|
494
|
+
ends_at?: string | null;
|
|
495
|
+
id: string;
|
|
496
|
+
language?: string | null;
|
|
497
|
+
last_run?: components["schemas"]["ScheduleRunView"] | null;
|
|
498
|
+
last_run_at?: string | null;
|
|
499
|
+
max_runs?: number | null;
|
|
500
|
+
name: string;
|
|
501
|
+
next_run_at?: string | null;
|
|
502
|
+
recipients: {
|
|
503
|
+
/** @default [] */
|
|
504
|
+
group_ids: string[];
|
|
505
|
+
numbers: number;
|
|
506
|
+
};
|
|
507
|
+
run_count: number;
|
|
508
|
+
runs?: components["schemas"]["ScheduleRunView"][] | null;
|
|
509
|
+
/** @default [] */
|
|
510
|
+
tags: string[];
|
|
511
|
+
template_id?: string | null;
|
|
512
|
+
timezone: string;
|
|
513
|
+
type?: components["schemas"]["MessageType"] | null;
|
|
514
|
+
};
|
|
515
|
+
SendMessageRequest: {
|
|
516
|
+
body?: string | null;
|
|
517
|
+
from?: string | null;
|
|
518
|
+
language?: string | null;
|
|
519
|
+
metadata?: components["schemas"]["Metadata"] | null;
|
|
520
|
+
phone?: string | null;
|
|
521
|
+
send_at?: string | null;
|
|
522
|
+
sim?: number | null;
|
|
523
|
+
tags?: components["schemas"]["Tags"] | null;
|
|
524
|
+
template?: string | null;
|
|
525
|
+
to: string;
|
|
526
|
+
type?: components["schemas"]["MessageType"] | null;
|
|
527
|
+
variables?: components["schemas"]["Variables"] | null;
|
|
528
|
+
};
|
|
529
|
+
StatusWebhookPayload: {
|
|
530
|
+
batch_id?: string | null;
|
|
531
|
+
delivered_at?: string | null;
|
|
532
|
+
error?: string | null;
|
|
533
|
+
/**
|
|
534
|
+
* @default message.status
|
|
535
|
+
* @constant
|
|
536
|
+
*/
|
|
537
|
+
event: "message.status";
|
|
538
|
+
id: string;
|
|
539
|
+
metadata?: {
|
|
540
|
+
[key: string]: unknown;
|
|
541
|
+
} | null;
|
|
542
|
+
project_id?: string | null;
|
|
543
|
+
segments: number;
|
|
544
|
+
sent_at?: string | null;
|
|
545
|
+
status: components["schemas"]["MessageStatus"];
|
|
546
|
+
/** @default [] */
|
|
547
|
+
tags: string[];
|
|
548
|
+
to: string;
|
|
549
|
+
/** @default transactional */
|
|
550
|
+
type: components["schemas"]["MessageType"];
|
|
551
|
+
};
|
|
552
|
+
Tags: string[];
|
|
553
|
+
Variables: {
|
|
554
|
+
[key: string]: string | number | boolean;
|
|
555
|
+
};
|
|
556
|
+
};
|
|
557
|
+
responses: {
|
|
558
|
+
/** @description Invalid request (`invalid_request`, …). */
|
|
559
|
+
BadRequest: {
|
|
560
|
+
headers: {
|
|
561
|
+
[name: string]: unknown;
|
|
562
|
+
};
|
|
563
|
+
content: {
|
|
564
|
+
"application/json": components["schemas"]["Error"];
|
|
565
|
+
};
|
|
566
|
+
};
|
|
567
|
+
/** @description No such project, message or schedule. */
|
|
568
|
+
NotFound: {
|
|
569
|
+
headers: {
|
|
570
|
+
[name: string]: unknown;
|
|
571
|
+
};
|
|
572
|
+
content: {
|
|
573
|
+
"application/json": components["schemas"]["Error"];
|
|
574
|
+
};
|
|
575
|
+
};
|
|
576
|
+
/** @description `too_many_requests` (this key's requests a minute), `rate_limited`, `daily_limit_reached`, `monthly_limit_reached` or `too_many_otp_requests`. */
|
|
577
|
+
TooManyRequests: {
|
|
578
|
+
headers: {
|
|
579
|
+
/** @description Seconds until trying again makes sense. */
|
|
580
|
+
"Retry-After"?: number;
|
|
581
|
+
[name: string]: unknown;
|
|
582
|
+
};
|
|
583
|
+
content: {
|
|
584
|
+
"application/json": components["schemas"]["Error"];
|
|
585
|
+
};
|
|
586
|
+
};
|
|
587
|
+
/** @description Missing or wrong API key. */
|
|
588
|
+
Unauthorized: {
|
|
589
|
+
headers: {
|
|
590
|
+
[name: string]: unknown;
|
|
591
|
+
};
|
|
592
|
+
content: {
|
|
593
|
+
"application/json": components["schemas"]["Error"];
|
|
594
|
+
};
|
|
595
|
+
};
|
|
596
|
+
};
|
|
597
|
+
parameters: {
|
|
598
|
+
/** @description The project's slug. */
|
|
599
|
+
Project: string;
|
|
600
|
+
};
|
|
601
|
+
requestBodies: never;
|
|
602
|
+
headers: never;
|
|
603
|
+
pathItems: never;
|
|
604
|
+
}
|
|
605
|
+
interface operations {
|
|
606
|
+
listCampaigns: {
|
|
607
|
+
parameters: {
|
|
608
|
+
query?: never;
|
|
609
|
+
header?: never;
|
|
610
|
+
path: {
|
|
611
|
+
/** @description The project's slug. */
|
|
612
|
+
project: components["parameters"]["Project"];
|
|
613
|
+
};
|
|
614
|
+
cookie?: never;
|
|
615
|
+
};
|
|
616
|
+
requestBody?: never;
|
|
617
|
+
responses: {
|
|
618
|
+
/** @description All of them. */
|
|
619
|
+
200: {
|
|
620
|
+
headers: {
|
|
621
|
+
[name: string]: unknown;
|
|
622
|
+
};
|
|
623
|
+
content: {
|
|
624
|
+
"application/json": components["schemas"]["CampaignList"];
|
|
625
|
+
};
|
|
626
|
+
};
|
|
627
|
+
400: components["responses"]["BadRequest"];
|
|
628
|
+
401: components["responses"]["Unauthorized"];
|
|
629
|
+
404: components["responses"]["NotFound"];
|
|
630
|
+
429: components["responses"]["TooManyRequests"];
|
|
631
|
+
};
|
|
632
|
+
};
|
|
633
|
+
createCampaign: {
|
|
634
|
+
parameters: {
|
|
635
|
+
query?: never;
|
|
636
|
+
header?: never;
|
|
637
|
+
path: {
|
|
638
|
+
/** @description The project's slug. */
|
|
639
|
+
project: components["parameters"]["Project"];
|
|
640
|
+
};
|
|
641
|
+
cookie?: never;
|
|
642
|
+
};
|
|
643
|
+
requestBody: {
|
|
644
|
+
content: {
|
|
645
|
+
"application/json": components["schemas"]["CampaignRequest"];
|
|
646
|
+
};
|
|
647
|
+
};
|
|
648
|
+
responses: {
|
|
649
|
+
/** @description Created, as a draft. */
|
|
650
|
+
201: {
|
|
651
|
+
headers: {
|
|
652
|
+
[name: string]: unknown;
|
|
653
|
+
};
|
|
654
|
+
content: {
|
|
655
|
+
"application/json": components["schemas"]["CampaignApiView"];
|
|
656
|
+
};
|
|
657
|
+
};
|
|
658
|
+
400: components["responses"]["BadRequest"];
|
|
659
|
+
401: components["responses"]["Unauthorized"];
|
|
660
|
+
404: components["responses"]["NotFound"];
|
|
661
|
+
429: components["responses"]["TooManyRequests"];
|
|
662
|
+
};
|
|
663
|
+
};
|
|
664
|
+
getCampaign: {
|
|
665
|
+
parameters: {
|
|
666
|
+
query?: never;
|
|
667
|
+
header?: never;
|
|
668
|
+
path: {
|
|
669
|
+
/** @description Campaign id. */
|
|
670
|
+
id: string;
|
|
671
|
+
/** @description The project's slug. */
|
|
672
|
+
project: components["parameters"]["Project"];
|
|
673
|
+
};
|
|
674
|
+
cookie?: never;
|
|
675
|
+
};
|
|
676
|
+
requestBody?: never;
|
|
677
|
+
responses: {
|
|
678
|
+
/** @description The campaign. */
|
|
679
|
+
200: {
|
|
680
|
+
headers: {
|
|
681
|
+
[name: string]: unknown;
|
|
682
|
+
};
|
|
683
|
+
content: {
|
|
684
|
+
"application/json": components["schemas"]["CampaignApiView"];
|
|
685
|
+
};
|
|
686
|
+
};
|
|
687
|
+
400: components["responses"]["BadRequest"];
|
|
688
|
+
401: components["responses"]["Unauthorized"];
|
|
689
|
+
404: components["responses"]["NotFound"];
|
|
690
|
+
429: components["responses"]["TooManyRequests"];
|
|
691
|
+
};
|
|
692
|
+
};
|
|
693
|
+
deleteCampaign: {
|
|
694
|
+
parameters: {
|
|
695
|
+
query?: never;
|
|
696
|
+
header?: never;
|
|
697
|
+
path: {
|
|
698
|
+
/** @description Campaign id. */
|
|
699
|
+
id: string;
|
|
700
|
+
/** @description The project's slug. */
|
|
701
|
+
project: components["parameters"]["Project"];
|
|
702
|
+
};
|
|
703
|
+
cookie?: never;
|
|
704
|
+
};
|
|
705
|
+
requestBody?: never;
|
|
706
|
+
responses: {
|
|
707
|
+
/** @description Deleted. */
|
|
708
|
+
204: {
|
|
709
|
+
headers: {
|
|
710
|
+
[name: string]: unknown;
|
|
711
|
+
};
|
|
712
|
+
content?: never;
|
|
713
|
+
};
|
|
714
|
+
400: components["responses"]["BadRequest"];
|
|
715
|
+
401: components["responses"]["Unauthorized"];
|
|
716
|
+
404: components["responses"]["NotFound"];
|
|
717
|
+
429: components["responses"]["TooManyRequests"];
|
|
718
|
+
};
|
|
719
|
+
};
|
|
720
|
+
updateCampaign: {
|
|
721
|
+
parameters: {
|
|
722
|
+
query?: never;
|
|
723
|
+
header?: never;
|
|
724
|
+
path: {
|
|
725
|
+
/** @description Campaign id. */
|
|
726
|
+
id: string;
|
|
727
|
+
/** @description The project's slug. */
|
|
728
|
+
project: components["parameters"]["Project"];
|
|
729
|
+
};
|
|
730
|
+
cookie?: never;
|
|
731
|
+
};
|
|
732
|
+
requestBody: {
|
|
733
|
+
content: {
|
|
734
|
+
"application/json": components["schemas"]["CampaignUpdate"];
|
|
735
|
+
};
|
|
736
|
+
};
|
|
737
|
+
responses: {
|
|
738
|
+
/** @description The updated campaign. */
|
|
739
|
+
200: {
|
|
740
|
+
headers: {
|
|
741
|
+
[name: string]: unknown;
|
|
742
|
+
};
|
|
743
|
+
content: {
|
|
744
|
+
"application/json": components["schemas"]["CampaignApiView"];
|
|
745
|
+
};
|
|
746
|
+
};
|
|
747
|
+
400: components["responses"]["BadRequest"];
|
|
748
|
+
401: components["responses"]["Unauthorized"];
|
|
749
|
+
404: components["responses"]["NotFound"];
|
|
750
|
+
429: components["responses"]["TooManyRequests"];
|
|
751
|
+
};
|
|
752
|
+
};
|
|
753
|
+
cancelCampaign: {
|
|
754
|
+
parameters: {
|
|
755
|
+
query?: never;
|
|
756
|
+
header?: never;
|
|
757
|
+
path: {
|
|
758
|
+
/** @description Campaign id. */
|
|
759
|
+
id: string;
|
|
760
|
+
/** @description The project's slug. */
|
|
761
|
+
project: components["parameters"]["Project"];
|
|
762
|
+
};
|
|
763
|
+
cookie?: never;
|
|
764
|
+
};
|
|
765
|
+
requestBody?: never;
|
|
766
|
+
responses: {
|
|
767
|
+
/** @description The campaign. */
|
|
768
|
+
200: {
|
|
769
|
+
headers: {
|
|
770
|
+
[name: string]: unknown;
|
|
771
|
+
};
|
|
772
|
+
content: {
|
|
773
|
+
"application/json": components["schemas"]["CampaignApiView"];
|
|
774
|
+
};
|
|
775
|
+
};
|
|
776
|
+
400: components["responses"]["BadRequest"];
|
|
777
|
+
401: components["responses"]["Unauthorized"];
|
|
778
|
+
404: components["responses"]["NotFound"];
|
|
779
|
+
429: components["responses"]["TooManyRequests"];
|
|
780
|
+
};
|
|
781
|
+
};
|
|
782
|
+
controlCampaign: {
|
|
783
|
+
parameters: {
|
|
784
|
+
query?: never;
|
|
785
|
+
header?: never;
|
|
786
|
+
path: {
|
|
787
|
+
/** @description Campaign id. */
|
|
788
|
+
id: string;
|
|
789
|
+
/** @description The project's slug. */
|
|
790
|
+
project: components["parameters"]["Project"];
|
|
791
|
+
};
|
|
792
|
+
cookie?: never;
|
|
793
|
+
};
|
|
794
|
+
requestBody: {
|
|
795
|
+
content: {
|
|
796
|
+
"application/json": components["schemas"]["CampaignControlRequest"];
|
|
797
|
+
};
|
|
798
|
+
};
|
|
799
|
+
responses: {
|
|
800
|
+
/** @description The campaign. */
|
|
801
|
+
200: {
|
|
802
|
+
headers: {
|
|
803
|
+
[name: string]: unknown;
|
|
804
|
+
};
|
|
805
|
+
content: {
|
|
806
|
+
"application/json": components["schemas"]["CampaignApiView"];
|
|
807
|
+
};
|
|
808
|
+
};
|
|
809
|
+
400: components["responses"]["BadRequest"];
|
|
810
|
+
401: components["responses"]["Unauthorized"];
|
|
811
|
+
404: components["responses"]["NotFound"];
|
|
812
|
+
429: components["responses"]["TooManyRequests"];
|
|
813
|
+
};
|
|
814
|
+
};
|
|
815
|
+
previewCampaign: {
|
|
816
|
+
parameters: {
|
|
817
|
+
query?: never;
|
|
818
|
+
header?: never;
|
|
819
|
+
path: {
|
|
820
|
+
/** @description Campaign id. */
|
|
821
|
+
id: string;
|
|
822
|
+
/** @description The project's slug. */
|
|
823
|
+
project: components["parameters"]["Project"];
|
|
824
|
+
};
|
|
825
|
+
cookie?: never;
|
|
826
|
+
};
|
|
827
|
+
requestBody?: never;
|
|
828
|
+
responses: {
|
|
829
|
+
/** @description The count, and what each rule took out. */
|
|
830
|
+
200: {
|
|
831
|
+
headers: {
|
|
832
|
+
[name: string]: unknown;
|
|
833
|
+
};
|
|
834
|
+
content: {
|
|
835
|
+
"application/json": components["schemas"]["CampaignPreviewResponse"];
|
|
836
|
+
};
|
|
837
|
+
};
|
|
838
|
+
400: components["responses"]["BadRequest"];
|
|
839
|
+
401: components["responses"]["Unauthorized"];
|
|
840
|
+
404: components["responses"]["NotFound"];
|
|
841
|
+
429: components["responses"]["TooManyRequests"];
|
|
842
|
+
};
|
|
843
|
+
};
|
|
844
|
+
campaignResults: {
|
|
845
|
+
parameters: {
|
|
846
|
+
query?: never;
|
|
847
|
+
header?: never;
|
|
848
|
+
path: {
|
|
849
|
+
/** @description Campaign id. */
|
|
850
|
+
id: string;
|
|
851
|
+
/** @description The project's slug. */
|
|
852
|
+
project: components["parameters"]["Project"];
|
|
853
|
+
};
|
|
854
|
+
cookie?: never;
|
|
855
|
+
};
|
|
856
|
+
requestBody?: never;
|
|
857
|
+
responses: {
|
|
858
|
+
/** @description The results. */
|
|
859
|
+
200: {
|
|
860
|
+
headers: {
|
|
861
|
+
[name: string]: unknown;
|
|
862
|
+
};
|
|
863
|
+
content: {
|
|
864
|
+
"application/json": components["schemas"]["CampaignResultsView"];
|
|
865
|
+
};
|
|
866
|
+
};
|
|
867
|
+
400: components["responses"]["BadRequest"];
|
|
868
|
+
401: components["responses"]["Unauthorized"];
|
|
869
|
+
404: components["responses"]["NotFound"];
|
|
870
|
+
429: components["responses"]["TooManyRequests"];
|
|
871
|
+
};
|
|
872
|
+
};
|
|
873
|
+
sendCampaign: {
|
|
874
|
+
parameters: {
|
|
875
|
+
query?: never;
|
|
876
|
+
header?: never;
|
|
877
|
+
path: {
|
|
878
|
+
/** @description Campaign id. */
|
|
879
|
+
id: string;
|
|
880
|
+
/** @description The project's slug. */
|
|
881
|
+
project: components["parameters"]["Project"];
|
|
882
|
+
};
|
|
883
|
+
cookie?: never;
|
|
884
|
+
};
|
|
885
|
+
requestBody?: never;
|
|
886
|
+
responses: {
|
|
887
|
+
/** @description Started. */
|
|
888
|
+
202: {
|
|
889
|
+
headers: {
|
|
890
|
+
[name: string]: unknown;
|
|
891
|
+
};
|
|
892
|
+
content: {
|
|
893
|
+
"application/json": components["schemas"]["CampaignSendResponse"];
|
|
894
|
+
};
|
|
895
|
+
};
|
|
896
|
+
400: components["responses"]["BadRequest"];
|
|
897
|
+
401: components["responses"]["Unauthorized"];
|
|
898
|
+
404: components["responses"]["NotFound"];
|
|
899
|
+
429: components["responses"]["TooManyRequests"];
|
|
900
|
+
};
|
|
901
|
+
};
|
|
902
|
+
listGroups: {
|
|
903
|
+
parameters: {
|
|
904
|
+
query?: never;
|
|
905
|
+
header?: never;
|
|
906
|
+
path: {
|
|
907
|
+
/** @description The project's slug. */
|
|
908
|
+
project: components["parameters"]["Project"];
|
|
909
|
+
};
|
|
910
|
+
cookie?: never;
|
|
911
|
+
};
|
|
912
|
+
requestBody?: never;
|
|
913
|
+
responses: {
|
|
914
|
+
/** @description All of them. */
|
|
915
|
+
200: {
|
|
916
|
+
headers: {
|
|
917
|
+
[name: string]: unknown;
|
|
918
|
+
};
|
|
919
|
+
content: {
|
|
920
|
+
"application/json": components["schemas"]["GroupList"];
|
|
921
|
+
};
|
|
922
|
+
};
|
|
923
|
+
400: components["responses"]["BadRequest"];
|
|
924
|
+
401: components["responses"]["Unauthorized"];
|
|
925
|
+
404: components["responses"]["NotFound"];
|
|
926
|
+
429: components["responses"]["TooManyRequests"];
|
|
927
|
+
};
|
|
928
|
+
};
|
|
929
|
+
createGroup: {
|
|
930
|
+
parameters: {
|
|
931
|
+
query?: never;
|
|
932
|
+
header?: never;
|
|
933
|
+
path: {
|
|
934
|
+
/** @description The project's slug. */
|
|
935
|
+
project: components["parameters"]["Project"];
|
|
936
|
+
};
|
|
937
|
+
cookie?: never;
|
|
938
|
+
};
|
|
939
|
+
requestBody: {
|
|
940
|
+
content: {
|
|
941
|
+
"application/json": components["schemas"]["GroupRequest"];
|
|
942
|
+
};
|
|
943
|
+
};
|
|
944
|
+
responses: {
|
|
945
|
+
/** @description Created. */
|
|
946
|
+
201: {
|
|
947
|
+
headers: {
|
|
948
|
+
[name: string]: unknown;
|
|
949
|
+
};
|
|
950
|
+
content: {
|
|
951
|
+
"application/json": components["schemas"]["GroupApiView"];
|
|
952
|
+
};
|
|
953
|
+
};
|
|
954
|
+
400: components["responses"]["BadRequest"];
|
|
955
|
+
401: components["responses"]["Unauthorized"];
|
|
956
|
+
404: components["responses"]["NotFound"];
|
|
957
|
+
429: components["responses"]["TooManyRequests"];
|
|
958
|
+
};
|
|
959
|
+
};
|
|
960
|
+
getGroup: {
|
|
961
|
+
parameters: {
|
|
962
|
+
query?: never;
|
|
963
|
+
header?: never;
|
|
964
|
+
path: {
|
|
965
|
+
/** @description Group id. */
|
|
966
|
+
id: string;
|
|
967
|
+
/** @description The project's slug. */
|
|
968
|
+
project: components["parameters"]["Project"];
|
|
969
|
+
};
|
|
970
|
+
cookie?: never;
|
|
971
|
+
};
|
|
972
|
+
requestBody?: never;
|
|
973
|
+
responses: {
|
|
974
|
+
/** @description The group. */
|
|
975
|
+
200: {
|
|
976
|
+
headers: {
|
|
977
|
+
[name: string]: unknown;
|
|
978
|
+
};
|
|
979
|
+
content: {
|
|
980
|
+
"application/json": components["schemas"]["GroupApiView"];
|
|
981
|
+
};
|
|
982
|
+
};
|
|
983
|
+
400: components["responses"]["BadRequest"];
|
|
984
|
+
401: components["responses"]["Unauthorized"];
|
|
985
|
+
404: components["responses"]["NotFound"];
|
|
986
|
+
429: components["responses"]["TooManyRequests"];
|
|
987
|
+
};
|
|
988
|
+
};
|
|
989
|
+
deleteGroup: {
|
|
990
|
+
parameters: {
|
|
991
|
+
query?: never;
|
|
992
|
+
header?: never;
|
|
993
|
+
path: {
|
|
994
|
+
/** @description Group id. */
|
|
995
|
+
id: string;
|
|
996
|
+
/** @description The project's slug. */
|
|
997
|
+
project: components["parameters"]["Project"];
|
|
998
|
+
};
|
|
999
|
+
cookie?: never;
|
|
1000
|
+
};
|
|
1001
|
+
requestBody?: never;
|
|
1002
|
+
responses: {
|
|
1003
|
+
/** @description Deleted. */
|
|
1004
|
+
204: {
|
|
1005
|
+
headers: {
|
|
1006
|
+
[name: string]: unknown;
|
|
1007
|
+
};
|
|
1008
|
+
content?: never;
|
|
1009
|
+
};
|
|
1010
|
+
400: components["responses"]["BadRequest"];
|
|
1011
|
+
401: components["responses"]["Unauthorized"];
|
|
1012
|
+
404: components["responses"]["NotFound"];
|
|
1013
|
+
429: components["responses"]["TooManyRequests"];
|
|
1014
|
+
};
|
|
1015
|
+
};
|
|
1016
|
+
updateGroup: {
|
|
1017
|
+
parameters: {
|
|
1018
|
+
query?: never;
|
|
1019
|
+
header?: never;
|
|
1020
|
+
path: {
|
|
1021
|
+
/** @description Group id. */
|
|
1022
|
+
id: string;
|
|
1023
|
+
/** @description The project's slug. */
|
|
1024
|
+
project: components["parameters"]["Project"];
|
|
1025
|
+
};
|
|
1026
|
+
cookie?: never;
|
|
1027
|
+
};
|
|
1028
|
+
requestBody: {
|
|
1029
|
+
content: {
|
|
1030
|
+
"application/json": components["schemas"]["GroupUpdate"];
|
|
1031
|
+
};
|
|
1032
|
+
};
|
|
1033
|
+
responses: {
|
|
1034
|
+
/** @description The updated group. */
|
|
1035
|
+
200: {
|
|
1036
|
+
headers: {
|
|
1037
|
+
[name: string]: unknown;
|
|
1038
|
+
};
|
|
1039
|
+
content: {
|
|
1040
|
+
"application/json": components["schemas"]["GroupApiView"];
|
|
1041
|
+
};
|
|
1042
|
+
};
|
|
1043
|
+
400: components["responses"]["BadRequest"];
|
|
1044
|
+
401: components["responses"]["Unauthorized"];
|
|
1045
|
+
404: components["responses"]["NotFound"];
|
|
1046
|
+
429: components["responses"]["TooManyRequests"];
|
|
1047
|
+
};
|
|
1048
|
+
};
|
|
1049
|
+
listGroupMembers: {
|
|
1050
|
+
parameters: {
|
|
1051
|
+
query?: {
|
|
1052
|
+
/** @description next_cursor from the previous page. */
|
|
1053
|
+
cursor?: string;
|
|
1054
|
+
/** @description 1-200, default 50. */
|
|
1055
|
+
limit?: number;
|
|
1056
|
+
};
|
|
1057
|
+
header?: never;
|
|
1058
|
+
path: {
|
|
1059
|
+
/** @description Group id. */
|
|
1060
|
+
id: string;
|
|
1061
|
+
/** @description The project's slug. */
|
|
1062
|
+
project: components["parameters"]["Project"];
|
|
1063
|
+
};
|
|
1064
|
+
cookie?: never;
|
|
1065
|
+
};
|
|
1066
|
+
requestBody?: never;
|
|
1067
|
+
responses: {
|
|
1068
|
+
/** @description One page. */
|
|
1069
|
+
200: {
|
|
1070
|
+
headers: {
|
|
1071
|
+
[name: string]: unknown;
|
|
1072
|
+
};
|
|
1073
|
+
content: {
|
|
1074
|
+
"application/json": components["schemas"]["GroupMemberPage"];
|
|
1075
|
+
};
|
|
1076
|
+
};
|
|
1077
|
+
400: components["responses"]["BadRequest"];
|
|
1078
|
+
401: components["responses"]["Unauthorized"];
|
|
1079
|
+
404: components["responses"]["NotFound"];
|
|
1080
|
+
429: components["responses"]["TooManyRequests"];
|
|
1081
|
+
};
|
|
1082
|
+
};
|
|
1083
|
+
addGroupMembers: {
|
|
1084
|
+
parameters: {
|
|
1085
|
+
query?: never;
|
|
1086
|
+
header?: never;
|
|
1087
|
+
path: {
|
|
1088
|
+
/** @description Group id. */
|
|
1089
|
+
id: string;
|
|
1090
|
+
/** @description The project's slug. */
|
|
1091
|
+
project: components["parameters"]["Project"];
|
|
1092
|
+
};
|
|
1093
|
+
cookie?: never;
|
|
1094
|
+
};
|
|
1095
|
+
requestBody: {
|
|
1096
|
+
content: {
|
|
1097
|
+
"application/json": components["schemas"]["GroupMembersRequest"];
|
|
1098
|
+
};
|
|
1099
|
+
};
|
|
1100
|
+
responses: {
|
|
1101
|
+
/** @description How many were added. */
|
|
1102
|
+
200: {
|
|
1103
|
+
headers: {
|
|
1104
|
+
[name: string]: unknown;
|
|
1105
|
+
};
|
|
1106
|
+
content: {
|
|
1107
|
+
"application/json": components["schemas"]["GroupMembersResponse"];
|
|
1108
|
+
};
|
|
1109
|
+
};
|
|
1110
|
+
400: components["responses"]["BadRequest"];
|
|
1111
|
+
401: components["responses"]["Unauthorized"];
|
|
1112
|
+
404: components["responses"]["NotFound"];
|
|
1113
|
+
429: components["responses"]["TooManyRequests"];
|
|
1114
|
+
};
|
|
1115
|
+
};
|
|
1116
|
+
removeGroupMember: {
|
|
1117
|
+
parameters: {
|
|
1118
|
+
query?: never;
|
|
1119
|
+
header?: never;
|
|
1120
|
+
path: {
|
|
1121
|
+
/** @description Group id. */
|
|
1122
|
+
id: string;
|
|
1123
|
+
/** @description The number, URL-encoded (`%2B14155550123`). */
|
|
1124
|
+
phone: string;
|
|
1125
|
+
/** @description The project's slug. */
|
|
1126
|
+
project: components["parameters"]["Project"];
|
|
1127
|
+
};
|
|
1128
|
+
cookie?: never;
|
|
1129
|
+
};
|
|
1130
|
+
requestBody?: never;
|
|
1131
|
+
responses: {
|
|
1132
|
+
/** @description Removed. */
|
|
1133
|
+
204: {
|
|
1134
|
+
headers: {
|
|
1135
|
+
[name: string]: unknown;
|
|
1136
|
+
};
|
|
1137
|
+
content?: never;
|
|
1138
|
+
};
|
|
1139
|
+
400: components["responses"]["BadRequest"];
|
|
1140
|
+
401: components["responses"]["Unauthorized"];
|
|
1141
|
+
404: components["responses"]["NotFound"];
|
|
1142
|
+
429: components["responses"]["TooManyRequests"];
|
|
1143
|
+
};
|
|
1144
|
+
};
|
|
1145
|
+
listMessages: {
|
|
1146
|
+
parameters: {
|
|
1147
|
+
query?: {
|
|
1148
|
+
/** @description Only this batch. */
|
|
1149
|
+
batch_id?: string;
|
|
1150
|
+
/** @description `next_cursor` from the previous page. */
|
|
1151
|
+
cursor?: string;
|
|
1152
|
+
/** @description Received at or after (ISO 8601). */
|
|
1153
|
+
from?: string;
|
|
1154
|
+
/** @description Page size. */
|
|
1155
|
+
limit?: number;
|
|
1156
|
+
/** @description Only this status. */
|
|
1157
|
+
status?: components["schemas"]["MessageStatus"];
|
|
1158
|
+
/** @description Only messages with this tag. */
|
|
1159
|
+
tag?: string;
|
|
1160
|
+
/** @description Recipient number, or part of it. */
|
|
1161
|
+
to?: string;
|
|
1162
|
+
/** @description Only this type. */
|
|
1163
|
+
type?: components["schemas"]["MessageType"];
|
|
1164
|
+
/** @description Received before (ISO 8601). */
|
|
1165
|
+
until?: string;
|
|
1166
|
+
};
|
|
1167
|
+
header?: never;
|
|
1168
|
+
path: {
|
|
1169
|
+
/** @description The project's slug. */
|
|
1170
|
+
project: components["parameters"]["Project"];
|
|
1171
|
+
};
|
|
1172
|
+
cookie?: never;
|
|
1173
|
+
};
|
|
1174
|
+
requestBody?: never;
|
|
1175
|
+
responses: {
|
|
1176
|
+
/** @description One page. */
|
|
1177
|
+
200: {
|
|
1178
|
+
headers: {
|
|
1179
|
+
[name: string]: unknown;
|
|
1180
|
+
};
|
|
1181
|
+
content: {
|
|
1182
|
+
"application/json": components["schemas"]["MessagePage"];
|
|
1183
|
+
};
|
|
1184
|
+
};
|
|
1185
|
+
400: components["responses"]["BadRequest"];
|
|
1186
|
+
401: components["responses"]["Unauthorized"];
|
|
1187
|
+
404: components["responses"]["NotFound"];
|
|
1188
|
+
429: components["responses"]["TooManyRequests"];
|
|
1189
|
+
};
|
|
1190
|
+
};
|
|
1191
|
+
sendMessage: {
|
|
1192
|
+
parameters: {
|
|
1193
|
+
query?: never;
|
|
1194
|
+
header?: {
|
|
1195
|
+
/** @description Repeating a request with the same key returns the first message instead of sending again. */
|
|
1196
|
+
"Idempotency-Key"?: string;
|
|
1197
|
+
};
|
|
1198
|
+
path: {
|
|
1199
|
+
/** @description The project's slug. */
|
|
1200
|
+
project: components["parameters"]["Project"];
|
|
1201
|
+
};
|
|
1202
|
+
cookie?: never;
|
|
1203
|
+
};
|
|
1204
|
+
requestBody: {
|
|
1205
|
+
content: {
|
|
1206
|
+
"application/json": components["schemas"]["SendMessageRequest"];
|
|
1207
|
+
};
|
|
1208
|
+
};
|
|
1209
|
+
responses: {
|
|
1210
|
+
/** @description Queued for the phone. */
|
|
1211
|
+
202: {
|
|
1212
|
+
headers: {
|
|
1213
|
+
/** @description `true` when this is a replay of an earlier request. */
|
|
1214
|
+
"Idempotent-Replayed"?: string;
|
|
1215
|
+
[name: string]: unknown;
|
|
1216
|
+
};
|
|
1217
|
+
content: {
|
|
1218
|
+
"application/json": components["schemas"]["MessageView"];
|
|
1219
|
+
};
|
|
1220
|
+
};
|
|
1221
|
+
400: components["responses"]["BadRequest"];
|
|
1222
|
+
401: components["responses"]["Unauthorized"];
|
|
1223
|
+
404: components["responses"]["NotFound"];
|
|
1224
|
+
429: components["responses"]["TooManyRequests"];
|
|
1225
|
+
};
|
|
1226
|
+
};
|
|
1227
|
+
getMessage: {
|
|
1228
|
+
parameters: {
|
|
1229
|
+
query?: never;
|
|
1230
|
+
header?: never;
|
|
1231
|
+
path: {
|
|
1232
|
+
/** @description Message id (`msg_…`). */
|
|
1233
|
+
id: string;
|
|
1234
|
+
/** @description The project's slug. */
|
|
1235
|
+
project: components["parameters"]["Project"];
|
|
1236
|
+
};
|
|
1237
|
+
cookie?: never;
|
|
1238
|
+
};
|
|
1239
|
+
requestBody?: never;
|
|
1240
|
+
responses: {
|
|
1241
|
+
/** @description The message. */
|
|
1242
|
+
200: {
|
|
1243
|
+
headers: {
|
|
1244
|
+
[name: string]: unknown;
|
|
1245
|
+
};
|
|
1246
|
+
content: {
|
|
1247
|
+
"application/json": components["schemas"]["MessageView"];
|
|
1248
|
+
};
|
|
1249
|
+
};
|
|
1250
|
+
400: components["responses"]["BadRequest"];
|
|
1251
|
+
401: components["responses"]["Unauthorized"];
|
|
1252
|
+
404: components["responses"]["NotFound"];
|
|
1253
|
+
429: components["responses"]["TooManyRequests"];
|
|
1254
|
+
};
|
|
1255
|
+
};
|
|
1256
|
+
cancelMessage: {
|
|
1257
|
+
parameters: {
|
|
1258
|
+
query?: never;
|
|
1259
|
+
header?: never;
|
|
1260
|
+
path: {
|
|
1261
|
+
/** @description Message id (`msg_…`). */
|
|
1262
|
+
id: string;
|
|
1263
|
+
/** @description The project's slug. */
|
|
1264
|
+
project: components["parameters"]["Project"];
|
|
1265
|
+
};
|
|
1266
|
+
cookie?: never;
|
|
1267
|
+
};
|
|
1268
|
+
requestBody?: never;
|
|
1269
|
+
responses: {
|
|
1270
|
+
/** @description The cancelled message. */
|
|
1271
|
+
200: {
|
|
1272
|
+
headers: {
|
|
1273
|
+
[name: string]: unknown;
|
|
1274
|
+
};
|
|
1275
|
+
content: {
|
|
1276
|
+
"application/json": components["schemas"]["MessageView"];
|
|
1277
|
+
};
|
|
1278
|
+
};
|
|
1279
|
+
400: components["responses"]["BadRequest"];
|
|
1280
|
+
401: components["responses"]["Unauthorized"];
|
|
1281
|
+
404: components["responses"]["NotFound"];
|
|
1282
|
+
429: components["responses"]["TooManyRequests"];
|
|
1283
|
+
};
|
|
1284
|
+
};
|
|
1285
|
+
sendBulk: {
|
|
1286
|
+
parameters: {
|
|
1287
|
+
query?: never;
|
|
1288
|
+
header?: never;
|
|
1289
|
+
path: {
|
|
1290
|
+
/** @description The project's slug. */
|
|
1291
|
+
project: components["parameters"]["Project"];
|
|
1292
|
+
};
|
|
1293
|
+
cookie?: never;
|
|
1294
|
+
};
|
|
1295
|
+
requestBody: {
|
|
1296
|
+
content: {
|
|
1297
|
+
"application/json": components["schemas"]["BulkSendRequest"];
|
|
1298
|
+
};
|
|
1299
|
+
};
|
|
1300
|
+
responses: {
|
|
1301
|
+
/** @description Batch queued. */
|
|
1302
|
+
202: {
|
|
1303
|
+
headers: {
|
|
1304
|
+
[name: string]: unknown;
|
|
1305
|
+
};
|
|
1306
|
+
content: {
|
|
1307
|
+
"application/json": components["schemas"]["BulkSendResponse"];
|
|
1308
|
+
};
|
|
1309
|
+
};
|
|
1310
|
+
400: components["responses"]["BadRequest"];
|
|
1311
|
+
401: components["responses"]["Unauthorized"];
|
|
1312
|
+
404: components["responses"]["NotFound"];
|
|
1313
|
+
429: components["responses"]["TooManyRequests"];
|
|
1314
|
+
};
|
|
1315
|
+
};
|
|
1316
|
+
sendOtp: {
|
|
1317
|
+
parameters: {
|
|
1318
|
+
query?: never;
|
|
1319
|
+
header?: never;
|
|
1320
|
+
path: {
|
|
1321
|
+
/** @description The project's slug. */
|
|
1322
|
+
project: components["parameters"]["Project"];
|
|
1323
|
+
};
|
|
1324
|
+
cookie?: never;
|
|
1325
|
+
};
|
|
1326
|
+
requestBody: {
|
|
1327
|
+
content: {
|
|
1328
|
+
"application/json": components["schemas"]["OtpRequest"];
|
|
1329
|
+
};
|
|
1330
|
+
};
|
|
1331
|
+
responses: {
|
|
1332
|
+
/** @description Code sent. */
|
|
1333
|
+
202: {
|
|
1334
|
+
headers: {
|
|
1335
|
+
[name: string]: unknown;
|
|
1336
|
+
};
|
|
1337
|
+
content: {
|
|
1338
|
+
"application/json": components["schemas"]["OtpResponse"];
|
|
1339
|
+
};
|
|
1340
|
+
};
|
|
1341
|
+
400: components["responses"]["BadRequest"];
|
|
1342
|
+
401: components["responses"]["Unauthorized"];
|
|
1343
|
+
404: components["responses"]["NotFound"];
|
|
1344
|
+
429: components["responses"]["TooManyRequests"];
|
|
1345
|
+
};
|
|
1346
|
+
};
|
|
1347
|
+
verifyOtp: {
|
|
1348
|
+
parameters: {
|
|
1349
|
+
query?: never;
|
|
1350
|
+
header?: never;
|
|
1351
|
+
path: {
|
|
1352
|
+
/** @description The project's slug. */
|
|
1353
|
+
project: components["parameters"]["Project"];
|
|
1354
|
+
};
|
|
1355
|
+
cookie?: never;
|
|
1356
|
+
};
|
|
1357
|
+
requestBody: {
|
|
1358
|
+
content: {
|
|
1359
|
+
"application/json": components["schemas"]["OtpVerifyRequest"];
|
|
1360
|
+
};
|
|
1361
|
+
};
|
|
1362
|
+
responses: {
|
|
1363
|
+
/** @description Whether the code is right, and why not. */
|
|
1364
|
+
200: {
|
|
1365
|
+
headers: {
|
|
1366
|
+
[name: string]: unknown;
|
|
1367
|
+
};
|
|
1368
|
+
content: {
|
|
1369
|
+
"application/json": components["schemas"]["OtpVerifyResponse"];
|
|
1370
|
+
};
|
|
1371
|
+
};
|
|
1372
|
+
400: components["responses"]["BadRequest"];
|
|
1373
|
+
401: components["responses"]["Unauthorized"];
|
|
1374
|
+
404: components["responses"]["NotFound"];
|
|
1375
|
+
429: components["responses"]["TooManyRequests"];
|
|
1376
|
+
};
|
|
1377
|
+
};
|
|
1378
|
+
listSchedules: {
|
|
1379
|
+
parameters: {
|
|
1380
|
+
query?: never;
|
|
1381
|
+
header?: never;
|
|
1382
|
+
path: {
|
|
1383
|
+
/** @description The project's slug. */
|
|
1384
|
+
project: components["parameters"]["Project"];
|
|
1385
|
+
};
|
|
1386
|
+
cookie?: never;
|
|
1387
|
+
};
|
|
1388
|
+
requestBody?: never;
|
|
1389
|
+
responses: {
|
|
1390
|
+
/** @description All of them. */
|
|
1391
|
+
200: {
|
|
1392
|
+
headers: {
|
|
1393
|
+
[name: string]: unknown;
|
|
1394
|
+
};
|
|
1395
|
+
content: {
|
|
1396
|
+
"application/json": components["schemas"]["SchedulePage"];
|
|
1397
|
+
};
|
|
1398
|
+
};
|
|
1399
|
+
400: components["responses"]["BadRequest"];
|
|
1400
|
+
401: components["responses"]["Unauthorized"];
|
|
1401
|
+
404: components["responses"]["NotFound"];
|
|
1402
|
+
429: components["responses"]["TooManyRequests"];
|
|
1403
|
+
};
|
|
1404
|
+
};
|
|
1405
|
+
createSchedule: {
|
|
1406
|
+
parameters: {
|
|
1407
|
+
query?: never;
|
|
1408
|
+
header?: never;
|
|
1409
|
+
path: {
|
|
1410
|
+
/** @description The project's slug. */
|
|
1411
|
+
project: components["parameters"]["Project"];
|
|
1412
|
+
};
|
|
1413
|
+
cookie?: never;
|
|
1414
|
+
};
|
|
1415
|
+
requestBody: {
|
|
1416
|
+
content: {
|
|
1417
|
+
"application/json": components["schemas"]["ScheduleRequest"];
|
|
1418
|
+
};
|
|
1419
|
+
};
|
|
1420
|
+
responses: {
|
|
1421
|
+
/** @description Created. */
|
|
1422
|
+
201: {
|
|
1423
|
+
headers: {
|
|
1424
|
+
[name: string]: unknown;
|
|
1425
|
+
};
|
|
1426
|
+
content: {
|
|
1427
|
+
"application/json": components["schemas"]["ScheduleView"];
|
|
1428
|
+
};
|
|
1429
|
+
};
|
|
1430
|
+
400: components["responses"]["BadRequest"];
|
|
1431
|
+
401: components["responses"]["Unauthorized"];
|
|
1432
|
+
404: components["responses"]["NotFound"];
|
|
1433
|
+
429: components["responses"]["TooManyRequests"];
|
|
1434
|
+
};
|
|
1435
|
+
};
|
|
1436
|
+
getSchedule: {
|
|
1437
|
+
parameters: {
|
|
1438
|
+
query?: never;
|
|
1439
|
+
header?: never;
|
|
1440
|
+
path: {
|
|
1441
|
+
/** @description Schedule id. */
|
|
1442
|
+
id: string;
|
|
1443
|
+
/** @description The project's slug. */
|
|
1444
|
+
project: components["parameters"]["Project"];
|
|
1445
|
+
};
|
|
1446
|
+
cookie?: never;
|
|
1447
|
+
};
|
|
1448
|
+
requestBody?: never;
|
|
1449
|
+
responses: {
|
|
1450
|
+
/** @description The schedule. */
|
|
1451
|
+
200: {
|
|
1452
|
+
headers: {
|
|
1453
|
+
[name: string]: unknown;
|
|
1454
|
+
};
|
|
1455
|
+
content: {
|
|
1456
|
+
"application/json": components["schemas"]["ScheduleView"];
|
|
1457
|
+
};
|
|
1458
|
+
};
|
|
1459
|
+
400: components["responses"]["BadRequest"];
|
|
1460
|
+
401: components["responses"]["Unauthorized"];
|
|
1461
|
+
404: components["responses"]["NotFound"];
|
|
1462
|
+
429: components["responses"]["TooManyRequests"];
|
|
1463
|
+
};
|
|
1464
|
+
};
|
|
1465
|
+
deleteSchedule: {
|
|
1466
|
+
parameters: {
|
|
1467
|
+
query?: never;
|
|
1468
|
+
header?: never;
|
|
1469
|
+
path: {
|
|
1470
|
+
/** @description Schedule id. */
|
|
1471
|
+
id: string;
|
|
1472
|
+
/** @description The project's slug. */
|
|
1473
|
+
project: components["parameters"]["Project"];
|
|
1474
|
+
};
|
|
1475
|
+
cookie?: never;
|
|
1476
|
+
};
|
|
1477
|
+
requestBody?: never;
|
|
1478
|
+
responses: {
|
|
1479
|
+
/** @description Deleted. */
|
|
1480
|
+
204: {
|
|
1481
|
+
headers: {
|
|
1482
|
+
[name: string]: unknown;
|
|
1483
|
+
};
|
|
1484
|
+
content?: never;
|
|
1485
|
+
};
|
|
1486
|
+
400: components["responses"]["BadRequest"];
|
|
1487
|
+
401: components["responses"]["Unauthorized"];
|
|
1488
|
+
404: components["responses"]["NotFound"];
|
|
1489
|
+
429: components["responses"]["TooManyRequests"];
|
|
1490
|
+
};
|
|
1491
|
+
};
|
|
1492
|
+
updateSchedule: {
|
|
1493
|
+
parameters: {
|
|
1494
|
+
query?: never;
|
|
1495
|
+
header?: never;
|
|
1496
|
+
path: {
|
|
1497
|
+
/** @description Schedule id. */
|
|
1498
|
+
id: string;
|
|
1499
|
+
/** @description The project's slug. */
|
|
1500
|
+
project: components["parameters"]["Project"];
|
|
1501
|
+
};
|
|
1502
|
+
cookie?: never;
|
|
1503
|
+
};
|
|
1504
|
+
requestBody: {
|
|
1505
|
+
content: {
|
|
1506
|
+
"application/json": components["schemas"]["ScheduleUpdate"];
|
|
1507
|
+
};
|
|
1508
|
+
};
|
|
1509
|
+
responses: {
|
|
1510
|
+
/** @description The updated schedule. */
|
|
1511
|
+
200: {
|
|
1512
|
+
headers: {
|
|
1513
|
+
[name: string]: unknown;
|
|
1514
|
+
};
|
|
1515
|
+
content: {
|
|
1516
|
+
"application/json": components["schemas"]["ScheduleView"];
|
|
1517
|
+
};
|
|
1518
|
+
};
|
|
1519
|
+
400: components["responses"]["BadRequest"];
|
|
1520
|
+
401: components["responses"]["Unauthorized"];
|
|
1521
|
+
404: components["responses"]["NotFound"];
|
|
1522
|
+
429: components["responses"]["TooManyRequests"];
|
|
1523
|
+
};
|
|
1524
|
+
};
|
|
1525
|
+
getStatus: {
|
|
1526
|
+
parameters: {
|
|
1527
|
+
query?: never;
|
|
1528
|
+
header?: never;
|
|
1529
|
+
path: {
|
|
1530
|
+
/** @description The project's slug. */
|
|
1531
|
+
project: components["parameters"]["Project"];
|
|
1532
|
+
};
|
|
1533
|
+
cookie?: never;
|
|
1534
|
+
};
|
|
1535
|
+
requestBody?: never;
|
|
1536
|
+
responses: {
|
|
1537
|
+
/** @description The status. */
|
|
1538
|
+
200: {
|
|
1539
|
+
headers: {
|
|
1540
|
+
[name: string]: unknown;
|
|
1541
|
+
};
|
|
1542
|
+
content: {
|
|
1543
|
+
"application/json": components["schemas"]["ProjectStatus"];
|
|
1544
|
+
};
|
|
1545
|
+
};
|
|
1546
|
+
400: components["responses"]["BadRequest"];
|
|
1547
|
+
401: components["responses"]["Unauthorized"];
|
|
1548
|
+
404: components["responses"]["NotFound"];
|
|
1549
|
+
429: components["responses"]["TooManyRequests"];
|
|
1550
|
+
};
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
type S = components['schemas'];
|
|
1555
|
+
type MessageType = S['MessageType'];
|
|
1556
|
+
type MessageStatus = S['MessageStatus'];
|
|
1557
|
+
type SendMessageParams = S['SendMessageRequest'];
|
|
1558
|
+
type BulkItem = S['BulkItem'];
|
|
1559
|
+
type SendBulkParams = S['BulkSendRequest'];
|
|
1560
|
+
type Message = S['MessageView'];
|
|
1561
|
+
type MessagePage = S['MessagePage'];
|
|
1562
|
+
type BulkResult = S['BulkSendResponse'];
|
|
1563
|
+
type RejectedItem = S['RejectedItem'];
|
|
1564
|
+
type ListMessagesParams = NonNullable<operations['listMessages']['parameters']['query']>;
|
|
1565
|
+
type SendOtpParams = S['OtpRequest'];
|
|
1566
|
+
type Otp = S['OtpResponse'];
|
|
1567
|
+
type VerifyOtpParams = S['OtpVerifyRequest'];
|
|
1568
|
+
type OtpVerification = S['OtpVerifyResponse'];
|
|
1569
|
+
type OtpFailure = S['OtpFailure'];
|
|
1570
|
+
type CreateScheduleParams = S['ScheduleRequest'];
|
|
1571
|
+
type UpdateScheduleParams = S['ScheduleUpdate'];
|
|
1572
|
+
type Schedule = S['ScheduleView'];
|
|
1573
|
+
type ScheduleRun = S['ScheduleRunView'];
|
|
1574
|
+
type SchedulePage = S['SchedulePage'];
|
|
1575
|
+
type CreateCampaignParams = S['CampaignRequest'];
|
|
1576
|
+
type UpdateCampaignParams = S['CampaignUpdate'];
|
|
1577
|
+
type Campaign = S['CampaignApiView'];
|
|
1578
|
+
type CampaignList = S['CampaignList'];
|
|
1579
|
+
type CampaignStatus = S['CampaignApiStatus'];
|
|
1580
|
+
type CampaignRun = S['CampaignRunView'];
|
|
1581
|
+
type CampaignResults = S['CampaignResultsView'];
|
|
1582
|
+
type CampaignPreview = S['CampaignPreviewResponse'];
|
|
1583
|
+
type CampaignSendResult = S['CampaignSendResponse'];
|
|
1584
|
+
type CreateGroupParams = S['GroupRequest'];
|
|
1585
|
+
type UpdateGroupParams = S['GroupUpdate'];
|
|
1586
|
+
type Group = S['GroupApiView'];
|
|
1587
|
+
type GroupList = S['GroupList'];
|
|
1588
|
+
type GroupMemberInput = S['GroupMemberInput'];
|
|
1589
|
+
type GroupMember = S['GroupMemberView'];
|
|
1590
|
+
type GroupMemberPage = S['GroupMemberPage'];
|
|
1591
|
+
type AddMembersResult = S['GroupMembersResponse'];
|
|
1592
|
+
type ListMembersParams = NonNullable<operations['listGroupMembers']['parameters']['query']>;
|
|
1593
|
+
type StatusEvent = S['StatusWebhookPayload'];
|
|
1594
|
+
type ReceivedEvent = S['InboundWebhookPayload'];
|
|
1595
|
+
type GroupJoinedEvent = S['GroupJoinedWebhookPayload'];
|
|
1596
|
+
type AlertEvent = S['AlertWebhookPayload'];
|
|
1597
|
+
/** Anything POSTed to a webhook; narrow on `event`. */
|
|
1598
|
+
type WebhookEvent = StatusEvent | ReceivedEvent | GroupJoinedEvent | AlertEvent;
|
|
1599
|
+
|
|
1600
|
+
type Call = <T>(req: Request) => Promise<T>;
|
|
1601
|
+
interface SendOptions {
|
|
1602
|
+
/**
|
|
1603
|
+
* Repeating a send with the same key returns the first message instead of sending again.
|
|
1604
|
+
* Defaults to a fresh random key, so the SDK's own retries never send twice; pass your own
|
|
1605
|
+
* (an order id, say) to make your retries safe too.
|
|
1606
|
+
*/
|
|
1607
|
+
idempotencyKey?: string;
|
|
1608
|
+
}
|
|
1609
|
+
declare class Messages {
|
|
1610
|
+
private readonly call;
|
|
1611
|
+
private readonly base;
|
|
1612
|
+
constructor(call: Call, base: string);
|
|
1613
|
+
/** Queues one SMS for the project's phone. */
|
|
1614
|
+
send(params: SendMessageParams, options?: SendOptions): Promise<Message>;
|
|
1615
|
+
/** Queues a batch. Invalid or opted-out items come back in `rejected`; the rest go out as one batch. */
|
|
1616
|
+
sendBulk(params: SendBulkParams): Promise<BulkResult>;
|
|
1617
|
+
get(id: string): Promise<Message>;
|
|
1618
|
+
/** Stops a message that hasn't reached a phone yet. */
|
|
1619
|
+
cancel(id: string): Promise<Message>;
|
|
1620
|
+
/** One page, newest first. Pass `next_cursor` back as `cursor` for the next. */
|
|
1621
|
+
list(params?: ListMessagesParams): Promise<MessagePage>;
|
|
1622
|
+
/** Every matching message, newest first, fetching pages as you go. */
|
|
1623
|
+
listAll(params?: Omit<ListMessagesParams, 'cursor'>): AsyncGenerator<Message>;
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
declare class OneTimeCodes {
|
|
1627
|
+
private readonly call;
|
|
1628
|
+
private readonly base;
|
|
1629
|
+
constructor(call: Call, base: string);
|
|
1630
|
+
/** Texts a fresh code to `to`. Keep the returned `id` for verify(). */
|
|
1631
|
+
send(params: SendOtpParams): Promise<Otp>;
|
|
1632
|
+
/** Checks what the user typed. `valid` is false with a `reason` when it's wrong, expired or used. */
|
|
1633
|
+
verify(params: VerifyOtpParams): Promise<OtpVerification>;
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
/**
|
|
1637
|
+
* Campaigns: a send with a name, an audience, who to leave out and when. A campaign is made as a
|
|
1638
|
+
* draft and nothing goes out until `send`, so an audience can be built up over several calls and
|
|
1639
|
+
* checked with `preview` first. Each run is an ordinary batch.
|
|
1640
|
+
*/
|
|
1641
|
+
declare class Campaigns {
|
|
1642
|
+
private readonly call;
|
|
1643
|
+
private readonly base;
|
|
1644
|
+
constructor(call: Call, base: string);
|
|
1645
|
+
/**
|
|
1646
|
+
* Makes a draft. Marketing needs `consent: true` -- that the recipients agreed to hear from
|
|
1647
|
+
* you -- and `stop_footer` ends every marketing message with your opt-out line. With `cron` it
|
|
1648
|
+
* repeats instead of sending once.
|
|
1649
|
+
*/
|
|
1650
|
+
create(params: CreateCampaignParams): Promise<Campaign>;
|
|
1651
|
+
list(): Promise<CampaignList>;
|
|
1652
|
+
get(id: string): Promise<Campaign>;
|
|
1653
|
+
/** Absent fields stay as they are, and the change reaches the runs still to come. */
|
|
1654
|
+
update(id: string, params: UpdateCampaignParams): Promise<Campaign>;
|
|
1655
|
+
/** The campaign goes; its runs stay in the message log. */
|
|
1656
|
+
delete(id: string): Promise<void>;
|
|
1657
|
+
/** Who it would reach right now: groups read, duplicates dropped, exclusions applied. */
|
|
1658
|
+
preview(id: string): Promise<CampaignPreview>;
|
|
1659
|
+
/** How it did: delivery, SMS parts, replies and the opt-outs it cost. */
|
|
1660
|
+
results(id: string): Promise<CampaignResults>;
|
|
1661
|
+
/** Starts it: `queued` with a batch, or `scheduled` when it waits for its time or its cron. */
|
|
1662
|
+
send(id: string): Promise<CampaignSendResult>;
|
|
1663
|
+
/** Holds every run still going, or lets them carry on. */
|
|
1664
|
+
control(id: string, status: 'running' | 'paused'): Promise<Campaign>;
|
|
1665
|
+
/** Stops it for good: what is still on the server is cancelled and refunded. */
|
|
1666
|
+
cancel(id: string): Promise<Campaign>;
|
|
1667
|
+
private one;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
/** The workspace's contact groups: every project's key sees the same ones. */
|
|
1671
|
+
declare class Groups {
|
|
1672
|
+
private readonly call;
|
|
1673
|
+
private readonly base;
|
|
1674
|
+
constructor(call: Call, base: string);
|
|
1675
|
+
/** With `keywords`, someone who texts one of them (the whole text) to a workspace phone joins. */
|
|
1676
|
+
create(params: CreateGroupParams): Promise<Group>;
|
|
1677
|
+
list(): Promise<GroupList>;
|
|
1678
|
+
get(id: string): Promise<Group>;
|
|
1679
|
+
/** Absent fields stay as they are; `keywords: []` turns joining by text off. */
|
|
1680
|
+
update(id: string, params: UpdateGroupParams): Promise<Group>;
|
|
1681
|
+
/** The group goes; its contacts stay. */
|
|
1682
|
+
delete(id: string): Promise<void>;
|
|
1683
|
+
/** One page of members, alphabetically; pass `next_cursor` back as `cursor` for the next. */
|
|
1684
|
+
listMembers(id: string, params?: ListMembersParams): Promise<GroupMemberPage>;
|
|
1685
|
+
/** Every member, fetching pages as you iterate. */
|
|
1686
|
+
listAllMembers(id: string, params?: Omit<ListMembersParams, 'cursor'>): AsyncGenerator<GroupMember>;
|
|
1687
|
+
/** Adds people by number; new numbers become contacts (a given name replaces theirs, fields merge). */
|
|
1688
|
+
addMembers(id: string, members: GroupMemberInput[]): Promise<AddMembersResult>;
|
|
1689
|
+
/** Takes the number out of the group; the contact stays. */
|
|
1690
|
+
removeMember(id: string, phone: string): Promise<void>;
|
|
1691
|
+
private one;
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
declare class Schedules {
|
|
1695
|
+
private readonly call;
|
|
1696
|
+
private readonly base;
|
|
1697
|
+
constructor(call: Call, base: string);
|
|
1698
|
+
/** A message (or batch) sent again and again on a cron schedule. */
|
|
1699
|
+
create(params: CreateScheduleParams): Promise<Schedule>;
|
|
1700
|
+
list(): Promise<SchedulePage>;
|
|
1701
|
+
/** One schedule, with its recent runs. */
|
|
1702
|
+
get(id: string): Promise<Schedule>;
|
|
1703
|
+
/** Absent fields stay as they are; recipients can't change. */
|
|
1704
|
+
update(id: string, params: UpdateScheduleParams): Promise<Schedule>;
|
|
1705
|
+
delete(id: string): Promise<void>;
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
interface VerifyOptions {
|
|
1709
|
+
/** Oldest (and furthest in the future) signature accepted, in seconds. Default 300. */
|
|
1710
|
+
tolerance?: number;
|
|
1711
|
+
/** The current time in unix seconds; for tests. */
|
|
1712
|
+
now?: number;
|
|
1713
|
+
}
|
|
1714
|
+
/** The header the signature arrives in. */
|
|
1715
|
+
declare const SIGNATURE_HEADER = "X-SMSWire-Signature";
|
|
1716
|
+
/**
|
|
1717
|
+
* Checks a webhook's X-SMSWire-Signature against the **raw** request body (not re-serialised JSON)
|
|
1718
|
+
* and returns the parsed event. Throws SMSWireSignatureError when the signature is missing,
|
|
1719
|
+
* wrong, or more than `tolerance` seconds off.
|
|
1720
|
+
*/
|
|
1721
|
+
declare function verifyWebhook(rawBody: string | Uint8Array | ArrayBuffer, signature: string | null | undefined, secret: string, options?: VerifyOptions): Promise<WebhookEvent>;
|
|
1722
|
+
|
|
1723
|
+
declare const VERSION = "0.2.0";
|
|
1724
|
+
interface ClientOptions {
|
|
1725
|
+
/** The project's API key (`smswire_live_…`). Defaults to SMSWIRE_KEY. */
|
|
1726
|
+
apiKey?: string;
|
|
1727
|
+
/** The project's slug, the part after /p/ in its endpoint. Defaults to SMSWIRE_PROJECT. */
|
|
1728
|
+
project?: string;
|
|
1729
|
+
/** Defaults to SMSWIRE_URL, then https://api.smswire.app. */
|
|
1730
|
+
baseUrl?: string;
|
|
1731
|
+
/** Signing secret (`whsec_…`) for webhooks.verify(). Defaults to SMSWIRE_WEBHOOK_SECRET. */
|
|
1732
|
+
webhookSecret?: string;
|
|
1733
|
+
/** Retries after a 429, a 5xx or a network error (see the README for which calls). Default 2. */
|
|
1734
|
+
maxRetries?: number;
|
|
1735
|
+
/** Longest Retry-After worth waiting for, in seconds; longer ones throw at once. Default 60. */
|
|
1736
|
+
maxRetryWait?: number;
|
|
1737
|
+
/** Per-attempt timeout in milliseconds. Default 30 000. */
|
|
1738
|
+
timeout?: number;
|
|
1739
|
+
/** A fetch implementation, for runtimes or tests that need their own. */
|
|
1740
|
+
fetch?: typeof fetch;
|
|
1741
|
+
}
|
|
1742
|
+
declare class SMSWire {
|
|
1743
|
+
readonly messages: Messages;
|
|
1744
|
+
readonly otp: OneTimeCodes;
|
|
1745
|
+
readonly schedules: Schedules;
|
|
1746
|
+
readonly groups: Groups;
|
|
1747
|
+
readonly campaigns: Campaigns;
|
|
1748
|
+
readonly webhooks: {
|
|
1749
|
+
verify(rawBody: string | Uint8Array | ArrayBuffer, signature: string | null | undefined, options?: VerifyOptions): Promise<WebhookEvent>;
|
|
1750
|
+
};
|
|
1751
|
+
constructor(options?: ClientOptions);
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
export { type AddMembersResult, type AlertEvent, type BulkItem, type BulkResult, type Campaign, type CampaignList, type CampaignPreview, type CampaignResults, type CampaignRun, type CampaignSendResult, type CampaignStatus, type ClientOptions, type CreateCampaignParams, type CreateGroupParams, type CreateScheduleParams, type Group, type GroupJoinedEvent, type GroupList, type GroupMember, type GroupMemberInput, type GroupMemberPage, type ListMembersParams, type ListMessagesParams, type Message, type MessagePage, type MessageStatus, type MessageType, type Otp, type OtpFailure, type OtpVerification, type ReceivedEvent, type RejectedItem, SIGNATURE_HEADER, SMSWire, SMSWireError, SMSWireSignatureError, type Schedule, type SchedulePage, type ScheduleRun, type SendBulkParams, type SendMessageParams, type SendOptions, type SendOtpParams, type StatusEvent, type UpdateCampaignParams, type UpdateGroupParams, type UpdateScheduleParams, VERSION, type VerifyOptions, type VerifyOtpParams, type WebhookEvent, SMSWire as default, verifyWebhook };
|