@digisglobal/omnivox-sdk 0.7.0 → 0.9.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/dist/index.cjs +151 -33
- package/dist/index.d.cts +216 -43
- package/dist/index.d.ts +216 -43
- package/dist/index.js +151 -33
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -42,6 +42,7 @@ declare function createSessionTokenProvider(): TokenProvider;
|
|
|
42
42
|
* - create(input) → POST /api/v1/canned-responses
|
|
43
43
|
* - update(id, input) → PATCH /api/v1/canned-responses/:id
|
|
44
44
|
* - delete(id) → DELETE /api/v1/canned-responses/:id
|
|
45
|
+
* - duplicate(id) → POST /api/v1/canned-responses/:id/duplicate
|
|
45
46
|
*
|
|
46
47
|
* Never re-exports symbols from _generated/.
|
|
47
48
|
* Contains no business logic — typed transport only.
|
|
@@ -55,23 +56,29 @@ interface CannedResponsesModuleOptions extends TokenProvider {
|
|
|
55
56
|
/** Input for creating a canned response. */
|
|
56
57
|
interface CreateCannedResponseInput {
|
|
57
58
|
title: string;
|
|
59
|
+
shortcut: string;
|
|
58
60
|
body: string;
|
|
59
|
-
|
|
61
|
+
category?: string;
|
|
62
|
+
channel?: string;
|
|
60
63
|
[key: string]: unknown;
|
|
61
64
|
}
|
|
62
65
|
/** Input for partially updating a canned response. */
|
|
63
66
|
interface UpdateCannedResponseInput {
|
|
64
67
|
title?: string;
|
|
68
|
+
shortcut?: string;
|
|
65
69
|
body?: string;
|
|
66
|
-
|
|
70
|
+
category?: string;
|
|
71
|
+
channel?: string;
|
|
67
72
|
[key: string]: unknown;
|
|
68
73
|
}
|
|
69
74
|
/** Canned response resource shape returned by the API. */
|
|
70
75
|
interface CannedResponseItem {
|
|
71
76
|
id: string;
|
|
72
77
|
title: string;
|
|
78
|
+
shortcut: string;
|
|
79
|
+
category: string;
|
|
80
|
+
channel: string;
|
|
73
81
|
body: string;
|
|
74
|
-
keywords: string[];
|
|
75
82
|
[key: string]: unknown;
|
|
76
83
|
}
|
|
77
84
|
/** Paginated list response. */
|
|
@@ -88,6 +95,8 @@ interface PagedList$5<T> {
|
|
|
88
95
|
interface CannedResponseListOpts {
|
|
89
96
|
page: number;
|
|
90
97
|
pageSize: number;
|
|
98
|
+
category?: string;
|
|
99
|
+
channel?: string;
|
|
91
100
|
[key: string]: unknown;
|
|
92
101
|
}
|
|
93
102
|
/** Pagination + search options for search(). */
|
|
@@ -95,6 +104,8 @@ interface CannedResponseSearchOpts {
|
|
|
95
104
|
page: number;
|
|
96
105
|
pageSize: number;
|
|
97
106
|
q: string;
|
|
107
|
+
category?: string;
|
|
108
|
+
channel?: string;
|
|
98
109
|
[key: string]: unknown;
|
|
99
110
|
}
|
|
100
111
|
/**
|
|
@@ -119,7 +130,7 @@ declare function createCannedResponsesModule(options: CannedResponsesModuleOptio
|
|
|
119
130
|
*/
|
|
120
131
|
create(input: CreateCannedResponseInput): Promise<CannedResponseItem>;
|
|
121
132
|
/**
|
|
122
|
-
* Partially update a canned response — title,
|
|
133
|
+
* Partially update a canned response — title, shortcut, category, channel, and/or body.
|
|
123
134
|
* Calls PATCH /api/v1/canned-responses/:id.
|
|
124
135
|
*/
|
|
125
136
|
update(id: string, input: UpdateCannedResponseInput): Promise<CannedResponseItem>;
|
|
@@ -128,6 +139,11 @@ declare function createCannedResponsesModule(options: CannedResponsesModuleOptio
|
|
|
128
139
|
* Calls DELETE /api/v1/canned-responses/:id.
|
|
129
140
|
*/
|
|
130
141
|
delete(id: string): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Duplicate a canned response. The server generates a unique title and
|
|
144
|
+
* shortcut. Calls POST /api/v1/canned-responses/:id/duplicate.
|
|
145
|
+
*/
|
|
146
|
+
duplicate(id: string): Promise<CannedResponseItem>;
|
|
131
147
|
};
|
|
132
148
|
/** Return type of createCannedResponsesModule. */
|
|
133
149
|
type CannedResponsesModule = ReturnType<typeof createCannedResponsesModule>;
|
|
@@ -138,6 +154,8 @@ type CannedResponsesModule = ReturnType<typeof createCannedResponsesModule>;
|
|
|
138
154
|
* Exposes the Phase-2 templates surface via two submodules:
|
|
139
155
|
*
|
|
140
156
|
* whatsapp (WABA-scoped):
|
|
157
|
+
* - list(tenantId, wabaId, opts) → GET /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates
|
|
158
|
+
* - getById(tenantId, wabaId, templateId) → GET /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates/:templateId
|
|
141
159
|
* - authorDraft(tenantId, wabaId, input) → POST /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates
|
|
142
160
|
* - importApproved(tenantId, wabaId) → POST /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates/import
|
|
143
161
|
* - update(tenantId, wabaId, templateId, input) → PATCH /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates/:templateId
|
|
@@ -172,11 +190,55 @@ interface UpdateWhatsAppTemplateInput {
|
|
|
172
190
|
body?: string;
|
|
173
191
|
[key: string]: unknown;
|
|
174
192
|
}
|
|
175
|
-
/**
|
|
193
|
+
/**
|
|
194
|
+
* A single status-event row attached to a template version, as returned nested
|
|
195
|
+
* under each version in the history response (`versions[].statusEvents[]`).
|
|
196
|
+
* These are the raw Meta callback events (plus synthetic import events).
|
|
197
|
+
*/
|
|
176
198
|
interface WhatsAppTemplateHistoryEvent {
|
|
177
|
-
|
|
199
|
+
id: string;
|
|
200
|
+
templateVersionId: string;
|
|
201
|
+
eventName: string;
|
|
202
|
+
reason: string | null;
|
|
203
|
+
createdAt: string;
|
|
204
|
+
[key: string]: unknown;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* A single template version within the history response, carrying its own
|
|
208
|
+
* ordered list of status events.
|
|
209
|
+
*/
|
|
210
|
+
interface WhatsAppTemplateHistoryVersion {
|
|
211
|
+
id: string;
|
|
212
|
+
templateId: string;
|
|
213
|
+
versionNumber: number;
|
|
214
|
+
language: string;
|
|
215
|
+
category: string;
|
|
216
|
+
body: string;
|
|
178
217
|
status: string;
|
|
218
|
+
sendability: string;
|
|
219
|
+
placeholderSnapshot: unknown;
|
|
220
|
+
supersedesVersionId: string | null;
|
|
221
|
+
providerTemplateId: string | null;
|
|
222
|
+
submittedAt: string | null;
|
|
223
|
+
createdAt: string;
|
|
224
|
+
updatedAt: string;
|
|
225
|
+
statusEvents: WhatsAppTemplateHistoryEvent[];
|
|
226
|
+
[key: string]: unknown;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The full history for a single WhatsApp template, as returned by
|
|
230
|
+
* `whatsapp.history`. This is a single OBJECT (not an array): template-level
|
|
231
|
+
* fields plus a `versions` array ordered by `versionNumber` ascending, each
|
|
232
|
+
* version carrying its own `statusEvents`. The "current" version is the one
|
|
233
|
+
* with the highest `versionNumber`.
|
|
234
|
+
*/
|
|
235
|
+
interface WhatsAppTemplateHistory {
|
|
236
|
+
id: string;
|
|
237
|
+
whatsAppBusinessAccountId: string;
|
|
238
|
+
name: string;
|
|
239
|
+
createdAt: string;
|
|
179
240
|
updatedAt: string;
|
|
241
|
+
versions: WhatsAppTemplateHistoryVersion[];
|
|
180
242
|
[key: string]: unknown;
|
|
181
243
|
}
|
|
182
244
|
/** A WhatsApp template item returned by the API. */
|
|
@@ -187,23 +249,67 @@ interface WhatsAppTemplateItem {
|
|
|
187
249
|
status?: string;
|
|
188
250
|
[key: string]: unknown;
|
|
189
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* A single WhatsApp template together with its current (latest) version, as
|
|
254
|
+
* returned by `whatsapp.getById`. Unlike the flat list item, language/status
|
|
255
|
+
* and other version-scoped fields live under `currentVersion` — reading them at
|
|
256
|
+
* the top level would be `undefined` at runtime.
|
|
257
|
+
*/
|
|
258
|
+
interface WhatsAppTemplateDetail {
|
|
259
|
+
id: string;
|
|
260
|
+
whatsAppBusinessAccountId: string;
|
|
261
|
+
name: string;
|
|
262
|
+
createdAt: string;
|
|
263
|
+
updatedAt: string;
|
|
264
|
+
currentVersion: {
|
|
265
|
+
versionNumber: number;
|
|
266
|
+
language: string;
|
|
267
|
+
category?: string;
|
|
268
|
+
body?: string;
|
|
269
|
+
status: string;
|
|
270
|
+
[key: string]: unknown;
|
|
271
|
+
};
|
|
272
|
+
[key: string]: unknown;
|
|
273
|
+
}
|
|
274
|
+
/** Pagination + filter options for the WhatsApp templates list. */
|
|
275
|
+
interface WhatsAppTemplateListOpts {
|
|
276
|
+
/** Narrow to templates whose current version has this status (e.g. "APPROVED"). */
|
|
277
|
+
status?: string;
|
|
278
|
+
/** Case-insensitive contains-match on template name. */
|
|
279
|
+
q?: string;
|
|
280
|
+
page: number;
|
|
281
|
+
pageSize: number;
|
|
282
|
+
}
|
|
283
|
+
/** A single template upserted by an import-approved call. */
|
|
284
|
+
interface ImportedTemplateResult {
|
|
285
|
+
name: string;
|
|
286
|
+
language: string;
|
|
287
|
+
category: string;
|
|
288
|
+
version: Omit<WhatsAppTemplateHistoryVersion, 'statusEvents'>;
|
|
289
|
+
created: boolean;
|
|
290
|
+
}
|
|
190
291
|
/** Import-approved result. */
|
|
191
292
|
interface ImportApprovedResult {
|
|
192
|
-
imported:
|
|
193
|
-
[key: string]: unknown;
|
|
293
|
+
imported: ImportedTemplateResult[];
|
|
194
294
|
}
|
|
195
295
|
/** Submit result. */
|
|
196
296
|
interface SubmitResult {
|
|
197
297
|
status: string;
|
|
198
298
|
[key: string]: unknown;
|
|
199
299
|
}
|
|
200
|
-
/**
|
|
300
|
+
/**
|
|
301
|
+
* Input for creating an Email template.
|
|
302
|
+
*
|
|
303
|
+
* `variableSchema` is a name→sample-value map (variable name → default/sample
|
|
304
|
+
* value). Preview substitutes those values; the API contract stores the same
|
|
305
|
+
* shape.
|
|
306
|
+
*/
|
|
201
307
|
interface CreateEmailTemplateInput {
|
|
202
308
|
name: string;
|
|
203
309
|
subject: string;
|
|
204
310
|
htmlBody?: string;
|
|
205
311
|
textBody?: string;
|
|
206
|
-
variableSchema?: Record<string,
|
|
312
|
+
variableSchema?: Record<string, string>;
|
|
207
313
|
[key: string]: unknown;
|
|
208
314
|
}
|
|
209
315
|
/** Input for partially updating an Email template. */
|
|
@@ -212,7 +318,7 @@ interface PatchEmailTemplateInput {
|
|
|
212
318
|
subject?: string;
|
|
213
319
|
htmlBody?: string;
|
|
214
320
|
textBody?: string;
|
|
215
|
-
variableSchema?: Record<string,
|
|
321
|
+
variableSchema?: Record<string, string>;
|
|
216
322
|
[key: string]: unknown;
|
|
217
323
|
}
|
|
218
324
|
/** An Email template item returned by the API. */
|
|
@@ -222,7 +328,7 @@ interface EmailTemplateItem {
|
|
|
222
328
|
subject: string;
|
|
223
329
|
htmlBody?: string;
|
|
224
330
|
textBody?: string;
|
|
225
|
-
variableSchema?: Record<string,
|
|
331
|
+
variableSchema?: Record<string, string>;
|
|
226
332
|
[key: string]: unknown;
|
|
227
333
|
}
|
|
228
334
|
/** Paginated list response. */
|
|
@@ -239,6 +345,8 @@ interface TemplatesPagedList<T> {
|
|
|
239
345
|
interface EmailTemplateListOpts {
|
|
240
346
|
page: number;
|
|
241
347
|
pageSize: number;
|
|
348
|
+
/** Case-insensitive contains-match on template name. */
|
|
349
|
+
q?: string;
|
|
242
350
|
[key: string]: unknown;
|
|
243
351
|
}
|
|
244
352
|
/**
|
|
@@ -250,6 +358,18 @@ declare function createTemplatesModule(options: TemplatesModuleOptions): {
|
|
|
250
358
|
* WhatsApp template submodule — WABA-scoped operations.
|
|
251
359
|
*/
|
|
252
360
|
whatsapp: {
|
|
361
|
+
/**
|
|
362
|
+
* List a WhatsApp Business Account's templates (paginated, optionally status-filtered and name-searchable).
|
|
363
|
+
* Calls GET /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates.
|
|
364
|
+
*/
|
|
365
|
+
list(tenantId: string, wabaId: string, opts: WhatsAppTemplateListOpts): Promise<TemplatesPagedList<WhatsAppTemplateItem>>;
|
|
366
|
+
/**
|
|
367
|
+
* Get a single template together with its current (latest) version.
|
|
368
|
+
* Language/status and other version-scoped fields are nested under
|
|
369
|
+
* `currentVersion` — not at the top level (see WhatsAppTemplateDetail).
|
|
370
|
+
* Calls GET /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates/:templateId.
|
|
371
|
+
*/
|
|
372
|
+
getById(tenantId: string, wabaId: string, templateId: string): Promise<WhatsAppTemplateDetail>;
|
|
253
373
|
/**
|
|
254
374
|
* Author a new DRAFT template (version 1) under a WhatsApp Business Account.
|
|
255
375
|
* Calls POST /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates.
|
|
@@ -266,10 +386,14 @@ declare function createTemplatesModule(options: TemplatesModuleOptions): {
|
|
|
266
386
|
*/
|
|
267
387
|
update(tenantId: string, wabaId: string, templateId: string, input: UpdateWhatsAppTemplateInput): Promise<WhatsAppTemplateItem>;
|
|
268
388
|
/**
|
|
269
|
-
*
|
|
389
|
+
* Get the full version + status-event history for a template.
|
|
390
|
+
*
|
|
391
|
+
* Returns a single OBJECT (see WhatsAppTemplateHistory) — template-level
|
|
392
|
+
* fields plus a `versions` array ordered by versionNumber ascending, each
|
|
393
|
+
* version carrying its own `statusEvents`. NOT a flat array of events.
|
|
270
394
|
* Calls GET /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates/:templateId/history.
|
|
271
395
|
*/
|
|
272
|
-
history(tenantId: string, wabaId: string, templateId: string): Promise<
|
|
396
|
+
history(tenantId: string, wabaId: string, templateId: string): Promise<WhatsAppTemplateHistory>;
|
|
273
397
|
/**
|
|
274
398
|
* Submit a DRAFT template version to Meta for review and approval (DRAFT → PENDING_APPROVAL).
|
|
275
399
|
* Calls POST /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates/:templateId/submit.
|
|
@@ -469,6 +593,11 @@ interface LobbyEntry {
|
|
|
469
593
|
id: string;
|
|
470
594
|
[key: string]: unknown;
|
|
471
595
|
}
|
|
596
|
+
/** Result of picking up a lobby entry — the created/reused conversation + entry ids. */
|
|
597
|
+
interface PickupResult {
|
|
598
|
+
conversationId: string;
|
|
599
|
+
entryId: string;
|
|
600
|
+
}
|
|
472
601
|
/** Paginated list response. */
|
|
473
602
|
interface PagedList$3<T> {
|
|
474
603
|
data: T[];
|
|
@@ -543,12 +672,10 @@ declare function createConversationsModule(options: ConversationsModuleOptions):
|
|
|
543
672
|
get(id: string): Promise<ConversationItem>;
|
|
544
673
|
/**
|
|
545
674
|
* Pick up a lobby entry (atomic 4-step transaction).
|
|
546
|
-
* Returns the resulting conversation.
|
|
675
|
+
* Returns the resulting conversation + entry ids.
|
|
547
676
|
* Calls POST /api/v1/conversations/lobby/:entryId/pickup.
|
|
548
677
|
*/
|
|
549
|
-
pickup(entryId: string, input: PickupInput): Promise<
|
|
550
|
-
data: ConversationItem;
|
|
551
|
-
}>;
|
|
678
|
+
pickup(entryId: string, input: PickupInput): Promise<PickupResult>;
|
|
552
679
|
/**
|
|
553
680
|
* List APPROVED + SENDABLE WhatsApp templates eligible to re-open an
|
|
554
681
|
* expired 24-hour customer-service window for the given conversation.
|
|
@@ -842,24 +969,20 @@ interface CreateApiKeyInput {
|
|
|
842
969
|
}
|
|
843
970
|
/** Response from tenants.apiKeys.create() — includes raw key shown once. */
|
|
844
971
|
interface CreateApiKeyResponse {
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
raw: string;
|
|
855
|
-
};
|
|
972
|
+
id: string;
|
|
973
|
+
label: string;
|
|
974
|
+
prefix: string;
|
|
975
|
+
scopes: string[];
|
|
976
|
+
status: 'ACTIVE' | 'REVOKED';
|
|
977
|
+
lastUsedAt: string | null;
|
|
978
|
+
createdAt: string;
|
|
979
|
+
/** Raw key value — shown once and never again. */
|
|
980
|
+
raw: string;
|
|
856
981
|
}
|
|
857
982
|
/** Response from tenants.apiKeys.revoke(). */
|
|
858
983
|
interface RevokeApiKeyResponse {
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
status: 'REVOKED';
|
|
862
|
-
};
|
|
984
|
+
id: string;
|
|
985
|
+
status: 'REVOKED';
|
|
863
986
|
}
|
|
864
987
|
/** Paginated list response. */
|
|
865
988
|
interface PagedList<T> {
|
|
@@ -1173,9 +1296,7 @@ declare function createOmnivoxClient(options: OmnivoxClientOptions): {
|
|
|
1173
1296
|
assign(id: string, input: AssignInput): Promise<ConversationItem>;
|
|
1174
1297
|
listLobby(opts?: LobbyListOpts): Promise<PagedList$3<LobbyEntry>>;
|
|
1175
1298
|
get(id: string): Promise<ConversationItem>;
|
|
1176
|
-
pickup(entryId: string, input: PickupInput): Promise<
|
|
1177
|
-
data: ConversationItem;
|
|
1178
|
-
}>;
|
|
1299
|
+
pickup(entryId: string, input: PickupInput): Promise<PickupResult>;
|
|
1179
1300
|
whatsappRecoveryOptions(id: string): Promise<WhatsAppRecoveryOption[]>;
|
|
1180
1301
|
};
|
|
1181
1302
|
messages: {
|
|
@@ -1187,10 +1308,12 @@ declare function createOmnivoxClient(options: OmnivoxClientOptions): {
|
|
|
1187
1308
|
};
|
|
1188
1309
|
templates: {
|
|
1189
1310
|
whatsapp: {
|
|
1311
|
+
list(tenantId: string, wabaId: string, opts: WhatsAppTemplateListOpts): Promise<TemplatesPagedList<WhatsAppTemplateItem>>;
|
|
1312
|
+
getById(tenantId: string, wabaId: string, templateId: string): Promise<WhatsAppTemplateDetail>;
|
|
1190
1313
|
authorDraft(tenantId: string, wabaId: string, input: AuthorDraftInput): Promise<WhatsAppTemplateItem>;
|
|
1191
1314
|
importApproved(tenantId: string, wabaId: string): Promise<ImportApprovedResult>;
|
|
1192
1315
|
update(tenantId: string, wabaId: string, templateId: string, input: UpdateWhatsAppTemplateInput): Promise<WhatsAppTemplateItem>;
|
|
1193
|
-
history(tenantId: string, wabaId: string, templateId: string): Promise<
|
|
1316
|
+
history(tenantId: string, wabaId: string, templateId: string): Promise<WhatsAppTemplateHistory>;
|
|
1194
1317
|
submit(tenantId: string, wabaId: string, templateId: string): Promise<SubmitResult>;
|
|
1195
1318
|
};
|
|
1196
1319
|
email: {
|
|
@@ -1207,6 +1330,7 @@ declare function createOmnivoxClient(options: OmnivoxClientOptions): {
|
|
|
1207
1330
|
create(input: CreateCannedResponseInput): Promise<CannedResponseItem>;
|
|
1208
1331
|
update(id: string, input: UpdateCannedResponseInput): Promise<CannedResponseItem>;
|
|
1209
1332
|
delete(id: string): Promise<void>;
|
|
1333
|
+
duplicate(id: string): Promise<CannedResponseItem>;
|
|
1210
1334
|
};
|
|
1211
1335
|
attachments: {
|
|
1212
1336
|
upload(file: Blob | Uint8Array, _opts?: Record<string, unknown>): Promise<AttachmentUploadResult>;
|
|
@@ -1215,6 +1339,10 @@ declare function createOmnivoxClient(options: OmnivoxClientOptions): {
|
|
|
1215
1339
|
whatsappBusinessAccounts: {
|
|
1216
1340
|
list(tenantId: string): Promise<WhatsAppBusinessAccountItem[]>;
|
|
1217
1341
|
get(tenantId: string, wabaRowId: string): Promise<WhatsAppBusinessAccountItem>;
|
|
1342
|
+
create(tenantId: string, body: CreateWhatsAppBusinessAccountBody): Promise<WhatsAppBusinessAccountItem>;
|
|
1343
|
+
update(tenantId: string, wabaRowId: string, body: {
|
|
1344
|
+
name: string;
|
|
1345
|
+
}): Promise<WhatsAppBusinessAccountItem>;
|
|
1218
1346
|
};
|
|
1219
1347
|
/**
|
|
1220
1348
|
* Creates a WebSocket client connected to the `/ws/chat` namespace.
|
|
@@ -1574,12 +1702,15 @@ type AttachmentsModule = ReturnType<typeof createAttachmentsModule>;
|
|
|
1574
1702
|
/**
|
|
1575
1703
|
* WhatsApp Business Accounts module — hand-written typed wrapper over the generated client.
|
|
1576
1704
|
*
|
|
1577
|
-
* Exposes the WABA
|
|
1578
|
-
* - list(tenantId)
|
|
1579
|
-
* - get(tenantId, wabaRowId)
|
|
1705
|
+
* Exposes the WABA surface (WABA-as-identity, tenant-scoped):
|
|
1706
|
+
* - list(tenantId) → GET /api/v1/tenants/:id/whatsapp-business-accounts
|
|
1707
|
+
* - get(tenantId, wabaRowId) → GET /api/v1/tenants/:id/whatsapp-business-accounts/:wabaRowId
|
|
1708
|
+
* - create(tenantId, body) → POST /api/v1/tenants/:id/whatsapp-business-accounts
|
|
1709
|
+
* - update(tenantId, wabaRowId, body) → PATCH /api/v1/tenants/:id/whatsapp-business-accounts/:wabaRowId
|
|
1580
1710
|
*
|
|
1581
|
-
* The Console's WhatsApp templates page uses
|
|
1711
|
+
* The Console's WhatsApp templates page uses list/get to let an admin pick a WABA
|
|
1582
1712
|
* before authoring templates (`sdk.templates.whatsapp.*` requires a `wabaId`).
|
|
1713
|
+
* The Console's Channels screen uses create/update to onboard and rename a WABA.
|
|
1583
1714
|
*
|
|
1584
1715
|
* Never re-exports symbols from _generated/.
|
|
1585
1716
|
* Contains no business logic — typed transport only.
|
|
@@ -1606,9 +1737,24 @@ interface WhatsAppBusinessAccountItem {
|
|
|
1606
1737
|
/** ISO 8601 last-updated timestamp. */
|
|
1607
1738
|
updatedAt: string;
|
|
1608
1739
|
}
|
|
1740
|
+
/**
|
|
1741
|
+
* POST body to create a WhatsApp Business Account.
|
|
1742
|
+
* Mirrors `apps/api/src/channels/schemas/save-waba.schema.ts` `CreateWabaSchema`.
|
|
1743
|
+
* The `secret` block is written to the SecretsProvider and never echoed back
|
|
1744
|
+
* (ADR-0011) — the response is a {@link WhatsAppBusinessAccountItem}.
|
|
1745
|
+
*/
|
|
1746
|
+
interface CreateWhatsAppBusinessAccountBody {
|
|
1747
|
+
wabaId: string;
|
|
1748
|
+
name: string;
|
|
1749
|
+
secret: {
|
|
1750
|
+
accessToken: string;
|
|
1751
|
+
appSecret: string;
|
|
1752
|
+
webhookVerifyToken: string;
|
|
1753
|
+
};
|
|
1754
|
+
}
|
|
1609
1755
|
/**
|
|
1610
1756
|
* Creates the WhatsApp Business Accounts module — a thin typed wrapper over
|
|
1611
|
-
* the generated client. Covers the WABA
|
|
1757
|
+
* the generated client. Covers the WABA surface (list/get/create/update).
|
|
1612
1758
|
*/
|
|
1613
1759
|
declare function createWhatsAppBusinessAccountsModule(options: WhatsAppBusinessAccountsModuleOptions): {
|
|
1614
1760
|
/**
|
|
@@ -1630,8 +1776,35 @@ declare function createWhatsAppBusinessAccountsModule(options: WhatsAppBusinessA
|
|
|
1630
1776
|
* const waba = await sdk.whatsappBusinessAccounts.get('ten_acmecorp', 'waba_row_001')
|
|
1631
1777
|
*/
|
|
1632
1778
|
get(tenantId: string, wabaRowId: string): Promise<WhatsAppBusinessAccountItem>;
|
|
1779
|
+
/**
|
|
1780
|
+
* Create a WhatsApp Business Account — writes the secret to the
|
|
1781
|
+
* SecretsProvider and the non-secret row to the DB; returns the
|
|
1782
|
+
* non-secret view (no `secretRef` exposed).
|
|
1783
|
+
* Calls POST /api/v1/tenants/:id/whatsapp-business-accounts.
|
|
1784
|
+
*
|
|
1785
|
+
* @example
|
|
1786
|
+
* const waba = await sdk.whatsappBusinessAccounts.create('ten_acmecorp', {
|
|
1787
|
+
* wabaId: '123456789012345',
|
|
1788
|
+
* name: 'Acme WhatsApp',
|
|
1789
|
+
* secret: { accessToken, appSecret, webhookVerifyToken },
|
|
1790
|
+
* })
|
|
1791
|
+
*/
|
|
1792
|
+
create(tenantId: string, body: CreateWhatsAppBusinessAccountBody): Promise<WhatsAppBusinessAccountItem>;
|
|
1793
|
+
/**
|
|
1794
|
+
* Rename a WhatsApp Business Account (name only — secret material is
|
|
1795
|
+
* immutable through this endpoint).
|
|
1796
|
+
* Calls PATCH /api/v1/tenants/:id/whatsapp-business-accounts/:wabaRowId.
|
|
1797
|
+
*
|
|
1798
|
+
* @example
|
|
1799
|
+
* await sdk.whatsappBusinessAccounts.update('ten_acmecorp', 'waba_row_001', {
|
|
1800
|
+
* name: 'Renamed WhatsApp',
|
|
1801
|
+
* })
|
|
1802
|
+
*/
|
|
1803
|
+
update(tenantId: string, wabaRowId: string, body: {
|
|
1804
|
+
name: string;
|
|
1805
|
+
}): Promise<WhatsAppBusinessAccountItem>;
|
|
1633
1806
|
};
|
|
1634
1807
|
/** Return type of createWhatsAppBusinessAccountsModule. */
|
|
1635
1808
|
type WhatsAppBusinessAccountsModule = ReturnType<typeof createWhatsAppBusinessAccountsModule>;
|
|
1636
1809
|
|
|
1637
|
-
export { type AddIdentityInput, type AgentItem, type AgentsModule, type AgentsModuleOptions, type ApiKeyItem, type AssignInput, type AttachmentUploadResult, type AttachmentUrlResult, type AttachmentsModule, type AttachmentsModuleOptions, type AuthMeAgent, type AuthMeModule, type AuthMeModuleOptions, type AuthMeResponse, type AuthMeTenant, type AuthorDraftInput, type BasicEmailChannelConfig, type BasicEmailChannelSecret, type CannedResponseItem, type CannedResponseListOpts, type CannedResponseSearchOpts, type CannedResponsesModule, type CannedResponsesModuleOptions, type Channel, type ChannelListItem, type ChannelStatus, type ChannelType, type ChannelsModule, type ChannelsModuleOptions, type ContactChannel, type ContactConversationSummary, type ContactFieldDefinition, type ContactFieldValue, type ContactFieldValueInput, type ContactIdentity, type ContactIdentityInput, type ContactItem, type ContactSearchOpts, type ContactTag, type ContactsMetadata, type ContactsModule, type ContactsModuleOptions, type ConversationItem, type ConversationListOpts, type ConversationsModule, type ConversationsModuleOptions, type CreateAgentInput, type CreateApiKeyInput, type CreateApiKeyResponse, type CreateCannedResponseInput, type CreateChannelBody, type CreateContactInput, type CreateEmailChannelBody, type CreateEmailTemplateInput, type CreateWhatsAppChannelBody, type CredentialsMode, type EmailChannelConfig, type EmailChannelSecret, type EmailImapConfig, type EmailSmtpConfig, type EmailTemplateItem, type EmailTemplateListOpts, type ImportApprovedResult, type LobbyEntry, type LobbyListOpts, type MessageItem, type MessageListOpts, type MessageReadUpdatePayload, type MessageStatusPayload, type MessagesModule, type MessagesModuleOptions, type OAuth2CertificateEmailChannelSecret, type OAuth2ClientSecretEmailChannelSecret, type OAuth2EmailChannelConfig, type OAuth2EmailChannelSecret, type OmnivoxClient, type OmnivoxClientOptions, OmnivoxRequestError, type PageOpts, type PageParams, type PagedResponse, type ParticipantPayload, type PatchContactInput, type PatchEmailTemplateInput, type PickupInput, type ReopenOrCreateInput, type RevokeApiKeyResponse, type SendMessageInput, type SendTemplateInput, type SubmitResult, type TemplatesModule, type TemplatesModuleOptions, type TenantsModule, type TenantsModuleOptions, type TokenProvider, type TypingIndicatorPayload, type UpdateCannedResponseInput, type UpdateChannelBody, type UpdateStatusInput, type UpdateWhatsAppTemplateInput, type WhatsAppBusinessAccountItem, type WhatsAppBusinessAccountsModule, type WhatsAppBusinessAccountsModuleOptions, type WhatsAppChannelConfig, type WhatsAppRecoveryOption, type WhatsAppTemplateHistoryEvent, type WhatsAppTemplateItem, type WsAuth, type WsClient, type WsClientInstance, type WsClientOptions, type WsConnectionState, type WsEventPayloads, buildPageParams, createAgentsModule, createApiKeyTokenProvider, createAttachmentsModule, createAuthMeModule, createCannedResponsesModule, createChannelsModule, createContactsModule, createConversationsModule, createMessagesModule, createOmnivoxClient, createSessionTokenProvider, createTemplatesModule, createTenantsModule, createWhatsAppBusinessAccountsModule, createWsClient, iteratePages };
|
|
1810
|
+
export { type AddIdentityInput, type AgentItem, type AgentsModule, type AgentsModuleOptions, type ApiKeyItem, type AssignInput, type AttachmentUploadResult, type AttachmentUrlResult, type AttachmentsModule, type AttachmentsModuleOptions, type AuthMeAgent, type AuthMeModule, type AuthMeModuleOptions, type AuthMeResponse, type AuthMeTenant, type AuthorDraftInput, type BasicEmailChannelConfig, type BasicEmailChannelSecret, type CannedResponseItem, type CannedResponseListOpts, type CannedResponseSearchOpts, type CannedResponsesModule, type CannedResponsesModuleOptions, type Channel, type ChannelListItem, type ChannelStatus, type ChannelType, type ChannelsModule, type ChannelsModuleOptions, type ContactChannel, type ContactConversationSummary, type ContactFieldDefinition, type ContactFieldValue, type ContactFieldValueInput, type ContactIdentity, type ContactIdentityInput, type ContactItem, type ContactSearchOpts, type ContactTag, type ContactsMetadata, type ContactsModule, type ContactsModuleOptions, type ConversationItem, type ConversationListOpts, type ConversationsModule, type ConversationsModuleOptions, type CreateAgentInput, type CreateApiKeyInput, type CreateApiKeyResponse, type CreateCannedResponseInput, type CreateChannelBody, type CreateContactInput, type CreateEmailChannelBody, type CreateEmailTemplateInput, type CreateWhatsAppBusinessAccountBody, type CreateWhatsAppChannelBody, type CredentialsMode, type EmailChannelConfig, type EmailChannelSecret, type EmailImapConfig, type EmailSmtpConfig, type EmailTemplateItem, type EmailTemplateListOpts, type ImportApprovedResult, type ImportedTemplateResult, type LobbyEntry, type LobbyListOpts, type MessageItem, type MessageListOpts, type MessageReadUpdatePayload, type MessageStatusPayload, type MessagesModule, type MessagesModuleOptions, type OAuth2CertificateEmailChannelSecret, type OAuth2ClientSecretEmailChannelSecret, type OAuth2EmailChannelConfig, type OAuth2EmailChannelSecret, type OmnivoxClient, type OmnivoxClientOptions, OmnivoxRequestError, type PageOpts, type PageParams, type PagedResponse, type ParticipantPayload, type PatchContactInput, type PatchEmailTemplateInput, type PickupInput, type ReopenOrCreateInput, type RevokeApiKeyResponse, type SendMessageInput, type SendTemplateInput, type SubmitResult, type TemplatesModule, type TemplatesModuleOptions, type TenantsModule, type TenantsModuleOptions, type TokenProvider, type TypingIndicatorPayload, type UpdateCannedResponseInput, type UpdateChannelBody, type UpdateStatusInput, type UpdateWhatsAppTemplateInput, type WhatsAppBusinessAccountItem, type WhatsAppBusinessAccountsModule, type WhatsAppBusinessAccountsModuleOptions, type WhatsAppChannelConfig, type WhatsAppRecoveryOption, type WhatsAppTemplateDetail, type WhatsAppTemplateHistory, type WhatsAppTemplateHistoryEvent, type WhatsAppTemplateHistoryVersion, type WhatsAppTemplateItem, type WhatsAppTemplateListOpts, type WsAuth, type WsClient, type WsClientInstance, type WsClientOptions, type WsConnectionState, type WsEventPayloads, buildPageParams, createAgentsModule, createApiKeyTokenProvider, createAttachmentsModule, createAuthMeModule, createCannedResponsesModule, createChannelsModule, createContactsModule, createConversationsModule, createMessagesModule, createOmnivoxClient, createSessionTokenProvider, createTemplatesModule, createTenantsModule, createWhatsAppBusinessAccountsModule, createWsClient, iteratePages };
|