@izapai/sdk 0.0.0-stage → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +172 -2
  3. package/dist/client.d.ts +20 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +41 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/errors.d.ts +41 -0
  8. package/dist/errors.d.ts.map +1 -0
  9. package/dist/errors.js +67 -0
  10. package/dist/errors.js.map +1 -0
  11. package/dist/generated/client/client.gen.d.ts +3 -0
  12. package/dist/generated/client/client.gen.d.ts.map +1 -0
  13. package/dist/generated/client/client.gen.js +217 -0
  14. package/dist/generated/client/client.gen.js.map +1 -0
  15. package/dist/generated/client/index.d.ts +11 -0
  16. package/dist/generated/client/index.d.ts.map +1 -0
  17. package/dist/generated/client/index.js +7 -0
  18. package/dist/generated/client/index.js.map +1 -0
  19. package/dist/generated/client/types.gen.d.ts +121 -0
  20. package/dist/generated/client/types.gen.d.ts.map +1 -0
  21. package/dist/generated/client/types.gen.js +3 -0
  22. package/dist/generated/client/types.gen.js.map +1 -0
  23. package/dist/generated/client/utils.gen.d.ts +38 -0
  24. package/dist/generated/client/utils.gen.d.ts.map +1 -0
  25. package/dist/generated/client/utils.gen.js +229 -0
  26. package/dist/generated/client/utils.gen.js.map +1 -0
  27. package/dist/generated/client.gen.d.ts +13 -0
  28. package/dist/generated/client.gen.d.ts.map +1 -0
  29. package/dist/generated/client.gen.js +4 -0
  30. package/dist/generated/client.gen.js.map +1 -0
  31. package/dist/generated/core/auth.gen.d.ts +26 -0
  32. package/dist/generated/core/auth.gen.d.ts.map +1 -0
  33. package/dist/generated/core/auth.gen.js +15 -0
  34. package/dist/generated/core/auth.gen.js.map +1 -0
  35. package/dist/generated/core/bodySerializer.gen.d.ts +26 -0
  36. package/dist/generated/core/bodySerializer.gen.d.ts.map +1 -0
  37. package/dist/generated/core/bodySerializer.gen.js +58 -0
  38. package/dist/generated/core/bodySerializer.gen.js.map +1 -0
  39. package/dist/generated/core/params.gen.d.ts +44 -0
  40. package/dist/generated/core/params.gen.d.ts.map +1 -0
  41. package/dist/generated/core/params.gen.js +110 -0
  42. package/dist/generated/core/params.gen.js.map +1 -0
  43. package/dist/generated/core/pathSerializer.gen.d.ts +34 -0
  44. package/dist/generated/core/pathSerializer.gen.d.ts.map +1 -0
  45. package/dist/generated/core/pathSerializer.gen.js +107 -0
  46. package/dist/generated/core/pathSerializer.gen.js.map +1 -0
  47. package/dist/generated/core/queryKeySerializer.gen.d.ts +19 -0
  48. package/dist/generated/core/queryKeySerializer.gen.d.ts.map +1 -0
  49. package/dist/generated/core/queryKeySerializer.gen.js +93 -0
  50. package/dist/generated/core/queryKeySerializer.gen.js.map +1 -0
  51. package/dist/generated/core/serverSentEvents.gen.d.ts +72 -0
  52. package/dist/generated/core/serverSentEvents.gen.d.ts.map +1 -0
  53. package/dist/generated/core/serverSentEvents.gen.js +133 -0
  54. package/dist/generated/core/serverSentEvents.gen.js.map +1 -0
  55. package/dist/generated/core/types.gen.d.ts +84 -0
  56. package/dist/generated/core/types.gen.d.ts.map +1 -0
  57. package/dist/generated/core/types.gen.js +3 -0
  58. package/dist/generated/core/types.gen.js.map +1 -0
  59. package/dist/generated/core/utils.gen.d.ts +20 -0
  60. package/dist/generated/core/utils.gen.d.ts.map +1 -0
  61. package/dist/generated/core/utils.gen.js +88 -0
  62. package/dist/generated/core/utils.gen.js.map +1 -0
  63. package/dist/generated/index.d.ts +3 -0
  64. package/dist/generated/index.d.ts.map +1 -0
  65. package/dist/generated/index.js +3 -0
  66. package/dist/generated/index.js.map +1 -0
  67. package/dist/generated/sdk.gen.d.ts +420 -0
  68. package/dist/generated/sdk.gen.d.ts.map +1 -0
  69. package/dist/generated/sdk.gen.js +906 -0
  70. package/dist/generated/sdk.gen.js.map +1 -0
  71. package/dist/generated/types.gen.d.ts +5342 -0
  72. package/dist/generated/types.gen.d.ts.map +1 -0
  73. package/dist/generated/types.gen.js +3 -0
  74. package/dist/generated/types.gen.js.map +1 -0
  75. package/dist/index.d.ts +8 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +7 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/retry.d.ts +18 -0
  80. package/dist/retry.d.ts.map +1 -0
  81. package/dist/retry.js +84 -0
  82. package/dist/retry.js.map +1 -0
  83. package/dist/version.d.ts +2 -0
  84. package/dist/version.d.ts.map +1 -0
  85. package/dist/version.js +2 -0
  86. package/dist/version.js.map +1 -0
  87. package/dist/webhooks.d.ts +95 -0
  88. package/dist/webhooks.d.ts.map +1 -0
  89. package/dist/webhooks.js +153 -0
  90. package/dist/webhooks.js.map +1 -0
  91. package/package.json +60 -4
@@ -0,0 +1,906 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ import { client } from './client.gen.js';
3
+ import { formDataBodySerializer } from './client/index.js';
4
+ class HeyApiClient {
5
+ client;
6
+ constructor(args) {
7
+ this.client = args?.client ?? client;
8
+ }
9
+ }
10
+ class HeyApiRegistry {
11
+ defaultKey = 'default';
12
+ instances = new Map();
13
+ get(key) {
14
+ const instance = this.instances.get(key ?? this.defaultKey);
15
+ if (!instance) {
16
+ throw new Error(`No SDK client found. Create one with "new IzapApi()" to fix this error.`);
17
+ }
18
+ return instance;
19
+ }
20
+ set(value, key) {
21
+ this.instances.set(key ?? this.defaultKey, value);
22
+ }
23
+ }
24
+ export class IzapApi extends HeyApiClient {
25
+ static __registry = new HeyApiRegistry();
26
+ constructor(args) {
27
+ super(args);
28
+ IzapApi.__registry.set(this, args?.key);
29
+ }
30
+ /**
31
+ * Introspect the presented credential
32
+ *
33
+ * Resolves the credential on the request to its principal, or returns `401` if it is not valid. Accepts a JWT, a session cookie, a personal access token or a business API key — use it to confirm that a token is still good and who it belongs to.
34
+ */
35
+ introspectToken(options) {
36
+ return (options?.client ?? this.client).get({
37
+ security: [{ scheme: 'bearer', type: 'http' }],
38
+ url: '/api/v1/auth/token/introspect',
39
+ ...options
40
+ });
41
+ }
42
+ /**
43
+ * Create a business
44
+ *
45
+ * Creates a business together with its default settings, assistant and credentials. The authenticated user becomes its owner.
46
+ */
47
+ createBusiness(options) {
48
+ return (options.client ?? this.client).post({
49
+ security: [{ scheme: 'bearer', type: 'http' }],
50
+ url: '/api/v1/businesses',
51
+ ...options,
52
+ headers: {
53
+ 'Content-Type': 'application/json',
54
+ ...options.headers
55
+ }
56
+ });
57
+ }
58
+ /**
59
+ * Retrieve an assistant's contact filter
60
+ *
61
+ * Returns which contacts may trigger the assistant: the filter mode, and the numbers on its allowlist and blocklist. Messages from a contact the filter excludes are still received and stored, but the assistant is never invoked for them — no AI reply, greeting or off-hours message is sent.
62
+ */
63
+ getAssistantContactFilter(options) {
64
+ return (options.client ?? this.client).get({
65
+ security: [{ scheme: 'bearer', type: 'http' }],
66
+ url: '/api/v1/businesses/chatbots/{chatbot_id}/contact-filter',
67
+ ...options
68
+ });
69
+ }
70
+ /**
71
+ * Set an assistant's contact filter mode
72
+ *
73
+ * Chooses who may trigger the assistant: `off` (everyone), `allowlist` (only the numbers on the allowlist) or `blocklist` (everyone except the numbers on the blocklist). Takes effect on the next inbound message. Both lists are kept when the mode changes; an empty allowlist silences the assistant for every contact.
74
+ */
75
+ setAssistantContactFilterMode(options) {
76
+ return (options.client ?? this.client).put({
77
+ security: [{ scheme: 'bearer', type: 'http' }],
78
+ url: '/api/v1/businesses/chatbots/{chatbot_id}/contact-filter',
79
+ ...options,
80
+ headers: {
81
+ 'Content-Type': 'application/json',
82
+ ...options.headers
83
+ }
84
+ });
85
+ }
86
+ /**
87
+ * Add contacts to an assistant's contact filter
88
+ *
89
+ * Adds up to 500 phone numbers to the allowlist or blocklist in one call. Numbers are stored in canonical E.164 form, so different spellings of one number are one entry. Adding a number that is already listed is not an error; the response reports it separately, along with any input that is not a usable phone number.
90
+ */
91
+ addAssistantContactFilterEntries(options) {
92
+ return (options.client ?? this.client).post({
93
+ security: [{ scheme: 'bearer', type: 'http' }],
94
+ url: '/api/v1/businesses/chatbots/{chatbot_id}/contact-filter/entries',
95
+ ...options,
96
+ headers: {
97
+ 'Content-Type': 'application/json',
98
+ ...options.headers
99
+ }
100
+ });
101
+ }
102
+ /**
103
+ * Remove a contact from an assistant's contact filter
104
+ *
105
+ * Removes one entry from the list it is on. Takes effect on the next inbound message.
106
+ */
107
+ deleteAssistantContactFilterEntry(options) {
108
+ return (options.client ?? this.client).delete({
109
+ security: [{ scheme: 'bearer', type: 'http' }],
110
+ url: '/api/v1/businesses/chatbots/{chatbot_id}/contact-filter/entries/{entry_id}',
111
+ ...options
112
+ });
113
+ }
114
+ /**
115
+ * Retrieve a business
116
+ *
117
+ * Returns the business profile, including its opening hours, menus and assistants. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
118
+ */
119
+ getCurrentBusiness(options) {
120
+ return (options?.client ?? this.client).get({
121
+ security: [{ scheme: 'bearer', type: 'http' }],
122
+ url: '/api/v1/businesses/current',
123
+ ...options
124
+ });
125
+ }
126
+ /**
127
+ * Update a business
128
+ *
129
+ * Partially updates the business profile. Only the fields present in the request body are changed. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
130
+ */
131
+ updateCurrentBusiness(options) {
132
+ return (options.client ?? this.client).patch({
133
+ security: [{ scheme: 'bearer', type: 'http' }],
134
+ url: '/api/v1/businesses/current',
135
+ ...options,
136
+ headers: {
137
+ 'Content-Type': 'application/json',
138
+ ...options.headers
139
+ }
140
+ });
141
+ }
142
+ /**
143
+ * Retrieve opening hours
144
+ *
145
+ * Returns the opening hours grouped per weekday. These are the hours the assistant uses to decide whether the business is currently open. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
146
+ */
147
+ getCurrentBusinessHours(options) {
148
+ return (options?.client ?? this.client).get({
149
+ security: [{ scheme: 'bearer', type: 'http' }],
150
+ url: '/api/v1/businesses/hours',
151
+ ...options
152
+ });
153
+ }
154
+ /**
155
+ * Replace opening hours
156
+ *
157
+ * Replaces the whole week's opening hours in one call — a weekday omitted from the request is treated as closed. Changes take effect on live conversations immediately. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
158
+ */
159
+ updateCurrentBusinessHours(options) {
160
+ return (options.client ?? this.client).put({
161
+ security: [{ scheme: 'bearer', type: 'http' }],
162
+ url: '/api/v1/businesses/hours',
163
+ ...options,
164
+ headers: {
165
+ 'Content-Type': 'application/json',
166
+ ...options.headers
167
+ }
168
+ });
169
+ }
170
+ /**
171
+ * List library documents
172
+ *
173
+ * Returns the library documents and videos of the authenticated user's business, newest first, paged with `limit` and `offset`.
174
+ */
175
+ listBusinessLibraryDocuments(options) {
176
+ return (options?.client ?? this.client).get({
177
+ security: [{ scheme: 'bearer', type: 'http' }],
178
+ url: '/api/v1/businesses/library/documents',
179
+ ...options
180
+ });
181
+ }
182
+ /**
183
+ * Upload a library document
184
+ *
185
+ * Uploads a document or video to the library of the authenticated user's business so it can later be attached to messages. PDF, DOCX and MP4 are accepted; the type is read from the file's content, not its name.
186
+ */
187
+ uploadBusinessLibraryDocument(options) {
188
+ return (options.client ?? this.client).post({
189
+ ...formDataBodySerializer,
190
+ security: [{ scheme: 'bearer', type: 'http' }],
191
+ url: '/api/v1/businesses/library/documents',
192
+ ...options,
193
+ headers: {
194
+ 'Content-Type': null,
195
+ ...options.headers
196
+ }
197
+ });
198
+ }
199
+ /**
200
+ * Delete a library document
201
+ *
202
+ * Removes a document from the library. Messages already sent that referenced it are unaffected.
203
+ */
204
+ deleteBusinessLibraryDocument(options) {
205
+ return (options.client ?? this.client).delete({
206
+ security: [{ scheme: 'bearer', type: 'http' }],
207
+ url: '/api/v1/businesses/library/documents/{document_id}',
208
+ ...options
209
+ });
210
+ }
211
+ /**
212
+ * List library images
213
+ *
214
+ * Returns the library images of the authenticated user's business, newest first, paged with `limit` and `offset`.
215
+ */
216
+ listBusinessLibraryImages(options) {
217
+ return (options?.client ?? this.client).get({
218
+ security: [{ scheme: 'bearer', type: 'http' }],
219
+ url: '/api/v1/businesses/library/images',
220
+ ...options
221
+ });
222
+ }
223
+ /**
224
+ * Upload a library image
225
+ *
226
+ * Uploads an image to the library of the authenticated user's business so it can later be attached to messages. The business is taken from the credential; this operation accepts no business parameter.
227
+ */
228
+ uploadBusinessLibraryImage(options) {
229
+ return (options.client ?? this.client).post({
230
+ ...formDataBodySerializer,
231
+ security: [{ scheme: 'bearer', type: 'http' }],
232
+ url: '/api/v1/businesses/library/images',
233
+ ...options,
234
+ headers: {
235
+ 'Content-Type': null,
236
+ ...options.headers
237
+ }
238
+ });
239
+ }
240
+ /**
241
+ * Delete a library image
242
+ *
243
+ * Removes an image from the library. Messages already sent that referenced it are unaffected.
244
+ */
245
+ deleteBusinessLibraryImage(options) {
246
+ return (options.client ?? this.client).delete({
247
+ security: [{ scheme: 'bearer', type: 'http' }],
248
+ url: '/api/v1/businesses/library/images/{image_id}',
249
+ ...options
250
+ });
251
+ }
252
+ /**
253
+ * List the business menus
254
+ *
255
+ * Returns the product catalog menus published by the business named in the `business-id` header.
256
+ */
257
+ listBusinessMenus(options) {
258
+ return (options?.client ?? this.client).get({
259
+ security: [{ scheme: 'bearer', type: 'http' }],
260
+ url: '/api/v1/businesses/menus',
261
+ ...options
262
+ });
263
+ }
264
+ /**
265
+ * Create a menu
266
+ *
267
+ * Creates a product catalog menu for the business named in the `business-id` header.
268
+ */
269
+ createBusinessMenu(options) {
270
+ return (options.client ?? this.client).post({
271
+ security: [{ scheme: 'bearer', type: 'http' }],
272
+ url: '/api/v1/businesses/menus',
273
+ ...options,
274
+ headers: {
275
+ 'Content-Type': 'application/json',
276
+ ...options.headers
277
+ }
278
+ });
279
+ }
280
+ /**
281
+ * Update a menu
282
+ *
283
+ * Replaces the contents of an existing menu.
284
+ */
285
+ updateBusinessMenu(options) {
286
+ return (options.client ?? this.client).put({
287
+ security: [{ scheme: 'bearer', type: 'http' }],
288
+ url: '/api/v1/businesses/menus/{menu_id}',
289
+ ...options,
290
+ headers: {
291
+ 'Content-Type': 'application/json',
292
+ ...options.headers
293
+ }
294
+ });
295
+ }
296
+ /**
297
+ * List WhatsApp Cloud numbers
298
+ *
299
+ * Returns the WhatsApp Cloud numbers connected to the business, along with the assistant bound to each. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
300
+ */
301
+ listCurrentWhatsAppNumbers(options) {
302
+ return (options?.client ?? this.client).get({
303
+ security: [{ scheme: 'bearer', type: 'http' }],
304
+ url: '/api/v1/businesses/whatsapp_cloud/numbers',
305
+ ...options
306
+ });
307
+ }
308
+ /**
309
+ * Remove a number from iZap
310
+ *
311
+ * Disconnects a WhatsApp Cloud number from the platform: it stops reaching any assistant and its stored credentials are discarded. The number itself stays registered at Meta and can be connected again later. Conversation history is kept. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
312
+ */
313
+ deleteCurrentWhatsAppNumber(options) {
314
+ return (options.client ?? this.client).delete({
315
+ security: [{ scheme: 'bearer', type: 'http' }],
316
+ url: '/api/v1/businesses/whatsapp_cloud/numbers/{number_id}',
317
+ ...options
318
+ });
319
+ }
320
+ /**
321
+ * Bind an assistant to a number
322
+ *
323
+ * Points a connected number at one of the business's assistants. Inbound messages to that number are answered by the assistant bound here. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
324
+ */
325
+ setCurrentWhatsAppNumberAssistant(options) {
326
+ return (options.client ?? this.client).put({
327
+ security: [{ scheme: 'bearer', type: 'http' }],
328
+ url: '/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant',
329
+ ...options,
330
+ headers: {
331
+ 'Content-Type': 'application/json',
332
+ ...options.headers
333
+ }
334
+ });
335
+ }
336
+ /**
337
+ * Revoke iZap's access to a number at Meta
338
+ *
339
+ * Revokes iZap's access to the number at Meta and removes it from the platform. Unlike `deleteCurrentWhatsAppNumber`, which only disconnects the number from iZap, this also unsubscribes from the WhatsApp Business Account's webhooks at Meta and optionally deregisters the number from Cloud API entirely (`deregister`). Reconnecting requires a full Embedded Signup run. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
340
+ */
341
+ disconnectCurrentWhatsAppNumber(options) {
342
+ return (options.client ?? this.client).post({
343
+ security: [{ scheme: 'bearer', type: 'http' }],
344
+ url: '/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/disconnect',
345
+ ...options,
346
+ headers: {
347
+ 'Content-Type': 'application/json',
348
+ ...options.headers
349
+ }
350
+ });
351
+ }
352
+ /**
353
+ * Read a number's live status at Meta
354
+ *
355
+ * Fetches the number's current quality rating, verification state and status directly from Meta. Read-only. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
356
+ */
357
+ getCurrentWhatsAppNumberLiveStatus(options) {
358
+ return (options.client ?? this.client).get({
359
+ security: [{ scheme: 'bearer', type: 'http' }],
360
+ url: '/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/live',
361
+ ...options
362
+ });
363
+ }
364
+ /**
365
+ * Register a WhatsApp Cloud number
366
+ *
367
+ * Exchanges an Embedded Signup code and registers the WhatsApp Business Account in the background. Returns `202` with a `task_id`; poll the registration task until its status is `completed` or `failed`. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
368
+ */
369
+ registerCurrentWhatsAppNumber(options) {
370
+ return (options.client ?? this.client).post({
371
+ security: [{ scheme: 'bearer', type: 'http' }],
372
+ url: '/api/v1/businesses/whatsapp_cloud/register',
373
+ ...options,
374
+ headers: {
375
+ 'Content-Type': 'application/json',
376
+ ...options.headers
377
+ }
378
+ });
379
+ }
380
+ /**
381
+ * Check a number registration task
382
+ *
383
+ * Returns the progress of an asynchronous number registration. Read-only and safe to poll. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
384
+ */
385
+ getCurrentWhatsAppNumberRegistrationTask(options) {
386
+ return (options.client ?? this.client).get({
387
+ security: [{ scheme: 'bearer', type: 'http' }],
388
+ url: '/api/v1/businesses/whatsapp_cloud/register/tasks/{task_id}',
389
+ ...options
390
+ });
391
+ }
392
+ /**
393
+ * Send the product catalog
394
+ *
395
+ * Sends an interactive catalog message to a WhatsApp recipient. The catalog is the one linked to the business's WhatsApp Business Account in Meta's Commerce Manager. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
396
+ */
397
+ sendCurrentWhatsAppCatalog(options) {
398
+ return (options.client ?? this.client).post({
399
+ security: [{ scheme: 'bearer', type: 'http' }],
400
+ url: '/api/v1/businesses/whatsapp_cloud/send_catalog',
401
+ ...options,
402
+ headers: {
403
+ 'Content-Type': 'application/json',
404
+ ...options.headers
405
+ }
406
+ });
407
+ }
408
+ /**
409
+ * Read WhatsApp Business Account details
410
+ *
411
+ * Fetches business-verification details for the WhatsApp Business Account from Meta. The values are account-level, so they are the same for every number under the business. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
412
+ */
413
+ getCurrentWhatsAppBusinessAccountInfo(options) {
414
+ return (options?.client ?? this.client).get({
415
+ security: [{ scheme: 'bearer', type: 'http' }],
416
+ url: '/api/v1/businesses/whatsapp_cloud/waba_info',
417
+ ...options
418
+ });
419
+ }
420
+ /**
421
+ * List a business's chats
422
+ *
423
+ * Returns the business's conversations with paging, and optional filters for kind and assistant. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
424
+ */
425
+ listCurrentBusinessChats(options) {
426
+ return (options?.client ?? this.client).get({
427
+ security: [{ scheme: 'bearer', type: 'http' }],
428
+ url: '/api/v1/chats',
429
+ ...options
430
+ });
431
+ }
432
+ /**
433
+ * Create a sandbox chat
434
+ *
435
+ * Creates a trainer sandbox conversation for the business named in the `business-id` header. Sandbox chats exercise an assistant without messaging a real customer, and a business with no connected WhatsApp number may keep only a limited number of them.
436
+ */
437
+ createChat(options) {
438
+ return (options.client ?? this.client).post({
439
+ security: [{ scheme: 'bearer', type: 'http' }],
440
+ url: '/api/v1/chats',
441
+ ...options,
442
+ headers: {
443
+ 'Content-Type': 'application/json',
444
+ ...options.headers
445
+ }
446
+ });
447
+ }
448
+ /**
449
+ * Delete a chat
450
+ *
451
+ * Deletes the conversation. Deleting one that is already deleted returns `410`.
452
+ */
453
+ deleteChat(options) {
454
+ return (options.client ?? this.client).delete({
455
+ security: [{ scheme: 'bearer', type: 'http' }],
456
+ url: '/api/v1/chats/{chat_id}',
457
+ ...options
458
+ });
459
+ }
460
+ /**
461
+ * List a chat's messages
462
+ *
463
+ * Returns the conversation's messages newest first, with paging. Each message carries its author, content, timestamp and delivery status. Any chat id belonging to the conversation may be used.
464
+ */
465
+ listChatMessages(options) {
466
+ return (options.client ?? this.client).get({
467
+ security: [{ scheme: 'bearer', type: 'http' }],
468
+ url: '/api/v1/chats/{chat_id}/messages',
469
+ ...options
470
+ });
471
+ }
472
+ /**
473
+ * Send a message to a chat
474
+ *
475
+ * Sends a message as a human agent and stores it on the conversation. The assistant does not reply to messages sent this way. Attachments are supported.
476
+ */
477
+ sendChatMessage(options) {
478
+ return (options.client ?? this.client).post({
479
+ security: [{ scheme: 'bearer', type: 'http' }],
480
+ url: '/api/v1/chats/{chat_id}/messages',
481
+ ...options,
482
+ headers: {
483
+ 'Content-Type': 'application/json',
484
+ ...options.headers
485
+ }
486
+ });
487
+ }
488
+ /**
489
+ * Send a template message to a chat
490
+ *
491
+ * Sends an approved WhatsApp template into the conversation. This is the only way to reach a customer outside the 24-hour customer-service window. A rendered copy is stored so agents see what was sent.
492
+ */
493
+ sendChatTemplateMessage(options) {
494
+ return (options.client ?? this.client).post({
495
+ security: [{ scheme: 'bearer', type: 'http' }],
496
+ url: '/api/v1/chats/{chat_id}/messages/template',
497
+ ...options,
498
+ headers: {
499
+ 'Content-Type': 'application/json',
500
+ ...options.headers
501
+ }
502
+ });
503
+ }
504
+ /**
505
+ * Retrieve a message's details
506
+ *
507
+ * Returns one message with its delivery details, optionally including the replies generated in the same exchange. This operation only reads; it uses `POST` for historical reasons. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
508
+ */
509
+ getCurrentBusinessChatMessageDetails(options) {
510
+ return (options.client ?? this.client).post({
511
+ security: [{ scheme: 'bearer', type: 'http' }],
512
+ url: '/api/v1/chats/{chat_id}/messages/{message_id}',
513
+ ...options
514
+ });
515
+ }
516
+ /**
517
+ * Pause the assistant on a chat
518
+ *
519
+ * Stops the assistant answering automatically on this conversation so a human can take over. Incoming messages are still received and stored.
520
+ */
521
+ pauseChatAssistant(options) {
522
+ return (options.client ?? this.client).post({
523
+ security: [{ scheme: 'bearer', type: 'http' }],
524
+ url: '/api/v1/chats/{chat_id}/pause',
525
+ ...options,
526
+ headers: {
527
+ 'Content-Type': 'application/json',
528
+ ...options.headers
529
+ }
530
+ });
531
+ }
532
+ /**
533
+ * Check whether the assistant is paused
534
+ *
535
+ * Reports whether automatic replies are currently paused on the conversation, and until when.
536
+ */
537
+ getChatPauseStatus(options) {
538
+ return (options.client ?? this.client).get({
539
+ security: [{ scheme: 'bearer', type: 'http' }],
540
+ url: '/api/v1/chats/{chat_id}/pause-status',
541
+ ...options
542
+ });
543
+ }
544
+ /**
545
+ * Mark a chat as read
546
+ *
547
+ * Marks the conversation read for the whole team as of now. Read state is shared between agents rather than tracked per agent, and the timestamp is stamped server-side.
548
+ */
549
+ markChatRead(options) {
550
+ return (options.client ?? this.client).put({
551
+ security: [{ scheme: 'bearer', type: 'http' }],
552
+ url: '/api/v1/chats/{chat_id}/read',
553
+ ...options
554
+ });
555
+ }
556
+ /**
557
+ * Snooze a chat
558
+ *
559
+ * Snoozes the conversation until the given instant, or wakes it by sending `null`. Like read state, snoozing applies to the whole team.
560
+ */
561
+ snoozeChat(options) {
562
+ return (options.client ?? this.client).put({
563
+ security: [{ scheme: 'bearer', type: 'http' }],
564
+ url: '/api/v1/chats/{chat_id}/snooze',
565
+ ...options,
566
+ headers: {
567
+ 'Content-Type': 'application/json',
568
+ ...options.headers
569
+ }
570
+ });
571
+ }
572
+ /**
573
+ * Set a chat's status
574
+ *
575
+ * Sets the conversation's status — the value the inbox filters on. The status is held against the business/customer pair, so it survives a conversation being closed and reopened.
576
+ */
577
+ setChatStatus(options) {
578
+ return (options.client ?? this.client).put({
579
+ security: [{ scheme: 'bearer', type: 'http' }],
580
+ url: '/api/v1/chats/{chat_id}/status',
581
+ ...options,
582
+ headers: {
583
+ 'Content-Type': 'application/json',
584
+ ...options.headers
585
+ }
586
+ });
587
+ }
588
+ /**
589
+ * Resume the assistant on a chat
590
+ *
591
+ * Hands the conversation back to the assistant, which resumes answering incoming messages automatically.
592
+ */
593
+ resumeChatAssistant(options) {
594
+ return (options.client ?? this.client).post({
595
+ security: [{ scheme: 'bearer', type: 'http' }],
596
+ url: '/api/v1/chats/{chat_id}/unpause',
597
+ ...options
598
+ });
599
+ }
600
+ /**
601
+ * Upload an attachment
602
+ *
603
+ * Uploads a file to be attached to a message on this conversation, and returns the stored reference to pass when sending that message.
604
+ */
605
+ uploadChatAttachment(options) {
606
+ return (options.client ?? this.client).post({
607
+ ...formDataBodySerializer,
608
+ security: [{ scheme: 'bearer', type: 'http' }],
609
+ url: '/api/v1/chats/{chat_id}/upload',
610
+ ...options,
611
+ headers: {
612
+ 'Content-Type': null,
613
+ ...options.headers
614
+ }
615
+ });
616
+ }
617
+ /**
618
+ * List personal access tokens
619
+ *
620
+ * Returns the personal access tokens belonging to the authenticated user. Only metadata is returned; a token's value is never readable after it is created.
621
+ */
622
+ listApiTokens(options) {
623
+ return (options?.client ?? this.client).get({
624
+ security: [{ scheme: 'bearer', type: 'http' }],
625
+ url: '/api/v1/me/api-tokens',
626
+ ...options
627
+ });
628
+ }
629
+ /**
630
+ * Create a personal access token
631
+ *
632
+ * Issues a new personal access token for the authenticated user. The token value appears exactly once, in this response — store it before discarding the response, because it cannot be retrieved again.
633
+ */
634
+ createApiToken(options) {
635
+ return (options.client ?? this.client).post({
636
+ security: [{ scheme: 'bearer', type: 'http' }],
637
+ url: '/api/v1/me/api-tokens',
638
+ ...options,
639
+ headers: {
640
+ 'Content-Type': 'application/json',
641
+ ...options.headers
642
+ }
643
+ });
644
+ }
645
+ /**
646
+ * Revoke a personal access token
647
+ *
648
+ * Revokes the token immediately. Every later request presenting it is rejected.
649
+ */
650
+ revokeApiToken(options) {
651
+ return (options.client ?? this.client).delete({
652
+ security: [{ scheme: 'bearer', type: 'http' }],
653
+ url: '/api/v1/me/api-tokens/{token_id}',
654
+ ...options
655
+ });
656
+ }
657
+ /**
658
+ * List transmissions
659
+ *
660
+ * Returns the business's bulk sends, newest first. Archived rows are omitted unless `status=archived` is passed. Optionally filter by any other status.
661
+ */
662
+ listTransmissions(options) {
663
+ return (options?.client ?? this.client).get({
664
+ security: [{ scheme: 'bearer', type: 'http' }],
665
+ url: '/api/v1/transmissions',
666
+ ...options
667
+ });
668
+ }
669
+ /**
670
+ * Preview a transmission
671
+ *
672
+ * Validates the recipient list and template and stores the result as a draft, without sending anything. Review the draft, then confirm it to dispatch.
673
+ */
674
+ previewTransmission(options) {
675
+ return (options.client ?? this.client).post({
676
+ security: [{ scheme: 'bearer', type: 'http' }],
677
+ url: '/api/v1/transmissions/preview',
678
+ ...options,
679
+ headers: {
680
+ 'Content-Type': 'application/json',
681
+ ...options.headers
682
+ }
683
+ });
684
+ }
685
+ /**
686
+ * Retrieve a transmission
687
+ *
688
+ * Returns one transmission with its current status and per-recipient counts.
689
+ */
690
+ getTransmission(options) {
691
+ return (options.client ?? this.client).get({
692
+ security: [{ scheme: 'bearer', type: 'http' }],
693
+ url: '/api/v1/transmissions/{transmission_id}',
694
+ ...options
695
+ });
696
+ }
697
+ /**
698
+ * Archive a transmission
699
+ *
700
+ * Hides a draft or cancelled transmission from the default list without deleting it. Idempotent for already-archived rows. Does not send or confirm; confirming an archived transmission is rejected.
701
+ */
702
+ archiveTransmission(options) {
703
+ return (options.client ?? this.client).post({
704
+ security: [{ scheme: 'bearer', type: 'http' }],
705
+ url: '/api/v1/transmissions/{transmission_id}/archive',
706
+ ...options
707
+ });
708
+ }
709
+ /**
710
+ * Cancel a transmission
711
+ *
712
+ * Cancels a transmission that has not finished. Cancelling one that already completed, failed or was cancelled is a no-op that returns its current status. A send in progress stops cooperatively, so messages already dispatched are still delivered.
713
+ */
714
+ cancelTransmission(options) {
715
+ return (options.client ?? this.client).post({
716
+ security: [{ scheme: 'bearer', type: 'http' }],
717
+ url: '/api/v1/transmissions/{transmission_id}/cancel',
718
+ ...options
719
+ });
720
+ }
721
+ /**
722
+ * Confirm and dispatch a transmission
723
+ *
724
+ * Releases a draft transmission for delivery. **This sends real messages to real recipients and cannot be undone.**
725
+ */
726
+ confirmTransmission(options) {
727
+ return (options.client ?? this.client).post({
728
+ security: [{ scheme: 'bearer', type: 'http' }],
729
+ url: '/api/v1/transmissions/{transmission_id}/confirm',
730
+ ...options
731
+ });
732
+ }
733
+ /**
734
+ * List webhook endpoints
735
+ *
736
+ * Returns the webhook endpoints registered for the business, newest first. Signing secrets are never included — a secret is readable only in the response that creates or rotates it. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
737
+ */
738
+ listCurrentWebhookEndpoints(options) {
739
+ return (options?.client ?? this.client).get({
740
+ security: [{ scheme: 'bearer', type: 'http' }],
741
+ url: '/api/v1/webhook-endpoints',
742
+ ...options
743
+ });
744
+ }
745
+ /**
746
+ * Register a webhook endpoint
747
+ *
748
+ * Registers a URL to receive signed event deliveries and returns it along with its signing secret. **The secret is shown exactly once** — store it now; afterwards you can only rotate it. The URL must be a publicly resolvable HTTPS address, and every entry in `subscribed_events` must be a known event type. Requires a plan that includes event webhooks. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
749
+ */
750
+ createCurrentWebhookEndpoint(options) {
751
+ return (options.client ?? this.client).post({
752
+ security: [{ scheme: 'bearer', type: 'http' }],
753
+ url: '/api/v1/webhook-endpoints',
754
+ ...options,
755
+ headers: {
756
+ 'Content-Type': 'application/json',
757
+ ...options.headers
758
+ }
759
+ });
760
+ }
761
+ /**
762
+ * Resend a delivery
763
+ *
764
+ * Queues a past delivery to be sent again. The stored request body is replayed byte for byte, so the original signature still verifies. Responds `202` once queued; the send itself happens in the background. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
765
+ */
766
+ resendCurrentWebhookDelivery(options) {
767
+ return (options.client ?? this.client).post({
768
+ security: [{ scheme: 'bearer', type: 'http' }],
769
+ url: '/api/v1/webhook-endpoints/deliveries/{delivery_id}/resend',
770
+ ...options
771
+ });
772
+ }
773
+ /**
774
+ * Delete a webhook endpoint
775
+ *
776
+ * Removes the endpoint and stops delivering to it. Past deliveries are retained. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
777
+ */
778
+ deleteCurrentWebhookEndpoint(options) {
779
+ return (options.client ?? this.client).delete({
780
+ security: [{ scheme: 'bearer', type: 'http' }],
781
+ url: '/api/v1/webhook-endpoints/{endpoint_id}',
782
+ ...options
783
+ });
784
+ }
785
+ /**
786
+ * Update a webhook endpoint
787
+ *
788
+ * Changes an endpoint's URL, label, subscribed events or enabled state; omitted fields are left alone. Re-enabling an endpoint also clears the consecutive-failure streak that auto-disabled it, so a single later failure will not disable it again. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
789
+ */
790
+ updateCurrentWebhookEndpoint(options) {
791
+ return (options.client ?? this.client).patch({
792
+ security: [{ scheme: 'bearer', type: 'http' }],
793
+ url: '/api/v1/webhook-endpoints/{endpoint_id}',
794
+ ...options,
795
+ headers: {
796
+ 'Content-Type': 'application/json',
797
+ ...options.headers
798
+ }
799
+ });
800
+ }
801
+ /**
802
+ * Rotate an endpoint's signing secret
803
+ *
804
+ * Issues a new signing secret and returns it. **The previous secret stops verifying immediately** and there is no overlap window, so deploy the new one to your receiver before rotating. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
805
+ */
806
+ rotateCurrentWebhookSigningSecret(options) {
807
+ return (options.client ?? this.client).post({
808
+ security: [{ scheme: 'bearer', type: 'http' }],
809
+ url: '/api/v1/webhook-endpoints/{endpoint_id}/rotate-secret',
810
+ ...options
811
+ });
812
+ }
813
+ /**
814
+ * List message templates
815
+ *
816
+ * Returns the business's WhatsApp message templates, optionally filtered by review status.
817
+ */
818
+ listWhatsAppTemplates(options) {
819
+ return (options?.client ?? this.client).get({
820
+ security: [{ scheme: 'bearer', type: 'http' }],
821
+ url: '/api/v1/whatsapp_templates',
822
+ ...options
823
+ });
824
+ }
825
+ /**
826
+ * Create a message template
827
+ *
828
+ * Creates a template as a local draft. A draft cannot be used for sending until it has been submitted to Meta and approved.
829
+ */
830
+ createWhatsAppTemplate(options) {
831
+ return (options.client ?? this.client).post({
832
+ security: [{ scheme: 'bearer', type: 'http' }],
833
+ url: '/api/v1/whatsapp_templates',
834
+ ...options,
835
+ headers: {
836
+ 'Content-Type': 'application/json',
837
+ ...options.headers
838
+ }
839
+ });
840
+ }
841
+ /**
842
+ * Sync template status from Meta
843
+ *
844
+ * Pulls the current review status of the business's templates from Meta and updates the stored copies, so templates approved or rejected on Meta's side become visible here.
845
+ */
846
+ syncWhatsAppTemplates(options) {
847
+ return (options?.client ?? this.client).post({
848
+ security: [{ scheme: 'bearer', type: 'http' }],
849
+ url: '/api/v1/whatsapp_templates/sync',
850
+ ...options
851
+ });
852
+ }
853
+ /**
854
+ * Delete a message template
855
+ *
856
+ * Deletes the template. Messages already sent with it are unaffected.
857
+ */
858
+ deleteWhatsAppTemplate(options) {
859
+ return (options.client ?? this.client).delete({
860
+ security: [{ scheme: 'bearer', type: 'http' }],
861
+ url: '/api/v1/whatsapp_templates/{template_id}',
862
+ ...options
863
+ });
864
+ }
865
+ /**
866
+ * Retrieve a message template
867
+ *
868
+ * Returns one template, including its body, variables and current review status.
869
+ */
870
+ getWhatsAppTemplate(options) {
871
+ return (options.client ?? this.client).get({
872
+ security: [{ scheme: 'bearer', type: 'http' }],
873
+ url: '/api/v1/whatsapp_templates/{template_id}',
874
+ ...options
875
+ });
876
+ }
877
+ /**
878
+ * Update a message template
879
+ *
880
+ * Updates a template. Its content can only be changed while the template is still a local draft or has been rejected — an approved template has to be replaced by a new one.
881
+ */
882
+ updateWhatsAppTemplate(options) {
883
+ return (options.client ?? this.client).patch({
884
+ security: [{ scheme: 'bearer', type: 'http' }],
885
+ url: '/api/v1/whatsapp_templates/{template_id}',
886
+ ...options,
887
+ headers: {
888
+ 'Content-Type': 'application/json',
889
+ ...options.headers
890
+ }
891
+ });
892
+ }
893
+ /**
894
+ * Submit a template for review
895
+ *
896
+ * Submits the template to Meta for approval. Review is asynchronous — poll the template, or sync from Meta, to see the outcome.
897
+ */
898
+ submitWhatsAppTemplate(options) {
899
+ return (options.client ?? this.client).post({
900
+ security: [{ scheme: 'bearer', type: 'http' }],
901
+ url: '/api/v1/whatsapp_templates/{template_id}/submit',
902
+ ...options
903
+ });
904
+ }
905
+ }
906
+ //# sourceMappingURL=sdk.gen.js.map