@digisglobal/omnivox-sdk 0.6.1 → 0.8.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 +128 -30
- package/dist/index.d.cts +261 -59
- package/dist/index.d.ts +261 -59
- package/dist/index.js +128 -30
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -138,6 +138,8 @@ type CannedResponsesModule = ReturnType<typeof createCannedResponsesModule>;
|
|
|
138
138
|
* Exposes the Phase-2 templates surface via two submodules:
|
|
139
139
|
*
|
|
140
140
|
* whatsapp (WABA-scoped):
|
|
141
|
+
* - list(tenantId, wabaId, opts) → GET /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates
|
|
142
|
+
* - getById(tenantId, wabaId, templateId) → GET /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates/:templateId
|
|
141
143
|
* - authorDraft(tenantId, wabaId, input) → POST /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates
|
|
142
144
|
* - importApproved(tenantId, wabaId) → POST /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates/import
|
|
143
145
|
* - update(tenantId, wabaId, templateId, input) → PATCH /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates/:templateId
|
|
@@ -172,11 +174,55 @@ interface UpdateWhatsAppTemplateInput {
|
|
|
172
174
|
body?: string;
|
|
173
175
|
[key: string]: unknown;
|
|
174
176
|
}
|
|
175
|
-
/**
|
|
177
|
+
/**
|
|
178
|
+
* A single status-event row attached to a template version, as returned nested
|
|
179
|
+
* under each version in the history response (`versions[].statusEvents[]`).
|
|
180
|
+
* These are the raw Meta callback events (plus synthetic import events).
|
|
181
|
+
*/
|
|
176
182
|
interface WhatsAppTemplateHistoryEvent {
|
|
177
|
-
|
|
183
|
+
id: string;
|
|
184
|
+
templateVersionId: string;
|
|
185
|
+
eventName: string;
|
|
186
|
+
reason: string | null;
|
|
187
|
+
createdAt: string;
|
|
188
|
+
[key: string]: unknown;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* A single template version within the history response, carrying its own
|
|
192
|
+
* ordered list of status events.
|
|
193
|
+
*/
|
|
194
|
+
interface WhatsAppTemplateHistoryVersion {
|
|
195
|
+
id: string;
|
|
196
|
+
templateId: string;
|
|
197
|
+
versionNumber: number;
|
|
198
|
+
language: string;
|
|
199
|
+
category: string;
|
|
200
|
+
body: string;
|
|
178
201
|
status: string;
|
|
202
|
+
sendability: string;
|
|
203
|
+
placeholderSnapshot: unknown;
|
|
204
|
+
supersedesVersionId: string | null;
|
|
205
|
+
providerTemplateId: string | null;
|
|
206
|
+
submittedAt: string | null;
|
|
207
|
+
createdAt: string;
|
|
179
208
|
updatedAt: string;
|
|
209
|
+
statusEvents: WhatsAppTemplateHistoryEvent[];
|
|
210
|
+
[key: string]: unknown;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* The full history for a single WhatsApp template, as returned by
|
|
214
|
+
* `whatsapp.history`. This is a single OBJECT (not an array): template-level
|
|
215
|
+
* fields plus a `versions` array ordered by `versionNumber` ascending, each
|
|
216
|
+
* version carrying its own `statusEvents`. The "current" version is the one
|
|
217
|
+
* with the highest `versionNumber`.
|
|
218
|
+
*/
|
|
219
|
+
interface WhatsAppTemplateHistory {
|
|
220
|
+
id: string;
|
|
221
|
+
whatsAppBusinessAccountId: string;
|
|
222
|
+
name: string;
|
|
223
|
+
createdAt: string;
|
|
224
|
+
updatedAt: string;
|
|
225
|
+
versions: WhatsAppTemplateHistoryVersion[];
|
|
180
226
|
[key: string]: unknown;
|
|
181
227
|
}
|
|
182
228
|
/** A WhatsApp template item returned by the API. */
|
|
@@ -187,23 +233,67 @@ interface WhatsAppTemplateItem {
|
|
|
187
233
|
status?: string;
|
|
188
234
|
[key: string]: unknown;
|
|
189
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* A single WhatsApp template together with its current (latest) version, as
|
|
238
|
+
* returned by `whatsapp.getById`. Unlike the flat list item, language/status
|
|
239
|
+
* and other version-scoped fields live under `currentVersion` — reading them at
|
|
240
|
+
* the top level would be `undefined` at runtime.
|
|
241
|
+
*/
|
|
242
|
+
interface WhatsAppTemplateDetail {
|
|
243
|
+
id: string;
|
|
244
|
+
whatsAppBusinessAccountId: string;
|
|
245
|
+
name: string;
|
|
246
|
+
createdAt: string;
|
|
247
|
+
updatedAt: string;
|
|
248
|
+
currentVersion: {
|
|
249
|
+
versionNumber: number;
|
|
250
|
+
language: string;
|
|
251
|
+
category?: string;
|
|
252
|
+
body?: string;
|
|
253
|
+
status: string;
|
|
254
|
+
[key: string]: unknown;
|
|
255
|
+
};
|
|
256
|
+
[key: string]: unknown;
|
|
257
|
+
}
|
|
258
|
+
/** Pagination + filter options for the WhatsApp templates list. */
|
|
259
|
+
interface WhatsAppTemplateListOpts {
|
|
260
|
+
/** Narrow to templates whose current version has this status (e.g. "APPROVED"). */
|
|
261
|
+
status?: string;
|
|
262
|
+
/** Case-insensitive contains-match on template name. */
|
|
263
|
+
q?: string;
|
|
264
|
+
page: number;
|
|
265
|
+
pageSize: number;
|
|
266
|
+
}
|
|
267
|
+
/** A single template upserted by an import-approved call. */
|
|
268
|
+
interface ImportedTemplateResult {
|
|
269
|
+
name: string;
|
|
270
|
+
language: string;
|
|
271
|
+
category: string;
|
|
272
|
+
version: Omit<WhatsAppTemplateHistoryVersion, 'statusEvents'>;
|
|
273
|
+
created: boolean;
|
|
274
|
+
}
|
|
190
275
|
/** Import-approved result. */
|
|
191
276
|
interface ImportApprovedResult {
|
|
192
|
-
imported:
|
|
193
|
-
[key: string]: unknown;
|
|
277
|
+
imported: ImportedTemplateResult[];
|
|
194
278
|
}
|
|
195
279
|
/** Submit result. */
|
|
196
280
|
interface SubmitResult {
|
|
197
281
|
status: string;
|
|
198
282
|
[key: string]: unknown;
|
|
199
283
|
}
|
|
200
|
-
/**
|
|
284
|
+
/**
|
|
285
|
+
* Input for creating an Email template.
|
|
286
|
+
*
|
|
287
|
+
* `variableSchema` is a name→sample-value map (variable name → default/sample
|
|
288
|
+
* value). Preview substitutes those values; the API contract stores the same
|
|
289
|
+
* shape.
|
|
290
|
+
*/
|
|
201
291
|
interface CreateEmailTemplateInput {
|
|
202
292
|
name: string;
|
|
203
293
|
subject: string;
|
|
204
294
|
htmlBody?: string;
|
|
205
295
|
textBody?: string;
|
|
206
|
-
variableSchema?: Record<string,
|
|
296
|
+
variableSchema?: Record<string, string>;
|
|
207
297
|
[key: string]: unknown;
|
|
208
298
|
}
|
|
209
299
|
/** Input for partially updating an Email template. */
|
|
@@ -212,7 +302,7 @@ interface PatchEmailTemplateInput {
|
|
|
212
302
|
subject?: string;
|
|
213
303
|
htmlBody?: string;
|
|
214
304
|
textBody?: string;
|
|
215
|
-
variableSchema?: Record<string,
|
|
305
|
+
variableSchema?: Record<string, string>;
|
|
216
306
|
[key: string]: unknown;
|
|
217
307
|
}
|
|
218
308
|
/** An Email template item returned by the API. */
|
|
@@ -222,7 +312,7 @@ interface EmailTemplateItem {
|
|
|
222
312
|
subject: string;
|
|
223
313
|
htmlBody?: string;
|
|
224
314
|
textBody?: string;
|
|
225
|
-
variableSchema?: Record<string,
|
|
315
|
+
variableSchema?: Record<string, string>;
|
|
226
316
|
[key: string]: unknown;
|
|
227
317
|
}
|
|
228
318
|
/** Paginated list response. */
|
|
@@ -239,6 +329,8 @@ interface TemplatesPagedList<T> {
|
|
|
239
329
|
interface EmailTemplateListOpts {
|
|
240
330
|
page: number;
|
|
241
331
|
pageSize: number;
|
|
332
|
+
/** Case-insensitive contains-match on template name. */
|
|
333
|
+
q?: string;
|
|
242
334
|
[key: string]: unknown;
|
|
243
335
|
}
|
|
244
336
|
/**
|
|
@@ -250,6 +342,18 @@ declare function createTemplatesModule(options: TemplatesModuleOptions): {
|
|
|
250
342
|
* WhatsApp template submodule — WABA-scoped operations.
|
|
251
343
|
*/
|
|
252
344
|
whatsapp: {
|
|
345
|
+
/**
|
|
346
|
+
* List a WhatsApp Business Account's templates (paginated, optionally status-filtered and name-searchable).
|
|
347
|
+
* Calls GET /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates.
|
|
348
|
+
*/
|
|
349
|
+
list(tenantId: string, wabaId: string, opts: WhatsAppTemplateListOpts): Promise<TemplatesPagedList<WhatsAppTemplateItem>>;
|
|
350
|
+
/**
|
|
351
|
+
* Get a single template together with its current (latest) version.
|
|
352
|
+
* Language/status and other version-scoped fields are nested under
|
|
353
|
+
* `currentVersion` — not at the top level (see WhatsAppTemplateDetail).
|
|
354
|
+
* Calls GET /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates/:templateId.
|
|
355
|
+
*/
|
|
356
|
+
getById(tenantId: string, wabaId: string, templateId: string): Promise<WhatsAppTemplateDetail>;
|
|
253
357
|
/**
|
|
254
358
|
* Author a new DRAFT template (version 1) under a WhatsApp Business Account.
|
|
255
359
|
* Calls POST /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates.
|
|
@@ -266,10 +370,14 @@ declare function createTemplatesModule(options: TemplatesModuleOptions): {
|
|
|
266
370
|
*/
|
|
267
371
|
update(tenantId: string, wabaId: string, templateId: string, input: UpdateWhatsAppTemplateInput): Promise<WhatsAppTemplateItem>;
|
|
268
372
|
/**
|
|
269
|
-
*
|
|
373
|
+
* Get the full version + status-event history for a template.
|
|
374
|
+
*
|
|
375
|
+
* Returns a single OBJECT (see WhatsAppTemplateHistory) — template-level
|
|
376
|
+
* fields plus a `versions` array ordered by versionNumber ascending, each
|
|
377
|
+
* version carrying its own `statusEvents`. NOT a flat array of events.
|
|
270
378
|
* Calls GET /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates/:templateId/history.
|
|
271
379
|
*/
|
|
272
|
-
history(tenantId: string, wabaId: string, templateId: string): Promise<
|
|
380
|
+
history(tenantId: string, wabaId: string, templateId: string): Promise<WhatsAppTemplateHistory>;
|
|
273
381
|
/**
|
|
274
382
|
* Submit a DRAFT template version to Meta for review and approval (DRAFT → PENDING_APPROVAL).
|
|
275
383
|
* Calls POST /api/v1/tenants/:id/whatsapp-business-accounts/:wabaId/templates/:templateId/submit.
|
|
@@ -469,6 +577,11 @@ interface LobbyEntry {
|
|
|
469
577
|
id: string;
|
|
470
578
|
[key: string]: unknown;
|
|
471
579
|
}
|
|
580
|
+
/** Result of picking up a lobby entry — the created/reused conversation + entry ids. */
|
|
581
|
+
interface PickupResult {
|
|
582
|
+
conversationId: string;
|
|
583
|
+
entryId: string;
|
|
584
|
+
}
|
|
472
585
|
/** Paginated list response. */
|
|
473
586
|
interface PagedList$3<T> {
|
|
474
587
|
data: T[];
|
|
@@ -543,12 +656,10 @@ declare function createConversationsModule(options: ConversationsModuleOptions):
|
|
|
543
656
|
get(id: string): Promise<ConversationItem>;
|
|
544
657
|
/**
|
|
545
658
|
* Pick up a lobby entry (atomic 4-step transaction).
|
|
546
|
-
* Returns the resulting conversation.
|
|
659
|
+
* Returns the resulting conversation + entry ids.
|
|
547
660
|
* Calls POST /api/v1/conversations/lobby/:entryId/pickup.
|
|
548
661
|
*/
|
|
549
|
-
pickup(entryId: string, input: PickupInput): Promise<
|
|
550
|
-
data: ConversationItem;
|
|
551
|
-
}>;
|
|
662
|
+
pickup(entryId: string, input: PickupInput): Promise<PickupResult>;
|
|
552
663
|
/**
|
|
553
664
|
* List APPROVED + SENDABLE WhatsApp templates eligible to re-open an
|
|
554
665
|
* expired 24-hour customer-service window for the given conversation.
|
|
@@ -580,49 +691,95 @@ interface ContactsModuleOptions extends TokenProvider {
|
|
|
580
691
|
/** Base URL of the Omnivox API (e.g. "https://api.omnivox.io"). */
|
|
581
692
|
baseUrl: string;
|
|
582
693
|
}
|
|
583
|
-
/**
|
|
694
|
+
/** Channel discriminator for a contact identity (wire enum). */
|
|
695
|
+
type ContactChannel = 'WHATSAPP' | 'EMAIL';
|
|
696
|
+
/**
|
|
697
|
+
* Identity shape for creating / adding a contact identity (request body).
|
|
698
|
+
* Matches the API Zod contract: `{ channelType, rawIdentifier }`.
|
|
699
|
+
*/
|
|
584
700
|
interface ContactIdentityInput {
|
|
585
|
-
|
|
701
|
+
channelType: ContactChannel;
|
|
702
|
+
rawIdentifier: string;
|
|
703
|
+
}
|
|
704
|
+
/** Custom-field value on a create/patch request — referenced by field NAME. */
|
|
705
|
+
interface ContactFieldValueInput {
|
|
706
|
+
fieldName: string;
|
|
586
707
|
value: string;
|
|
587
|
-
[key: string]: unknown;
|
|
588
708
|
}
|
|
589
709
|
/** Input for creating a contact. */
|
|
590
710
|
interface CreateContactInput {
|
|
591
711
|
displayName: string;
|
|
592
|
-
identities
|
|
593
|
-
|
|
712
|
+
/** Single identity (the API accepts `identity` or `identities[]`). */
|
|
713
|
+
identity?: ContactIdentityInput;
|
|
714
|
+
identities?: ContactIdentityInput[];
|
|
715
|
+
/** Tag NAMES from the catalog (unknown names → 422). Full set on create. */
|
|
716
|
+
tags?: string[];
|
|
717
|
+
/** Field values by NAME (unknown names → 422). */
|
|
718
|
+
fieldValues?: ContactFieldValueInput[];
|
|
594
719
|
}
|
|
595
|
-
/**
|
|
720
|
+
/**
|
|
721
|
+
* Input for patching a contact. The PATCH endpoint is strict — only these
|
|
722
|
+
* keys are accepted. `tags`/`fieldValues`, when present, are full-replacement.
|
|
723
|
+
*/
|
|
596
724
|
interface PatchContactInput {
|
|
597
725
|
displayName?: string;
|
|
598
726
|
isActive?: boolean;
|
|
599
|
-
|
|
727
|
+
tags?: string[];
|
|
728
|
+
fieldValues?: ContactFieldValueInput[];
|
|
600
729
|
}
|
|
601
730
|
/** Input for adding an identity to a contact. */
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
value: string;
|
|
605
|
-
[key: string]: unknown;
|
|
606
|
-
}
|
|
607
|
-
/** Contact identity resource shape. */
|
|
731
|
+
type AddIdentityInput = ContactIdentityInput;
|
|
732
|
+
/** Contact identity resource shape (response). */
|
|
608
733
|
interface ContactIdentity {
|
|
609
734
|
id: string;
|
|
610
|
-
|
|
735
|
+
channelType: ContactChannel;
|
|
736
|
+
rawIdentifier: string;
|
|
737
|
+
normalizedIdentifier?: string;
|
|
738
|
+
}
|
|
739
|
+
/** A tag reference from the tenant catalog (response). */
|
|
740
|
+
interface ContactTag {
|
|
741
|
+
id: string;
|
|
742
|
+
name: string;
|
|
743
|
+
}
|
|
744
|
+
/** A custom-field definition from the catalog (response). */
|
|
745
|
+
interface ContactFieldDefinition {
|
|
746
|
+
id: string;
|
|
747
|
+
name: string;
|
|
748
|
+
type: string;
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* A custom-field value on contact detail (response). `fieldName` is a future
|
|
752
|
+
* enrichment (DEP-13) — until it lands, join `fieldId` against `metadata().fields`.
|
|
753
|
+
*/
|
|
754
|
+
interface ContactFieldValue {
|
|
755
|
+
fieldId: string;
|
|
611
756
|
value: string;
|
|
612
|
-
|
|
757
|
+
fieldName?: string;
|
|
613
758
|
}
|
|
614
|
-
/**
|
|
759
|
+
/** A conversation summary embedded on contact detail (response). */
|
|
760
|
+
interface ContactConversationSummary {
|
|
761
|
+
id: string;
|
|
762
|
+
contactIdentityId: string;
|
|
763
|
+
status: string;
|
|
764
|
+
lastInboundAt: string | null;
|
|
765
|
+
createdAt: string;
|
|
766
|
+
updatedAt: string;
|
|
767
|
+
}
|
|
768
|
+
/** Contact resource shape returned by the API (list + detail). */
|
|
615
769
|
interface ContactItem {
|
|
616
770
|
id: string;
|
|
617
771
|
displayName: string;
|
|
772
|
+
isActive?: boolean;
|
|
773
|
+
createdAt?: string;
|
|
618
774
|
identities?: ContactIdentity[];
|
|
619
|
-
[
|
|
775
|
+
tags?: ContactTag[];
|
|
776
|
+
fieldValues?: ContactFieldValue[];
|
|
777
|
+
conversations?: ContactConversationSummary[];
|
|
620
778
|
}
|
|
621
779
|
/** Contacts metadata (tag catalog and custom-field definitions). */
|
|
622
780
|
interface ContactsMetadata {
|
|
623
|
-
tags:
|
|
624
|
-
|
|
625
|
-
[key: string]: unknown;
|
|
781
|
+
tags: ContactTag[];
|
|
782
|
+
fields: ContactFieldDefinition[];
|
|
626
783
|
}
|
|
627
784
|
/** Paginated list response. */
|
|
628
785
|
interface PagedList$2<T> {
|
|
@@ -796,24 +953,20 @@ interface CreateApiKeyInput {
|
|
|
796
953
|
}
|
|
797
954
|
/** Response from tenants.apiKeys.create() — includes raw key shown once. */
|
|
798
955
|
interface CreateApiKeyResponse {
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
raw: string;
|
|
809
|
-
};
|
|
956
|
+
id: string;
|
|
957
|
+
label: string;
|
|
958
|
+
prefix: string;
|
|
959
|
+
scopes: string[];
|
|
960
|
+
status: 'ACTIVE' | 'REVOKED';
|
|
961
|
+
lastUsedAt: string | null;
|
|
962
|
+
createdAt: string;
|
|
963
|
+
/** Raw key value — shown once and never again. */
|
|
964
|
+
raw: string;
|
|
810
965
|
}
|
|
811
966
|
/** Response from tenants.apiKeys.revoke(). */
|
|
812
967
|
interface RevokeApiKeyResponse {
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
status: 'REVOKED';
|
|
816
|
-
};
|
|
968
|
+
id: string;
|
|
969
|
+
status: 'REVOKED';
|
|
817
970
|
}
|
|
818
971
|
/** Paginated list response. */
|
|
819
972
|
interface PagedList<T> {
|
|
@@ -1127,9 +1280,7 @@ declare function createOmnivoxClient(options: OmnivoxClientOptions): {
|
|
|
1127
1280
|
assign(id: string, input: AssignInput): Promise<ConversationItem>;
|
|
1128
1281
|
listLobby(opts?: LobbyListOpts): Promise<PagedList$3<LobbyEntry>>;
|
|
1129
1282
|
get(id: string): Promise<ConversationItem>;
|
|
1130
|
-
pickup(entryId: string, input: PickupInput): Promise<
|
|
1131
|
-
data: ConversationItem;
|
|
1132
|
-
}>;
|
|
1283
|
+
pickup(entryId: string, input: PickupInput): Promise<PickupResult>;
|
|
1133
1284
|
whatsappRecoveryOptions(id: string): Promise<WhatsAppRecoveryOption[]>;
|
|
1134
1285
|
};
|
|
1135
1286
|
messages: {
|
|
@@ -1141,10 +1292,12 @@ declare function createOmnivoxClient(options: OmnivoxClientOptions): {
|
|
|
1141
1292
|
};
|
|
1142
1293
|
templates: {
|
|
1143
1294
|
whatsapp: {
|
|
1295
|
+
list(tenantId: string, wabaId: string, opts: WhatsAppTemplateListOpts): Promise<TemplatesPagedList<WhatsAppTemplateItem>>;
|
|
1296
|
+
getById(tenantId: string, wabaId: string, templateId: string): Promise<WhatsAppTemplateDetail>;
|
|
1144
1297
|
authorDraft(tenantId: string, wabaId: string, input: AuthorDraftInput): Promise<WhatsAppTemplateItem>;
|
|
1145
1298
|
importApproved(tenantId: string, wabaId: string): Promise<ImportApprovedResult>;
|
|
1146
1299
|
update(tenantId: string, wabaId: string, templateId: string, input: UpdateWhatsAppTemplateInput): Promise<WhatsAppTemplateItem>;
|
|
1147
|
-
history(tenantId: string, wabaId: string, templateId: string): Promise<
|
|
1300
|
+
history(tenantId: string, wabaId: string, templateId: string): Promise<WhatsAppTemplateHistory>;
|
|
1148
1301
|
submit(tenantId: string, wabaId: string, templateId: string): Promise<SubmitResult>;
|
|
1149
1302
|
};
|
|
1150
1303
|
email: {
|
|
@@ -1169,6 +1322,10 @@ declare function createOmnivoxClient(options: OmnivoxClientOptions): {
|
|
|
1169
1322
|
whatsappBusinessAccounts: {
|
|
1170
1323
|
list(tenantId: string): Promise<WhatsAppBusinessAccountItem[]>;
|
|
1171
1324
|
get(tenantId: string, wabaRowId: string): Promise<WhatsAppBusinessAccountItem>;
|
|
1325
|
+
create(tenantId: string, body: CreateWhatsAppBusinessAccountBody): Promise<WhatsAppBusinessAccountItem>;
|
|
1326
|
+
update(tenantId: string, wabaRowId: string, body: {
|
|
1327
|
+
name: string;
|
|
1328
|
+
}): Promise<WhatsAppBusinessAccountItem>;
|
|
1172
1329
|
};
|
|
1173
1330
|
/**
|
|
1174
1331
|
* Creates a WebSocket client connected to the `/ws/chat` namespace.
|
|
@@ -1528,12 +1685,15 @@ type AttachmentsModule = ReturnType<typeof createAttachmentsModule>;
|
|
|
1528
1685
|
/**
|
|
1529
1686
|
* WhatsApp Business Accounts module — hand-written typed wrapper over the generated client.
|
|
1530
1687
|
*
|
|
1531
|
-
* Exposes the WABA
|
|
1532
|
-
* - list(tenantId)
|
|
1533
|
-
* - get(tenantId, wabaRowId)
|
|
1688
|
+
* Exposes the WABA surface (WABA-as-identity, tenant-scoped):
|
|
1689
|
+
* - list(tenantId) → GET /api/v1/tenants/:id/whatsapp-business-accounts
|
|
1690
|
+
* - get(tenantId, wabaRowId) → GET /api/v1/tenants/:id/whatsapp-business-accounts/:wabaRowId
|
|
1691
|
+
* - create(tenantId, body) → POST /api/v1/tenants/:id/whatsapp-business-accounts
|
|
1692
|
+
* - update(tenantId, wabaRowId, body) → PATCH /api/v1/tenants/:id/whatsapp-business-accounts/:wabaRowId
|
|
1534
1693
|
*
|
|
1535
|
-
* The Console's WhatsApp templates page uses
|
|
1694
|
+
* The Console's WhatsApp templates page uses list/get to let an admin pick a WABA
|
|
1536
1695
|
* before authoring templates (`sdk.templates.whatsapp.*` requires a `wabaId`).
|
|
1696
|
+
* The Console's Channels screen uses create/update to onboard and rename a WABA.
|
|
1537
1697
|
*
|
|
1538
1698
|
* Never re-exports symbols from _generated/.
|
|
1539
1699
|
* Contains no business logic — typed transport only.
|
|
@@ -1560,9 +1720,24 @@ interface WhatsAppBusinessAccountItem {
|
|
|
1560
1720
|
/** ISO 8601 last-updated timestamp. */
|
|
1561
1721
|
updatedAt: string;
|
|
1562
1722
|
}
|
|
1723
|
+
/**
|
|
1724
|
+
* POST body to create a WhatsApp Business Account.
|
|
1725
|
+
* Mirrors `apps/api/src/channels/schemas/save-waba.schema.ts` `CreateWabaSchema`.
|
|
1726
|
+
* The `secret` block is written to the SecretsProvider and never echoed back
|
|
1727
|
+
* (ADR-0011) — the response is a {@link WhatsAppBusinessAccountItem}.
|
|
1728
|
+
*/
|
|
1729
|
+
interface CreateWhatsAppBusinessAccountBody {
|
|
1730
|
+
wabaId: string;
|
|
1731
|
+
name: string;
|
|
1732
|
+
secret: {
|
|
1733
|
+
accessToken: string;
|
|
1734
|
+
appSecret: string;
|
|
1735
|
+
webhookVerifyToken: string;
|
|
1736
|
+
};
|
|
1737
|
+
}
|
|
1563
1738
|
/**
|
|
1564
1739
|
* Creates the WhatsApp Business Accounts module — a thin typed wrapper over
|
|
1565
|
-
* the generated client. Covers the WABA
|
|
1740
|
+
* the generated client. Covers the WABA surface (list/get/create/update).
|
|
1566
1741
|
*/
|
|
1567
1742
|
declare function createWhatsAppBusinessAccountsModule(options: WhatsAppBusinessAccountsModuleOptions): {
|
|
1568
1743
|
/**
|
|
@@ -1584,8 +1759,35 @@ declare function createWhatsAppBusinessAccountsModule(options: WhatsAppBusinessA
|
|
|
1584
1759
|
* const waba = await sdk.whatsappBusinessAccounts.get('ten_acmecorp', 'waba_row_001')
|
|
1585
1760
|
*/
|
|
1586
1761
|
get(tenantId: string, wabaRowId: string): Promise<WhatsAppBusinessAccountItem>;
|
|
1762
|
+
/**
|
|
1763
|
+
* Create a WhatsApp Business Account — writes the secret to the
|
|
1764
|
+
* SecretsProvider and the non-secret row to the DB; returns the
|
|
1765
|
+
* non-secret view (no `secretRef` exposed).
|
|
1766
|
+
* Calls POST /api/v1/tenants/:id/whatsapp-business-accounts.
|
|
1767
|
+
*
|
|
1768
|
+
* @example
|
|
1769
|
+
* const waba = await sdk.whatsappBusinessAccounts.create('ten_acmecorp', {
|
|
1770
|
+
* wabaId: '123456789012345',
|
|
1771
|
+
* name: 'Acme WhatsApp',
|
|
1772
|
+
* secret: { accessToken, appSecret, webhookVerifyToken },
|
|
1773
|
+
* })
|
|
1774
|
+
*/
|
|
1775
|
+
create(tenantId: string, body: CreateWhatsAppBusinessAccountBody): Promise<WhatsAppBusinessAccountItem>;
|
|
1776
|
+
/**
|
|
1777
|
+
* Rename a WhatsApp Business Account (name only — secret material is
|
|
1778
|
+
* immutable through this endpoint).
|
|
1779
|
+
* Calls PATCH /api/v1/tenants/:id/whatsapp-business-accounts/:wabaRowId.
|
|
1780
|
+
*
|
|
1781
|
+
* @example
|
|
1782
|
+
* await sdk.whatsappBusinessAccounts.update('ten_acmecorp', 'waba_row_001', {
|
|
1783
|
+
* name: 'Renamed WhatsApp',
|
|
1784
|
+
* })
|
|
1785
|
+
*/
|
|
1786
|
+
update(tenantId: string, wabaRowId: string, body: {
|
|
1787
|
+
name: string;
|
|
1788
|
+
}): Promise<WhatsAppBusinessAccountItem>;
|
|
1587
1789
|
};
|
|
1588
1790
|
/** Return type of createWhatsAppBusinessAccountsModule. */
|
|
1589
1791
|
type WhatsAppBusinessAccountsModule = ReturnType<typeof createWhatsAppBusinessAccountsModule>;
|
|
1590
1792
|
|
|
1591
|
-
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 ContactIdentity, type ContactIdentityInput, type ContactItem, type ContactSearchOpts, 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 };
|
|
1793
|
+
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 };
|