@wokuapp/sdk 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1616 @@
1
+ /** Per-call overrides accepted by every resource method's last argument. */
2
+ interface RequestOptions {
3
+ /** Abort the request after N ms (overrides the client default). */
4
+ timeout?: number;
5
+ /** Retry budget for this call (overrides the client default). */
6
+ maxRetries?: number;
7
+ /**
8
+ * Idempotency key for a POST. One is generated automatically for creates;
9
+ * pass your own to make a specific call safe to retry with the same result.
10
+ */
11
+ idempotencyKey?: string;
12
+ /** Caller-owned abort signal; aborting rejects with a connection error. */
13
+ signal?: AbortSignal;
14
+ /** Extra headers merged over the defaults (Authorization cannot be unset). */
15
+ headers?: Record<string, string>;
16
+ /** Extra query params merged over the method's own params. */
17
+ query?: Record<string, unknown>;
18
+ }
19
+
20
+ /** The paginated envelope every `/v1` list endpoint returns. */
21
+ interface PageResponse<T> {
22
+ data: T[];
23
+ total: number;
24
+ page: number;
25
+ limit: number;
26
+ }
27
+ /**
28
+ * A single page of results plus the cursor to walk the rest. Iterate items
29
+ * across every page with `for await (const item of page)`, or walk page by
30
+ * page with `for await (const p of page.iterPages())`.
31
+ */
32
+ declare class Page<T> implements AsyncIterable<T> {
33
+ private readonly fetchPage;
34
+ private readonly options?;
35
+ readonly data: T[];
36
+ readonly total: number;
37
+ readonly page: number;
38
+ readonly limit: number;
39
+ constructor(response: PageResponse<T>, fetchPage: (page: number, opts?: RequestOptions) => Promise<Page<T>>, options?: RequestOptions | undefined);
40
+ /** Whether another page exists after this one. */
41
+ hasNextPage(): boolean;
42
+ /** Fetch the next page (throws if there is none — guard with hasNextPage). */
43
+ getNextPage(): Promise<Page<T>>;
44
+ /** Yield every item across all pages, fetching lazily as needed. */
45
+ [Symbol.asyncIterator](): AsyncIterator<T>;
46
+ /** Yield each Page, fetching lazily as needed. */
47
+ iterPages(): AsyncGenerator<Page<T>>;
48
+ }
49
+
50
+ /** Minimal subset of the Fetch API the client depends on. */
51
+ type FetchLike = (input: string, init: {
52
+ method: string;
53
+ headers: Record<string, string>;
54
+ body?: string;
55
+ signal?: AbortSignal;
56
+ }) => Promise<{
57
+ status: number;
58
+ headers: {
59
+ get(name: string): string | null;
60
+ };
61
+ text(): Promise<string>;
62
+ }>;
63
+ interface WokuClientOptions {
64
+ /** Company secret key. Defaults to `process.env.WOKU_API_KEY`. */
65
+ apiKey?: string;
66
+ /** API base URL. Defaults to `https://clientapi.woku.app`. */
67
+ baseURL?: string;
68
+ /** Per-request timeout in ms. Default 60000. */
69
+ timeout?: number;
70
+ /** Automatic retries for transient failures. Default 2. */
71
+ maxRetries?: number;
72
+ /** Custom fetch implementation. Defaults to the global `fetch`. */
73
+ fetch?: FetchLike;
74
+ /** Headers merged into every request. */
75
+ defaultHeaders?: Record<string, string>;
76
+ /**
77
+ * Allow running in a browser. Off by default: the secret key grants full
78
+ * management access and must never ship to a browser bundle.
79
+ */
80
+ dangerouslyAllowBrowser?: boolean;
81
+ }
82
+ interface RequestArgs extends RequestOptions {
83
+ body?: unknown;
84
+ /**
85
+ * Mark a POST as an idempotent create: an idempotency key is auto-generated
86
+ * (unless the caller passed one) so a retry after a transient failure returns
87
+ * the original result instead of creating twice. Left off for action POSTs
88
+ * (send/approve/test) so they are never silently replayed.
89
+ */
90
+ idempotent?: boolean;
91
+ }
92
+ /**
93
+ * Transport core: turns a resource call into an authenticated HTTP request
94
+ * with timeout, typed error mapping and jittered retries. Resource namespaces
95
+ * call {@link request} and {@link getPage}; end users use the `Woku` facade.
96
+ */
97
+ declare class WokuClient {
98
+ readonly baseURL: string;
99
+ readonly maxRetries: number;
100
+ readonly timeout: number;
101
+ private readonly apiKey;
102
+ private readonly fetch;
103
+ private readonly defaultHeaders;
104
+ constructor(options?: WokuClientOptions);
105
+ /** Issue one request and return the parsed JSON body typed as `T`. */
106
+ request<T>(method: string, path: string, args?: RequestArgs): Promise<T>;
107
+ /**
108
+ * Issue a GET that returns a paginated envelope and wrap it as a {@link Page}.
109
+ * `params` accepts any plain object (a resource's typed params interface).
110
+ */
111
+ getPage<T>(path: string, params?: object, opts?: RequestOptions): Promise<Page<T>>;
112
+ private buildUrl;
113
+ private buildHeaders;
114
+ private send;
115
+ private backoff;
116
+ }
117
+
118
+ interface components {
119
+ schemas: {
120
+ ValidationErrorResponseDto: {
121
+ /**
122
+ * @description HTTP status code
123
+ * @example 400
124
+ */
125
+ statusCode: number;
126
+ /**
127
+ * @description Array of validation error messages
128
+ * @example [
129
+ * "email must be a valid email",
130
+ * "password must be at least 8 characters"
131
+ * ]
132
+ */
133
+ message: string[];
134
+ /**
135
+ * @description Error type
136
+ * @example Bad Request
137
+ */
138
+ error: string;
139
+ };
140
+ CreateWokuApiDto: Record<string, never>;
141
+ CreateWokuFormDataApiDto: Record<string, never>;
142
+ CreateExternalTrackerDefinitionDTO: {
143
+ /**
144
+ * @description Tracker name. Identifies the tracker within the company catalog. Unique per company.
145
+ * @example trr
146
+ */
147
+ name: string;
148
+ /**
149
+ * @description External system this tracker maps to.
150
+ * @example crm interno
151
+ */
152
+ system: string;
153
+ /**
154
+ * @description Human-readable description of the tracker.
155
+ * @example transaction id of a lease or sale
156
+ */
157
+ description?: string;
158
+ };
159
+ AssignWokuExternalTrackerByNameDTO: {
160
+ /**
161
+ * @description Name of the company-level external tracker definition this value belongs to.
162
+ * @example trr
163
+ */
164
+ name: string;
165
+ /**
166
+ * @description External identifier value (always stored as string).
167
+ * @example dasdj123kdak32
168
+ */
169
+ value: string;
170
+ };
171
+ ExternalTrackerFilterDTO: {
172
+ /**
173
+ * @description Tracker name (resolved to its definition server-side).
174
+ * @example trr
175
+ */
176
+ name: string;
177
+ /**
178
+ * @description Value to match (partial, case-insensitive).
179
+ * @example ABC
180
+ */
181
+ value: string;
182
+ };
183
+ SearchEntitiesByTrackersDTO: {
184
+ /**
185
+ * @description VoC entity type to search.
186
+ * @example nps
187
+ * @enum {string}
188
+ */
189
+ entityType: 'nps' | 'csat' | 'ces' | 'form' | 'flow';
190
+ /** @description Tracker filters combined with AND. Each entity must match every filter to be returned. */
191
+ filters: components['schemas']['ExternalTrackerFilterDTO'][];
192
+ };
193
+ UpdateExternalTrackerDefinitionDTO: {
194
+ /** @description New name (must remain unique within the company). */
195
+ name?: string;
196
+ /** @description New external system identifier. */
197
+ system?: string;
198
+ /** @description New description. */
199
+ description?: string;
200
+ };
201
+ AssignExternalTrackerByNameDTO: {
202
+ /**
203
+ * @description Name of the company-level external tracker definition this value belongs to.
204
+ * @example trr
205
+ */
206
+ name: string;
207
+ /**
208
+ * @description External identifier value (always stored as string).
209
+ * @example dasdj123kdak32
210
+ */
211
+ value: string;
212
+ };
213
+ TicketRoutingConditionDto: {
214
+ /** @enum {string} */
215
+ relationToPrevious?: 'AND' | 'OR';
216
+ /** @description CompanyExternalTracker id. */
217
+ trackerId: string;
218
+ /**
219
+ * @default equals
220
+ * @enum {string}
221
+ */
222
+ operator: 'equals' | 'any';
223
+ /** @description The value the tracker must equal. Required unless operator is "any". */
224
+ value?: string;
225
+ };
226
+ TicketDestinationTemplateDto: {
227
+ /** @example custom */
228
+ preset: string;
229
+ /** @description Custom JSON body with {{path}} placeholders. */
230
+ body?: string;
231
+ };
232
+ CreateTicketDestinationDto: {
233
+ /** @example Zendesk Soporte Chile */
234
+ name: string;
235
+ /** @enum {string} */
236
+ kind: 'zendesk' | 'salesforce' | 'slack' | 'custom' | 'email';
237
+ /** @description Non-secret provider config (validated per kind). */
238
+ config: Record<string, never>;
239
+ /** @description Provider credentials (write-only, encrypted). */
240
+ credentials: Record<string, never>;
241
+ /** @description Per-destination AI triage context. */
242
+ aiContext?: string;
243
+ routingConditions?: components['schemas']['TicketRoutingConditionDto'][];
244
+ template?: components['schemas']['TicketDestinationTemplateDto'];
245
+ };
246
+ UpdateTicketDestinationDto: {
247
+ name?: string;
248
+ /** @enum {string} */
249
+ kind?: 'zendesk' | 'salesforce' | 'slack' | 'custom' | 'email';
250
+ config?: Record<string, never>;
251
+ /** @description Present = credential rotation. */
252
+ credentials?: Record<string, never>;
253
+ /** @description Per-destination AI triage context. */
254
+ aiContext?: string;
255
+ routingConditions?: components['schemas']['TicketRoutingConditionDto'][];
256
+ template?: components['schemas']['TicketDestinationTemplateDto'];
257
+ enabled?: boolean;
258
+ };
259
+ TestTicketDestinationBodyDTO: {
260
+ /** @description Must be true. The test sends a real request to the destination (custom webhooks receive a test payload; other kinds run a read-only auth probe). */
261
+ confirm: boolean;
262
+ };
263
+ ActionPlanGroupConditionDto: {
264
+ /** @enum {string} */
265
+ relationToPrevious?: 'AND' | 'OR';
266
+ /** @description CompanyExternalTracker id. */
267
+ trackerId: string;
268
+ /**
269
+ * @default equals
270
+ * @enum {string}
271
+ */
272
+ operator: 'equals' | 'any';
273
+ /** @description The value the tracker must equal. Required unless operator is "any". */
274
+ value?: string;
275
+ };
276
+ ActionPlanGroupMemberDto: {
277
+ /** @description Company member user id. */
278
+ userId: string;
279
+ /** @enum {string} */
280
+ role: 'admin' | 'assignee';
281
+ };
282
+ CreateActionPlanGroupDto: {
283
+ /** @example Atención en tienda */
284
+ name: string;
285
+ description?: string;
286
+ /** @description Tracker conditions; at least one row is required. */
287
+ conditions: components['schemas']['ActionPlanGroupConditionDto'][];
288
+ /** @description Group team; at least one admin and one assignee. */
289
+ members: components['schemas']['ActionPlanGroupMemberDto'][];
290
+ /**
291
+ * @description New improvement comments that trigger a plan draft (default 300).
292
+ * @default 300
293
+ */
294
+ threshold: number;
295
+ };
296
+ UpdateActionPlanGroupDto: {
297
+ name?: string;
298
+ /** @description Empty string clears. */
299
+ description?: string;
300
+ conditions?: components['schemas']['ActionPlanGroupConditionDto'][];
301
+ members?: components['schemas']['ActionPlanGroupMemberDto'][];
302
+ threshold?: number;
303
+ };
304
+ SetActionPlanGroupEnabledDto: {
305
+ enabled: boolean;
306
+ };
307
+ PostPlanReplyBodyDTO: {
308
+ /** @description Message to send to the plan AI agent. */
309
+ text: string;
310
+ /** @description Must be true. Each reply triggers a paid AI turn; the reply is composed asynchronously and delivered over the plan channel. */
311
+ confirm: boolean;
312
+ };
313
+ SendActionPlanDto: {
314
+ /** @enum {string} */
315
+ provider: 'jira' | 'monday' | 'clickup' | 'notion' | 'internal';
316
+ /** @description Provider-specific resource ids (external providers): jira {siteId?, projectId, issueTypeId} · monday {boardId, groupId} · clickup {listId} · notion {databaseId}. Omitted for the managed provider. */
317
+ target?: Record<string, never>;
318
+ /** @description Human destination summary the drawer built ("Operaciones CX · Backlog"); persisted as delivery.resourceLabel. Omitted for the managed provider. */
319
+ resourceLabel?: string;
320
+ };
321
+ CreateActionPlanTaskDto: {
322
+ /** @description Task text. */
323
+ text: string;
324
+ };
325
+ ReorderActionPlanTasksDto: {
326
+ /** @description All task ids in the desired order. */
327
+ orderedTaskIds: string[];
328
+ };
329
+ UpdateActionPlanTaskDto: {
330
+ /** @description New task text. */
331
+ text?: string;
332
+ /** @enum {string} */
333
+ status?: 'todo' | 'in_progress' | 'done';
334
+ /** @description Group member responsible; null/"" clears the assignee. */
335
+ assigneeId?: string;
336
+ };
337
+ V1WokuLocalizedContentDTO: {
338
+ /**
339
+ * @example en
340
+ * @enum {string}
341
+ */
342
+ locale: 'es' | 'en';
343
+ description: string;
344
+ };
345
+ UpdateWokuBodyDTO: {
346
+ /** @description Woku description/title. */
347
+ description?: string;
348
+ /**
349
+ * @description Locales the survey is available in (subset of es/en).
350
+ * @example [
351
+ * "es",
352
+ * "en"
353
+ * ]
354
+ */
355
+ availableLocales?: string[];
356
+ /** @enum {string} */
357
+ defaultLocale?: 'es' | 'en';
358
+ localizedContent?: components['schemas']['V1WokuLocalizedContentDTO'][];
359
+ };
360
+ UpdateWokuSettingsBodyDTO: {
361
+ /** @description Whether the woku is closed to new reviews. */
362
+ closed?: boolean;
363
+ /** @description Whether new reviews are disabled. */
364
+ reviewsDisabled?: boolean;
365
+ /** @description Whether anonymous reviews are disabled. */
366
+ anonymousDisabled?: boolean;
367
+ /** @description Whether each client may leave only one review. */
368
+ onlyOneReviewPerClient?: boolean;
369
+ };
370
+ MoveWokuBodyDTO: {
371
+ /**
372
+ * Format: ObjectId
373
+ * @description Target folder id, or null to move the woku to the root.
374
+ */
375
+ folderId: string | null;
376
+ };
377
+ V1CreateTextnoteBodyDto: {
378
+ /**
379
+ * @description Star rating (1-5)
380
+ * @example 5
381
+ */
382
+ qualification: number;
383
+ /** @description Text content of the review (max 3000 chars) */
384
+ description: string;
385
+ /** @description Reviewer email */
386
+ clientEmail?: string;
387
+ /** @description Reviewer phone */
388
+ clientPhone?: string;
389
+ /** @description Whether the review is anonymous */
390
+ anonymous?: boolean;
391
+ /**
392
+ * @description Inbound response channel. Defaults to 'api'; a value provided here REPLACES 'api' (user-defined channel).
393
+ * @example my-crm
394
+ */
395
+ responseChannel?: string;
396
+ };
397
+ V1CreateVoicemailBodyDto: {
398
+ /**
399
+ * Format: binary
400
+ * @description Audio file for the voicemail
401
+ */
402
+ file: string;
403
+ /**
404
+ * @description Star rating (1-5)
405
+ * @example 5
406
+ * @enum {string}
407
+ */
408
+ qualification: '1' | '2' | '3' | '4' | '5';
409
+ /**
410
+ * @description Spoken language used to improve audio transcription
411
+ * @example es
412
+ * @enum {string}
413
+ */
414
+ language: 'es' | 'en';
415
+ /** @description Reviewer email */
416
+ clientEmail?: string;
417
+ /** @description Reviewer phone */
418
+ clientPhone?: string;
419
+ /**
420
+ * @description Whether the review is anonymous
421
+ * @enum {string}
422
+ */
423
+ anonymous?: 'true' | 'false';
424
+ /**
425
+ * @description Inbound response channel. Defaults to 'api'; a value provided here REPLACES 'api' (user-defined channel).
426
+ * @example my-crm
427
+ */
428
+ responseChannel?: string;
429
+ };
430
+ V1ShareWokuBodyDto: {
431
+ /** @description Single email address */
432
+ clientEmail?: string;
433
+ /** @description Array of email addresses */
434
+ clientEmails?: string[];
435
+ };
436
+ V1ApiKeyResultDto: {
437
+ /** @description The new company secret API key. The previous key is now invalid; store this value, it is not retrievable again. */
438
+ apiKey: string;
439
+ };
440
+ V1RevokeApiKeyResultDto: {
441
+ /**
442
+ * @description Always true once the key has been revoked.
443
+ * @example true
444
+ */
445
+ revoked: boolean;
446
+ };
447
+ V1CreateNpsBodyDto: {
448
+ /**
449
+ * @description NPS score 0-10 (0-6 detractor, 7-8 passive, 9-10 promoter)
450
+ * @example 9
451
+ */
452
+ score: number;
453
+ /**
454
+ * Format: ObjectId
455
+ * @description Optional NPS tool id. With it the capture is tool-specific; without it, company-level.
456
+ */
457
+ npsToolId?: string;
458
+ /**
459
+ * Format: email
460
+ * @description Respondent email. Omit for an anonymous capture.
461
+ */
462
+ clientEmail?: string;
463
+ /** @description Whether the submission is anonymous (no client email stored). */
464
+ anonymous?: boolean;
465
+ /**
466
+ * @description Inbound response channel. Defaults to 'api'; a value provided here REPLACES 'api' (user-defined channel). Stored on the NPS.
467
+ * @example my-crm
468
+ */
469
+ responseChannel?: string;
470
+ /**
471
+ * @description Opaque invitation dispatch token echoed from the link (?dtoken=). Consumed to mark the outbound invitation responded; never persisted.
472
+ * @example a1b2c3d4-...
473
+ */
474
+ dispatchToken?: string;
475
+ };
476
+ V1CreateNpsTextnoteBodyDto: {
477
+ /**
478
+ * @description Text feedback content
479
+ * @example El producto cumple mis expectativas.
480
+ */
481
+ description: string;
482
+ };
483
+ V1CreateCsatBodyDto: {
484
+ /**
485
+ * @description CSAT satisfaction score 1-5
486
+ * @example 4
487
+ */
488
+ score: number;
489
+ /**
490
+ * Format: ObjectId
491
+ * @description CSAT tool id (always required: CSAT tools are always custom)
492
+ */
493
+ csatToolId: string;
494
+ /**
495
+ * Format: email
496
+ * @description Respondent email. Omit for an anonymous capture.
497
+ */
498
+ clientEmail?: string;
499
+ /** @description Whether the submission is anonymous (no client email stored). */
500
+ anonymous?: boolean;
501
+ /**
502
+ * @description Inbound response channel. Defaults to 'api'; a value provided here REPLACES 'api' (user-defined channel). Stored on the response.
503
+ * @example my-crm
504
+ */
505
+ responseChannel?: string;
506
+ /** @description Opaque invitation dispatch token echoed from the link (?dtoken=). Consumed to mark the outbound invitation responded; never persisted. */
507
+ dispatchToken?: string;
508
+ };
509
+ V1CreateCsatTextnoteBodyDto: {
510
+ /**
511
+ * @description Text feedback content
512
+ * @example El proceso fue muy facil.
513
+ */
514
+ description: string;
515
+ };
516
+ V1CreateCesBodyDto: {
517
+ /**
518
+ * @description CES effort score 1-5
519
+ * @example 4
520
+ */
521
+ score: number;
522
+ /**
523
+ * Format: ObjectId
524
+ * @description CES tool id (always required: CES tools are always custom)
525
+ */
526
+ cesToolId: string;
527
+ /**
528
+ * Format: email
529
+ * @description Respondent email. Omit for an anonymous capture.
530
+ */
531
+ clientEmail?: string;
532
+ /** @description Whether the submission is anonymous (no client email stored). */
533
+ anonymous?: boolean;
534
+ /**
535
+ * @description Inbound response channel. Defaults to 'api'; a value provided here REPLACES 'api' (user-defined channel). Stored on the response.
536
+ * @example my-crm
537
+ */
538
+ responseChannel?: string;
539
+ /** @description Opaque invitation dispatch token echoed from the link (?dtoken=). Consumed to mark the outbound invitation responded; never persisted. */
540
+ dispatchToken?: string;
541
+ };
542
+ V1CreateCesTextnoteBodyDto: {
543
+ /**
544
+ * @description Text feedback content
545
+ * @example Resolver fue muy facil.
546
+ */
547
+ description: string;
548
+ };
549
+ V1CaptureAudioDto: {
550
+ /** @description Device-local URI of the recorded audio */
551
+ uri?: string;
552
+ /** @description Audio MIME type, e.g. audio/m4a */
553
+ mimeType?: string;
554
+ /** @description Duration in milliseconds */
555
+ durationMs?: number;
556
+ };
557
+ V1CaptureRespondentDto: {
558
+ /** @description Respondent email */
559
+ email?: string;
560
+ /** @description Respondent phone */
561
+ phone?: string;
562
+ /** @description Host-app external id (e.g. CRM id) */
563
+ externalId?: string;
564
+ };
565
+ V1CaptureBodyDto: {
566
+ /** @description Client-generated idempotency id */
567
+ id?: string;
568
+ /**
569
+ * @example woku
570
+ * @enum {string}
571
+ */
572
+ kind: 'woku' | 'nps' | 'csat' | 'ces';
573
+ /**
574
+ * @description Spoken language. Required when the capture includes an audio file.
575
+ * @enum {string}
576
+ */
577
+ language?: 'es' | 'en';
578
+ /** @description Target id: the wokuId for a woku capture, the (optional) npsToolId for an NPS capture, or the (required) csatToolId/cesToolId for a CSAT/CES capture (those tools are always custom). */
579
+ targetId?: string;
580
+ /**
581
+ * @description Woku star rating 1-5
582
+ * @example 5
583
+ */
584
+ rating?: number;
585
+ /**
586
+ * @description NPS score 0-10
587
+ * @example 9
588
+ */
589
+ score?: number;
590
+ /** @description Free-text comment */
591
+ comment?: string;
592
+ audio?: components['schemas']['V1CaptureAudioDto'];
593
+ respondent?: components['schemas']['V1CaptureRespondentDto'];
594
+ };
595
+ V1CreateNpsInvitationsBodyDto: {
596
+ /**
597
+ * @description Delivery channel for the invitations
598
+ * @example whatsapp
599
+ * @enum {string}
600
+ */
601
+ channel: 'email' | 'whatsapp';
602
+ /**
603
+ * @description Recipients: email addresses for the email channel, phone numbers (digits, country code included, e.g. 56912345678) for whatsapp
604
+ * @example [
605
+ * "56912345678"
606
+ * ]
607
+ */
608
+ recipients: string[];
609
+ /**
610
+ * @description Language of the invitation template
611
+ * @example es
612
+ * @enum {string}
613
+ */
614
+ language?: 'es' | 'en';
615
+ /**
616
+ * Format: ObjectId
617
+ * @description NPS tool to survey for. Omit to send the company-level NPS survey.
618
+ */
619
+ npsToolId?: string;
620
+ };
621
+ V1RejectedInvitationDto: {
622
+ /** @description Recipient as received in the request */
623
+ recipient: string;
624
+ /**
625
+ * @description Why the invitation was not dispatched
626
+ * @enum {string}
627
+ */
628
+ reason: 'invalid_recipient' | 'quarantined' | 'insufficient_credits_or_blocked' | 'send_failed';
629
+ };
630
+ V1InvitationsResultDto: {
631
+ /** @enum {string} */
632
+ channel: 'email' | 'whatsapp';
633
+ /** @description Recipients whose invitation was dispatched (or queued) */
634
+ accepted: string[];
635
+ /** @description Recipients whose invitation was not dispatched, with reason */
636
+ rejected: components['schemas']['V1RejectedInvitationDto'][];
637
+ };
638
+ V1CreateCsatInvitationsBodyDto: {
639
+ /**
640
+ * @description Delivery channel for the invitations
641
+ * @example whatsapp
642
+ * @enum {string}
643
+ */
644
+ channel: 'email' | 'whatsapp';
645
+ /**
646
+ * @description Recipients: email addresses for the email channel, phone numbers (digits, country code included, e.g. 56912345678) for whatsapp
647
+ * @example [
648
+ * "56912345678"
649
+ * ]
650
+ */
651
+ recipients: string[];
652
+ /**
653
+ * @description Language of the invitation template
654
+ * @example es
655
+ * @enum {string}
656
+ */
657
+ language?: 'es' | 'en';
658
+ /**
659
+ * Format: ObjectId
660
+ * @description CSAT tool to survey for (always required: always custom).
661
+ */
662
+ csatToolId: string;
663
+ };
664
+ V1CreateCesInvitationsBodyDto: {
665
+ /**
666
+ * @description Delivery channel for the invitations
667
+ * @example whatsapp
668
+ * @enum {string}
669
+ */
670
+ channel: 'email' | 'whatsapp';
671
+ /**
672
+ * @description Recipients: email addresses for the email channel, phone numbers (digits, country code included, e.g. 56912345678) for whatsapp
673
+ * @example [
674
+ * "56912345678"
675
+ * ]
676
+ */
677
+ recipients: string[];
678
+ /**
679
+ * @description Language of the invitation template
680
+ * @example es
681
+ * @enum {string}
682
+ */
683
+ language?: 'es' | 'en';
684
+ /**
685
+ * Format: ObjectId
686
+ * @description CES tool to survey for (always required: always custom).
687
+ */
688
+ cesToolId: string;
689
+ };
690
+ V1CreateInvitationsBodyDto: {
691
+ /**
692
+ * @description Delivery channel for the invitations
693
+ * @example whatsapp
694
+ * @enum {string}
695
+ */
696
+ channel: 'email' | 'whatsapp';
697
+ /**
698
+ * @description Recipients: email addresses for the email channel, phone numbers (digits, country code included, e.g. 56912345678) for whatsapp
699
+ * @example [
700
+ * "56912345678"
701
+ * ]
702
+ */
703
+ recipients: string[];
704
+ /**
705
+ * @description Language of the invitation template
706
+ * @example es
707
+ * @enum {string}
708
+ */
709
+ language?: 'es' | 'en';
710
+ };
711
+ V1CreateFormResponseBodyDto: {
712
+ /**
713
+ * @description Whether this response is anonymous
714
+ * @example false
715
+ */
716
+ anonymous: boolean;
717
+ /**
718
+ * @description Email of the respondent (required when the form identifies clients by email and the response is not anonymous)
719
+ * @example respondent@example.com
720
+ */
721
+ email?: string;
722
+ /**
723
+ * @description Phone of the respondent (required when the form identifies clients by phone and the response is not anonymous)
724
+ * @example +56912345678
725
+ */
726
+ phone?: string;
727
+ /**
728
+ * @description Answers keyed by field id
729
+ * @example {
730
+ * "field-uuid-1": "John Doe",
731
+ * "field-uuid-2": 5
732
+ * }
733
+ */
734
+ answers: Record<string, never>;
735
+ /**
736
+ * @description Inbound response channel. Defaults to 'api'; a value provided here REPLACES 'api' (user-defined channel). Stored on the response.
737
+ * @example my-crm
738
+ */
739
+ responseChannel?: string;
740
+ /**
741
+ * @description Opaque invitation dispatch token echoed from the link (?dtoken=). Consumed to mark the outbound invitation responded; never persisted.
742
+ * @example a1b2c3d4-...
743
+ */
744
+ dispatchToken?: string;
745
+ };
746
+ NpsToolLocalizedContentBodyDTO: {
747
+ /**
748
+ * @example en
749
+ * @enum {string}
750
+ */
751
+ locale: 'es' | 'en';
752
+ /**
753
+ * @description Translated NPS question for this locale.
754
+ * @example How likely are you to recommend us?
755
+ */
756
+ npsMessage: string;
757
+ /**
758
+ * @description Translated audience for this locale.
759
+ * @example customers
760
+ */
761
+ audienceType?: string;
762
+ };
763
+ CreateNpsToolBodyDTO: {
764
+ /**
765
+ * @description Tool name for identification.
766
+ * @example Post-Purchase Survey
767
+ */
768
+ name: string;
769
+ /**
770
+ * @description Public NPS question shown to respondents.
771
+ * @example How likely are you to recommend our service to a friend?
772
+ */
773
+ npsMessage: string;
774
+ /**
775
+ * @description Audience the survey targets.
776
+ * @example customers
777
+ */
778
+ audienceType?: string;
779
+ /**
780
+ * @description Locales the tool is available in (subset of es/en).
781
+ * @example [
782
+ * "es",
783
+ * "en"
784
+ * ]
785
+ */
786
+ availableLocales?: string[];
787
+ /**
788
+ * @description Default locale used when none is requested.
789
+ * @example es
790
+ * @enum {string}
791
+ */
792
+ defaultLocale?: 'es' | 'en';
793
+ localizedContent?: components['schemas']['NpsToolLocalizedContentBodyDTO'][];
794
+ };
795
+ UpdateNpsToolBodyDTO: {
796
+ name?: string;
797
+ npsMessage?: string;
798
+ audienceType?: string;
799
+ /**
800
+ * @example [
801
+ * "es",
802
+ * "en"
803
+ * ]
804
+ */
805
+ availableLocales?: string[];
806
+ /** @enum {string} */
807
+ defaultLocale?: 'es' | 'en';
808
+ localizedContent?: components['schemas']['NpsToolLocalizedContentBodyDTO'][];
809
+ };
810
+ CsatToolLocalizedContentBodyDTO: {
811
+ /**
812
+ * @example en
813
+ * @enum {string}
814
+ */
815
+ locale: 'es' | 'en';
816
+ /**
817
+ * @description Translated CSAT question for this locale.
818
+ * @example How satisfied are you with your purchase?
819
+ */
820
+ question: string;
821
+ /**
822
+ * @description Translated subject for this locale.
823
+ * @example your purchase
824
+ */
825
+ subject?: string;
826
+ };
827
+ CreateCsatToolBodyDTO: {
828
+ /**
829
+ * @description Tool name for identification.
830
+ * @example Post-Purchase CSAT
831
+ */
832
+ name: string;
833
+ /**
834
+ * @description Public CSAT question shown to respondents.
835
+ * @example How satisfied are you with your purchase?
836
+ */
837
+ question: string;
838
+ /**
839
+ * @description Static variable filling 'how satisfied are you with [subject]?'.
840
+ * @example your purchase
841
+ */
842
+ subject?: string;
843
+ /**
844
+ * @description Locales the tool is available in (subset of es/en).
845
+ * @example [
846
+ * "es",
847
+ * "en"
848
+ * ]
849
+ */
850
+ availableLocales?: string[];
851
+ /**
852
+ * @description Default locale used when none is requested.
853
+ * @example es
854
+ * @enum {string}
855
+ */
856
+ defaultLocale?: 'es' | 'en';
857
+ localizedContent?: components['schemas']['CsatToolLocalizedContentBodyDTO'][];
858
+ };
859
+ UpdateCsatToolBodyDTO: {
860
+ name?: string;
861
+ question?: string;
862
+ subject?: string;
863
+ /**
864
+ * @example [
865
+ * "es",
866
+ * "en"
867
+ * ]
868
+ */
869
+ availableLocales?: string[];
870
+ /** @enum {string} */
871
+ defaultLocale?: 'es' | 'en';
872
+ localizedContent?: components['schemas']['CsatToolLocalizedContentBodyDTO'][];
873
+ };
874
+ CesToolLocalizedContentBodyDTO: {
875
+ /**
876
+ * @example en
877
+ * @enum {string}
878
+ */
879
+ locale: 'es' | 'en';
880
+ /**
881
+ * @description Translated CES question for this locale.
882
+ * @example How easy was it to complete your purchase?
883
+ */
884
+ question: string;
885
+ /**
886
+ * @description Translated action for this locale.
887
+ * @example complete your purchase
888
+ */
889
+ action?: string;
890
+ };
891
+ CreateCesToolBodyDTO: {
892
+ /**
893
+ * @description Tool name for identification.
894
+ * @example Post-Purchase Effort
895
+ */
896
+ name: string;
897
+ /**
898
+ * @description Public effort question shown to respondents.
899
+ * @example How easy was it to complete your purchase?
900
+ */
901
+ question: string;
902
+ /**
903
+ * @description Static variable filling 'how easy was it to [action]?'.
904
+ * @example complete your purchase
905
+ */
906
+ action?: string;
907
+ /**
908
+ * @description Locales the tool is available in (subset of es/en).
909
+ * @example [
910
+ * "es",
911
+ * "en"
912
+ * ]
913
+ */
914
+ availableLocales?: string[];
915
+ /**
916
+ * @description Default locale used when none is requested.
917
+ * @example es
918
+ * @enum {string}
919
+ */
920
+ defaultLocale?: 'es' | 'en';
921
+ localizedContent?: components['schemas']['CesToolLocalizedContentBodyDTO'][];
922
+ };
923
+ UpdateCesToolBodyDTO: {
924
+ name?: string;
925
+ question?: string;
926
+ action?: string;
927
+ /**
928
+ * @example [
929
+ * "es",
930
+ * "en"
931
+ * ]
932
+ */
933
+ availableLocales?: string[];
934
+ /** @enum {string} */
935
+ defaultLocale?: 'es' | 'en';
936
+ localizedContent?: components['schemas']['CesToolLocalizedContentBodyDTO'][];
937
+ };
938
+ UpdateTicketBodyDTO: {
939
+ title?: string;
940
+ /** @enum {string} */
941
+ severity?: 'high' | 'medium' | 'low';
942
+ aiSummary?: string;
943
+ aiCategory?: string;
944
+ };
945
+ };
946
+ responses: never;
947
+ parameters: never;
948
+ requestBodies: never;
949
+ headers: never;
950
+ pathItems: never;
951
+ }
952
+
953
+ /** The full generated schema map (advanced use / escape hatch). */
954
+ type Schemas = components['schemas'];
955
+ type CreateTrackerParams = Schemas['CreateExternalTrackerDefinitionDTO'];
956
+ type UpdateTrackerParams = Schemas['UpdateExternalTrackerDefinitionDTO'];
957
+ type SearchEntitiesByTrackersParams = Schemas['SearchEntitiesByTrackersDTO'];
958
+ type AssignTrackerByNameParams = Schemas['AssignExternalTrackerByNameDTO'];
959
+ type CreateNpsToolParams = Schemas['CreateNpsToolBodyDTO'];
960
+ type UpdateNpsToolParams = Schemas['UpdateNpsToolBodyDTO'];
961
+ type CreateCsatToolParams = Schemas['CreateCsatToolBodyDTO'];
962
+ type UpdateCsatToolParams = Schemas['UpdateCsatToolBodyDTO'];
963
+ type CreateCesToolParams = Schemas['CreateCesToolBodyDTO'];
964
+ type UpdateCesToolParams = Schemas['UpdateCesToolBodyDTO'];
965
+ type SendInvitationsParams = Schemas['V1CreateInvitationsBodyDto'];
966
+ type SendNpsInvitationsParams = Schemas['V1CreateNpsInvitationsBodyDto'];
967
+ type SendCsatInvitationsParams = Schemas['V1CreateCsatInvitationsBodyDto'];
968
+ type SendCesInvitationsParams = Schemas['V1CreateCesInvitationsBodyDto'];
969
+ type CreateWokuParams = Schemas['CreateWokuApiDto'];
970
+ type UpdateWokuParams = Schemas['UpdateWokuBodyDTO'];
971
+ type UpdateWokuSettingsParams = Schemas['UpdateWokuSettingsBodyDTO'];
972
+ type MoveWokuParams = Schemas['MoveWokuBodyDTO'];
973
+ type ShareWokuParams = Schemas['V1ShareWokuBodyDto'];
974
+ type UpdateTicketParams = Schemas['UpdateTicketBodyDTO'];
975
+ type CreateTicketDestinationParams = Schemas['CreateTicketDestinationDto'];
976
+ type UpdateTicketDestinationParams = Schemas['UpdateTicketDestinationDto'];
977
+ type CreateActionPlanGroupParams = Schemas['CreateActionPlanGroupDto'];
978
+ type UpdateActionPlanGroupParams = Schemas['UpdateActionPlanGroupDto'];
979
+ type SendActionPlanParams = Schemas['SendActionPlanDto'];
980
+ type CreateActionPlanTaskParams = Schemas['CreateActionPlanTaskDto'];
981
+ type UpdateActionPlanTaskParams = Schemas['UpdateActionPlanTaskDto'];
982
+ type ReorderActionPlanTasksParams = Schemas['ReorderActionPlanTasksDto'];
983
+ type PostPlanReplyParams = Schemas['PostPlanReplyBodyDTO'];
984
+
985
+ /**
986
+ * Response models. The `/v1` controllers return curated, projected documents;
987
+ * these mirror those shapes. Where the server returns an opaque document the
988
+ * type is {@link WokuRecord} (a permissive object) rather than a false promise
989
+ * of exhaustive typing.
990
+ */
991
+ /** A JSON object the SDK does not exhaustively type. */
992
+ type WokuRecord = Record<string, unknown>;
993
+ type FeedbackType = 'recognition' | 'improvement';
994
+ type Severity = 'high' | 'medium' | 'low';
995
+ type Locale = 'es' | 'en';
996
+ type Channel = 'email' | 'whatsapp';
997
+ /** External tracker definition (curated). */
998
+ interface Tracker {
999
+ _id: string;
1000
+ name: string;
1001
+ system: string;
1002
+ description?: string;
1003
+ active?: boolean;
1004
+ createdAt?: string;
1005
+ updatedAt?: string;
1006
+ }
1007
+ /** Result of a VoC-entity search by tracker filters. */
1008
+ interface EntitiesByTrackers {
1009
+ entityType: string;
1010
+ total: number;
1011
+ matches: WokuRecord[];
1012
+ }
1013
+ interface ToolLocalizedContent {
1014
+ locale: string;
1015
+ [key: string]: unknown;
1016
+ }
1017
+ /** NPS tool definition (curated, no internal fields). */
1018
+ interface NpsTool {
1019
+ _id: string;
1020
+ name: string;
1021
+ npsMessage: string;
1022
+ audienceType?: string;
1023
+ availableLocales?: string[];
1024
+ defaultLocale?: string;
1025
+ localizedContent?: ToolLocalizedContent[];
1026
+ createdAt?: string;
1027
+ }
1028
+ /** CSAT tool definition (curated). */
1029
+ interface CsatTool {
1030
+ _id: string;
1031
+ name: string;
1032
+ question: string;
1033
+ subject?: string;
1034
+ availableLocales?: string[];
1035
+ defaultLocale?: string;
1036
+ localizedContent?: ToolLocalizedContent[];
1037
+ createdAt?: string;
1038
+ }
1039
+ /** CES tool definition (curated). */
1040
+ interface CesTool {
1041
+ _id: string;
1042
+ name: string;
1043
+ question: string;
1044
+ action?: string;
1045
+ availableLocales?: string[];
1046
+ defaultLocale?: string;
1047
+ localizedContent?: ToolLocalizedContent[];
1048
+ createdAt?: string;
1049
+ }
1050
+ /** Acknowledgement returned by tool deletes. */
1051
+ interface DeletedResult {
1052
+ deleted: true;
1053
+ id: string;
1054
+ }
1055
+ /** Per-recipient outcome of a survey send. */
1056
+ interface InvitationsResult {
1057
+ accepted: number;
1058
+ rejected: number;
1059
+ rejectedRecipients?: Array<{
1060
+ recipient?: string;
1061
+ reason?: string;
1062
+ }>;
1063
+ [key: string]: unknown;
1064
+ }
1065
+ /** Support ticket (curated allow-list). */
1066
+ interface Ticket {
1067
+ _id: string;
1068
+ code?: string;
1069
+ title: string;
1070
+ severity: Severity;
1071
+ destinationId?: string;
1072
+ origin?: WokuRecord;
1073
+ score?: WokuRecord;
1074
+ aiSummary?: string;
1075
+ aiCategory?: string;
1076
+ sentiment?: string;
1077
+ client?: WokuRecord;
1078
+ customerComment?: WokuRecord;
1079
+ timeline?: WokuRecord[];
1080
+ createdAt?: string;
1081
+ updatedAt?: string;
1082
+ [key: string]: unknown;
1083
+ }
1084
+ /** Ticket aggregate counts. */
1085
+ interface TicketStats {
1086
+ byTool: Record<string, number>;
1087
+ byDestination: Array<{
1088
+ destinationId: string;
1089
+ countInPeriod: number;
1090
+ countTotal: number;
1091
+ severity: {
1092
+ high: number;
1093
+ medium: number;
1094
+ low: number;
1095
+ };
1096
+ }>;
1097
+ }
1098
+ /** One outbound invitation dispatch (delivery view, no recipient PII). */
1099
+ interface Dispatch {
1100
+ _id: string;
1101
+ channel: Channel;
1102
+ source: string | null;
1103
+ status: 'invited' | 'partially_responded' | 'responded' | 'failed';
1104
+ targets: Array<{
1105
+ responseType: string;
1106
+ targetId: string;
1107
+ respondedAt: string | null;
1108
+ }>;
1109
+ attempts: Array<{
1110
+ channel: Channel;
1111
+ attemptIndex: number;
1112
+ sentAt: string;
1113
+ status: 'sent' | 'delivered' | 'bounced' | 'failed';
1114
+ }>;
1115
+ createdAt: string;
1116
+ updatedAt: string;
1117
+ }
1118
+ /** Response-rate metrics over the dispatches. */
1119
+ interface DispatchStats {
1120
+ total: number;
1121
+ delivered: number;
1122
+ byStatus: {
1123
+ invited: number;
1124
+ partially_responded: number;
1125
+ responded: number;
1126
+ failed: number;
1127
+ };
1128
+ responseRate: number | null;
1129
+ }
1130
+ /**
1131
+ * A woku (feedback collection tool), curated. Named `WokuResource` so it does
1132
+ * not collide with the `Woku` client class at the package root.
1133
+ */
1134
+ interface WokuResource {
1135
+ _id: string;
1136
+ description: string;
1137
+ folderId?: string | null;
1138
+ closed?: boolean;
1139
+ reviewsDisabled?: boolean;
1140
+ anonymousDisabled?: boolean;
1141
+ onlyOneReviewPerClient?: boolean;
1142
+ availableLocales?: string[];
1143
+ defaultLocale?: string;
1144
+ createdAt?: string;
1145
+ [key: string]: unknown;
1146
+ }
1147
+ /** Sanitized ticket-destination connectivity test result. */
1148
+ interface TestConnectionResult {
1149
+ ok: boolean;
1150
+ status?: number;
1151
+ message: string;
1152
+ }
1153
+ /** Rotated secret key. */
1154
+ interface ApiKeyResult {
1155
+ secretKey: string;
1156
+ [key: string]: unknown;
1157
+ }
1158
+
1159
+ /** A VoC entity type that can carry tracker values. */
1160
+ type TrackerEntityType = 'nps' | 'csat' | 'ces' | 'form' | 'flow';
1161
+ interface ListTrackersParams {
1162
+ includeInactive?: boolean;
1163
+ includeUsage?: boolean;
1164
+ page?: number;
1165
+ limit?: number;
1166
+ }
1167
+ interface SearchWokusByTrackerParams {
1168
+ name: string;
1169
+ value: string;
1170
+ page?: number;
1171
+ limit?: number;
1172
+ }
1173
+ /** Manage external tracker definitions (`/v1/external-trackers`). */
1174
+ declare class Trackers {
1175
+ private readonly client;
1176
+ constructor(client: WokuClient);
1177
+ /** List the company tracker definitions (paginated). */
1178
+ list(params?: ListTrackersParams, opts?: RequestOptions): Promise<Page<Tracker>>;
1179
+ /** Create a tracker definition (idempotent). */
1180
+ create(body: CreateTrackerParams, opts?: RequestOptions): Promise<Tracker>;
1181
+ /** Get one tracker definition. */
1182
+ get(id: string, opts?: RequestOptions): Promise<Tracker>;
1183
+ /** Update a tracker definition. */
1184
+ update(id: string, body: UpdateTrackerParams, opts?: RequestOptions): Promise<Tracker>;
1185
+ /** Activate a tracker definition. */
1186
+ activate(id: string, opts?: RequestOptions): Promise<Tracker>;
1187
+ /** Deactivate a tracker definition. */
1188
+ deactivate(id: string, opts?: RequestOptions): Promise<Tracker>;
1189
+ /** Search VoC entities whose trackers match every filter (AND). */
1190
+ searchEntities(body: SearchEntitiesByTrackersParams, opts?: RequestOptions): Promise<EntitiesByTrackers>;
1191
+ /** List the tracker values assigned to a woku. */
1192
+ listWokuValues(wokuId: string, opts?: RequestOptions): Promise<WokuRecord[]>;
1193
+ /** Assign (upsert) a tracker value to a woku by tracker name. */
1194
+ assignToWoku(wokuId: string, body: AssignTrackerByNameParams, opts?: RequestOptions): Promise<WokuRecord>;
1195
+ /** Remove a tracker value from a woku by tracker name. */
1196
+ removeFromWoku(wokuId: string, trackerName: string, opts?: RequestOptions): Promise<WokuRecord>;
1197
+ /** Search wokus by an exact `(tracker name, value)` pair (paginated). */
1198
+ searchWokus(params: SearchWokusByTrackerParams, opts?: RequestOptions): Promise<Page<WokuRecord>>;
1199
+ /** List the tracker values assigned to a VoC entity (nps/csat/ces/form/flow). */
1200
+ listEntityValues(entityType: TrackerEntityType, id: string, opts?: RequestOptions): Promise<WokuRecord[]>;
1201
+ /** Assign (upsert) a tracker value to a VoC entity by tracker name. */
1202
+ assignToEntity(entityType: TrackerEntityType, id: string, body: AssignTrackerByNameParams, opts?: RequestOptions): Promise<WokuRecord>;
1203
+ /** Remove a tracker value from a VoC entity by tracker name. */
1204
+ removeFromEntity(entityType: TrackerEntityType, id: string, trackerName: string, opts?: RequestOptions): Promise<WokuRecord>;
1205
+ }
1206
+
1207
+ /** Manage NPS tool definitions (`/v1/nps-tools`). */
1208
+ declare class NpsTools {
1209
+ private readonly client;
1210
+ constructor(client: WokuClient);
1211
+ list(params?: {
1212
+ page?: number;
1213
+ limit?: number;
1214
+ }, opts?: RequestOptions): Promise<Page<NpsTool>>;
1215
+ create(body: CreateNpsToolParams, opts?: RequestOptions): Promise<NpsTool>;
1216
+ get(id: string, opts?: RequestOptions): Promise<NpsTool>;
1217
+ update(id: string, body: UpdateNpsToolParams, opts?: RequestOptions): Promise<NpsTool>;
1218
+ delete(id: string, opts?: RequestOptions): Promise<DeletedResult>;
1219
+ }
1220
+ /** Manage CSAT tool definitions (`/v1/csat-tools`). */
1221
+ declare class CsatTools {
1222
+ private readonly client;
1223
+ constructor(client: WokuClient);
1224
+ list(params?: {
1225
+ page?: number;
1226
+ limit?: number;
1227
+ }, opts?: RequestOptions): Promise<Page<CsatTool>>;
1228
+ create(body: CreateCsatToolParams, opts?: RequestOptions): Promise<CsatTool>;
1229
+ get(id: string, opts?: RequestOptions): Promise<CsatTool>;
1230
+ update(id: string, body: UpdateCsatToolParams, opts?: RequestOptions): Promise<CsatTool>;
1231
+ delete(id: string, opts?: RequestOptions): Promise<DeletedResult>;
1232
+ }
1233
+ /** Manage CES tool definitions (`/v1/ces-tools`). */
1234
+ declare class CesTools {
1235
+ private readonly client;
1236
+ constructor(client: WokuClient);
1237
+ list(params?: {
1238
+ page?: number;
1239
+ limit?: number;
1240
+ }, opts?: RequestOptions): Promise<Page<CesTool>>;
1241
+ create(body: CreateCesToolParams, opts?: RequestOptions): Promise<CesTool>;
1242
+ get(id: string, opts?: RequestOptions): Promise<CesTool>;
1243
+ update(id: string, body: UpdateCesToolParams, opts?: RequestOptions): Promise<CesTool>;
1244
+ delete(id: string, opts?: RequestOptions): Promise<DeletedResult>;
1245
+ }
1246
+
1247
+ interface ListResponsesParams {
1248
+ page?: number;
1249
+ limit?: number;
1250
+ [key: string]: unknown;
1251
+ }
1252
+ /** Send the NPS survey and read its responses (`/v1/nps`). */
1253
+ declare class Nps {
1254
+ private readonly client;
1255
+ constructor(client: WokuClient);
1256
+ /** Send the NPS survey by email or WhatsApp (idempotent). */
1257
+ sendInvitations(body: SendNpsInvitationsParams, opts?: RequestOptions): Promise<InvitationsResult>;
1258
+ /** List NPS responses (paginated). */
1259
+ listResponses(params?: ListResponsesParams, opts?: RequestOptions): Promise<Page<WokuRecord>>;
1260
+ /** Get one NPS response. */
1261
+ getResponse(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1262
+ }
1263
+ /** Send the CSAT survey and read its responses (`/v1/csat`). */
1264
+ declare class Csat {
1265
+ private readonly client;
1266
+ constructor(client: WokuClient);
1267
+ sendInvitations(body: SendCsatInvitationsParams, opts?: RequestOptions): Promise<InvitationsResult>;
1268
+ listResponses(params?: ListResponsesParams, opts?: RequestOptions): Promise<Page<WokuRecord>>;
1269
+ getResponse(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1270
+ }
1271
+ /** Send the CES survey and read its responses (`/v1/ces`). */
1272
+ declare class Ces {
1273
+ private readonly client;
1274
+ constructor(client: WokuClient);
1275
+ sendInvitations(body: SendCesInvitationsParams, opts?: RequestOptions): Promise<InvitationsResult>;
1276
+ listResponses(params?: ListResponsesParams, opts?: RequestOptions): Promise<Page<WokuRecord>>;
1277
+ getResponse(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1278
+ }
1279
+
1280
+ /** Manage wokus (feedback collection tools) — `/v1/wokus`. */
1281
+ declare class Wokus {
1282
+ private readonly client;
1283
+ constructor(client: WokuClient);
1284
+ list(params?: {
1285
+ page?: number;
1286
+ limit?: number;
1287
+ }, opts?: RequestOptions): Promise<Page<WokuResource>>;
1288
+ create(body: CreateWokuParams, opts?: RequestOptions): Promise<WokuResource>;
1289
+ /** Get one woku with aggregated review stats. */
1290
+ get(id: string, opts?: RequestOptions): Promise<WokuResource>;
1291
+ update(id: string, body: UpdateWokuParams, opts?: RequestOptions): Promise<WokuResource>;
1292
+ delete(id: string, opts?: RequestOptions): Promise<DeletedResult>;
1293
+ /** Apply the boolean settings idempotently (closed/reviewsDisabled/...). */
1294
+ updateSettings(id: string, body: UpdateWokuSettingsParams, opts?: RequestOptions): Promise<WokuResource>;
1295
+ /** Move the woku into a folder, or to the root with `{ folderId: null }`. */
1296
+ move(id: string, body: MoveWokuParams, opts?: RequestOptions): Promise<WokuResource>;
1297
+ /** List the reviews of a woku (paginated). */
1298
+ listReviews(id: string, params?: {
1299
+ page?: number;
1300
+ limit?: number;
1301
+ }, opts?: RequestOptions): Promise<Page<WokuRecord>>;
1302
+ /** Send a woku review invitation by email or WhatsApp (idempotent). */
1303
+ sendInvitations(id: string, body: SendInvitationsParams, opts?: RequestOptions): Promise<InvitationsResult>;
1304
+ /** Share a woku review link by email. */
1305
+ share(id: string, body: ShareWokuParams, opts?: RequestOptions): Promise<WokuRecord>;
1306
+ }
1307
+
1308
+ /** Read forms and send form invitations (`/v1/forms`). */
1309
+ declare class Forms {
1310
+ private readonly client;
1311
+ constructor(client: WokuClient);
1312
+ list(params?: {
1313
+ page?: number;
1314
+ limit?: number;
1315
+ }, opts?: RequestOptions): Promise<Page<WokuRecord>>;
1316
+ get(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1317
+ /** List the responses of a form (paginated). */
1318
+ listResponses(id: string, params?: {
1319
+ page?: number;
1320
+ limit?: number;
1321
+ }, opts?: RequestOptions): Promise<Page<WokuRecord>>;
1322
+ /** Send a form by email or WhatsApp (idempotent). */
1323
+ sendInvitations(id: string, body: SendInvitationsParams, opts?: RequestOptions): Promise<InvitationsResult>;
1324
+ }
1325
+
1326
+ /** Read data flows (`/v1/flows`). */
1327
+ declare class Flows {
1328
+ private readonly client;
1329
+ constructor(client: WokuClient);
1330
+ list(params?: {
1331
+ page?: number;
1332
+ limit?: number;
1333
+ }, opts?: RequestOptions): Promise<Page<WokuRecord>>;
1334
+ get(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1335
+ }
1336
+
1337
+ interface ListActionPlansParams {
1338
+ groupId?: string;
1339
+ status?: string;
1340
+ source?: string;
1341
+ priority?: string;
1342
+ search?: string;
1343
+ from?: string;
1344
+ to?: string;
1345
+ page?: number;
1346
+ limit?: number;
1347
+ }
1348
+ /** Read and drive action plans, incl. the managed kanban (`/v1/action-plans`). */
1349
+ declare class ActionPlans {
1350
+ private readonly client;
1351
+ constructor(client: WokuClient);
1352
+ list(params?: ListActionPlansParams, opts?: RequestOptions): Promise<Page<WokuRecord>>;
1353
+ get(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1354
+ /** The plan timeline (events, oldest first). */
1355
+ events(id: string, opts?: RequestOptions): Promise<WokuRecord[]>;
1356
+ /** The plan AI conversation (read-only). */
1357
+ getConversation(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1358
+ /**
1359
+ * Reply to the plan AI agent. Each reply is a paid AI turn (`confirm:true` is
1360
+ * sent automatically); the reply is composed asynchronously, so poll
1361
+ * {@link getConversation} until `busy` is false.
1362
+ */
1363
+ reply(id: string, text: string, opts?: RequestOptions): Promise<WokuRecord>;
1364
+ /** Send an approved plan to a destination (jira/monday/clickup/notion/internal). */
1365
+ send(id: string, body: SendActionPlanParams, opts?: RequestOptions): Promise<WokuRecord>;
1366
+ createTask(id: string, body: CreateActionPlanTaskParams, opts?: RequestOptions): Promise<WokuRecord>;
1367
+ updateTask(id: string, taskId: string, body: UpdateActionPlanTaskParams, opts?: RequestOptions): Promise<WokuRecord>;
1368
+ reorderTasks(id: string, body: ReorderActionPlanTasksParams, opts?: RequestOptions): Promise<WokuRecord>;
1369
+ deleteTask(id: string, taskId: string, opts?: RequestOptions): Promise<WokuRecord>;
1370
+ approve(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1371
+ reopen(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1372
+ cancel(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1373
+ complete(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1374
+ resume(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1375
+ private status;
1376
+ }
1377
+ /** Manage action-plan groups (`/v1/action-plan-groups`). */
1378
+ declare class ActionPlanGroups {
1379
+ private readonly client;
1380
+ constructor(client: WokuClient);
1381
+ list(params?: {
1382
+ search?: string;
1383
+ }, opts?: RequestOptions): Promise<WokuRecord[]>;
1384
+ /** Get one group with its embedded stats. */
1385
+ get(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1386
+ create(body: CreateActionPlanGroupParams, opts?: RequestOptions): Promise<WokuRecord>;
1387
+ update(id: string, body: UpdateActionPlanGroupParams, opts?: RequestOptions): Promise<WokuRecord>;
1388
+ setEnabled(id: string, enabled: boolean, opts?: RequestOptions): Promise<WokuRecord>;
1389
+ delete(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1390
+ }
1391
+
1392
+ interface ListTicketsParams {
1393
+ tool?: 'woku' | 'nps' | 'form' | 'csat' | 'ces';
1394
+ severity?: Severity;
1395
+ search?: string;
1396
+ destinationId?: string;
1397
+ createdFrom?: string;
1398
+ createdTo?: string;
1399
+ page?: number;
1400
+ limit?: number;
1401
+ }
1402
+ interface TicketStatsParams {
1403
+ destinationId?: string;
1404
+ createdFrom?: string;
1405
+ createdTo?: string;
1406
+ }
1407
+ /** Read and curate support tickets (`/v1/tickets`). Tickets are AI-generated. */
1408
+ declare class Tickets {
1409
+ private readonly client;
1410
+ constructor(client: WokuClient);
1411
+ list(params?: ListTicketsParams, opts?: RequestOptions): Promise<Page<Ticket>>;
1412
+ /** Aggregate counts by tool and by SAC destination. */
1413
+ stats(params?: TicketStatsParams, opts?: RequestOptions): Promise<TicketStats>;
1414
+ get(id: string, opts?: RequestOptions): Promise<Ticket>;
1415
+ update(id: string, body: UpdateTicketParams, opts?: RequestOptions): Promise<Ticket>;
1416
+ }
1417
+ /** Manage SAC ticket destinations (`/v1/ticket-destinations`). */
1418
+ declare class TicketDestinations {
1419
+ private readonly client;
1420
+ constructor(client: WokuClient);
1421
+ list(opts?: RequestOptions): Promise<WokuRecord[]>;
1422
+ get(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1423
+ create(body: CreateTicketDestinationParams, opts?: RequestOptions): Promise<WokuRecord>;
1424
+ update(id: string, body: UpdateTicketDestinationParams, opts?: RequestOptions): Promise<WokuRecord>;
1425
+ delete(id: string, opts?: RequestOptions): Promise<WokuRecord>;
1426
+ /**
1427
+ * Send a real connectivity test to a saved destination. Requires
1428
+ * `confirm: true` (the test reaches the live destination).
1429
+ */
1430
+ test(id: string, opts?: RequestOptions): Promise<TestConnectionResult>;
1431
+ }
1432
+
1433
+ interface ListDispatchesParams {
1434
+ channel?: Channel;
1435
+ responseType?: 'woku' | 'nps' | 'form' | 'client-form' | 'csat' | 'ces';
1436
+ targetId?: string;
1437
+ status?: 'invited' | 'partially_responded' | 'responded' | 'failed';
1438
+ createdFrom?: string;
1439
+ createdTo?: string;
1440
+ page?: number;
1441
+ limit?: number;
1442
+ }
1443
+ interface DispatchStatsParams {
1444
+ channel?: Channel;
1445
+ responseType?: string;
1446
+ targetId?: string;
1447
+ createdFrom?: string;
1448
+ createdTo?: string;
1449
+ }
1450
+ /** Delivery tracking over invitation dispatches (`/v1/dispatches`). */
1451
+ declare class Dispatches {
1452
+ private readonly client;
1453
+ constructor(client: WokuClient);
1454
+ /** List the invitation dispatches (delivery status, no recipient PII). */
1455
+ list(params?: ListDispatchesParams, opts?: RequestOptions): Promise<Page<Dispatch>>;
1456
+ /** Response-rate metrics over the dispatches. */
1457
+ stats(params?: DispatchStatsParams, opts?: RequestOptions): Promise<DispatchStats>;
1458
+ }
1459
+
1460
+ /** Read NPS reports (`/v1/reports`). */
1461
+ declare class Reports {
1462
+ private readonly client;
1463
+ constructor(client: WokuClient);
1464
+ /** Company-level NPS report. */
1465
+ companyNps(params?: Record<string, unknown>, opts?: RequestOptions): Promise<WokuRecord>;
1466
+ /** NPS report for one tool. */
1467
+ npsTool(npsToolId: string, params?: Record<string, unknown>, opts?: RequestOptions): Promise<WokuRecord>;
1468
+ }
1469
+
1470
+ /** The caller company and its API key (`/v1/companies/me`). */
1471
+ declare class Company {
1472
+ private readonly client;
1473
+ constructor(client: WokuClient);
1474
+ /** Get the caller company. */
1475
+ me(opts?: RequestOptions): Promise<WokuRecord>;
1476
+ /** Rotate the secret key. The returned key replaces the current one. */
1477
+ rotateKey(opts?: RequestOptions): Promise<ApiKeyResult>;
1478
+ /** Revoke the secret key (all subsequent requests will be unauthorized). */
1479
+ revokeKey(opts?: RequestOptions): Promise<WokuRecord>;
1480
+ }
1481
+
1482
+ /** Check respondent quarantine status (`/v1/quarantines`). */
1483
+ declare class Quarantines {
1484
+ private readonly client;
1485
+ constructor(client: WokuClient);
1486
+ /** Check whether a contact is quarantined. */
1487
+ check(params: {
1488
+ email?: string;
1489
+ phone?: string | number;
1490
+ }, opts?: RequestOptions): Promise<WokuRecord>;
1491
+ }
1492
+
1493
+ /**
1494
+ * Entry point to the Woku management API.
1495
+ *
1496
+ * ```ts
1497
+ * const woku = new Woku({ apiKey: process.env.WOKU_API_KEY });
1498
+ * const tracker = await woku.trackers.create({ name: 'Store', system: 'retail' });
1499
+ * for await (const ticket of await woku.tickets.list({ severity: 'high' })) {
1500
+ * console.log(ticket.title);
1501
+ * }
1502
+ * ```
1503
+ */
1504
+ declare class Woku {
1505
+ /** The underlying transport (advanced use). */
1506
+ readonly client: WokuClient;
1507
+ readonly trackers: Trackers;
1508
+ readonly npsTools: NpsTools;
1509
+ readonly csatTools: CsatTools;
1510
+ readonly cesTools: CesTools;
1511
+ readonly nps: Nps;
1512
+ readonly csat: Csat;
1513
+ readonly ces: Ces;
1514
+ readonly wokus: Wokus;
1515
+ readonly forms: Forms;
1516
+ readonly flows: Flows;
1517
+ readonly actionPlans: ActionPlans;
1518
+ readonly actionPlanGroups: ActionPlanGroups;
1519
+ readonly tickets: Tickets;
1520
+ readonly ticketDestinations: TicketDestinations;
1521
+ readonly dispatches: Dispatches;
1522
+ readonly reports: Reports;
1523
+ readonly company: Company;
1524
+ readonly quarantines: Quarantines;
1525
+ constructor(options?: WokuClientOptions | string);
1526
+ }
1527
+
1528
+ /**
1529
+ * Error hierarchy for the Woku SDK. Every failure is a {@link WokuError};
1530
+ * transport failures are {@link WokuConnectionError} and HTTP error responses
1531
+ * are {@link WokuAPIError} subclasses keyed by status. API errors carry the
1532
+ * server `requestId` (echo it when reporting an issue) and the parsed body.
1533
+ */
1534
+ /** Parsed error body shape the API returns (NestJS exception filter). */
1535
+ interface WokuErrorBody {
1536
+ statusCode?: number;
1537
+ message?: string | string[];
1538
+ error?: string;
1539
+ code?: string;
1540
+ [key: string]: unknown;
1541
+ }
1542
+ /** Base class for every SDK error. */
1543
+ declare class WokuError extends Error {
1544
+ /** Stable, machine-readable code (e.g. `not_found`, `rate_limited`). */
1545
+ readonly code?: string;
1546
+ constructor(message: string, options?: {
1547
+ code?: string;
1548
+ cause?: unknown;
1549
+ });
1550
+ }
1551
+ /**
1552
+ * The request never got a usable HTTP response: DNS/TCP failure, TLS error,
1553
+ * timeout or an aborted signal. Safe to retry (the SDK already retries these
1554
+ * up to `maxRetries`).
1555
+ */
1556
+ declare class WokuConnectionError extends WokuError {
1557
+ constructor(message: string, options?: {
1558
+ cause?: unknown;
1559
+ code?: string;
1560
+ });
1561
+ }
1562
+ /** The request was aborted (per-call `signal` or the configured timeout). */
1563
+ declare class WokuTimeoutError extends WokuConnectionError {
1564
+ constructor(message?: string);
1565
+ }
1566
+ /** The server returned a non-2xx HTTP status. */
1567
+ declare class WokuAPIError extends WokuError {
1568
+ /** HTTP status code. */
1569
+ readonly status: number;
1570
+ /** Server correlation id, if the response carried one. */
1571
+ readonly requestId?: string;
1572
+ /** Parsed response body (or the raw text when it was not JSON). */
1573
+ readonly body: WokuErrorBody | string | undefined;
1574
+ /**
1575
+ * Seconds to wait before retrying, from the `Retry-After` response header
1576
+ * (or a `retryAfter` body field as a fallback), when the server sent one.
1577
+ */
1578
+ readonly retryAfterSeconds?: number;
1579
+ constructor(status: number, body: WokuErrorBody | string | undefined, message: string, requestId?: string, code?: string, retryAfterSeconds?: number);
1580
+ /** Build the most specific error subclass for a status + body. */
1581
+ static from(status: number, body: WokuErrorBody | string | undefined, requestId?: string, retryAfterSeconds?: number): WokuAPIError;
1582
+ }
1583
+ /** 400 — malformed request or failed validation. */
1584
+ declare class BadRequestError extends WokuAPIError {
1585
+ constructor(...args: ConstructorParameters<typeof WokuAPIError>);
1586
+ }
1587
+ /** 401 — missing or invalid API key. */
1588
+ declare class AuthenticationError extends WokuAPIError {
1589
+ constructor(...args: ConstructorParameters<typeof WokuAPIError>);
1590
+ }
1591
+ /** 403 — the key is valid but not allowed to access the resource. */
1592
+ declare class PermissionDeniedError extends WokuAPIError {
1593
+ constructor(...args: ConstructorParameters<typeof WokuAPIError>);
1594
+ }
1595
+ /** 404 — the resource does not exist (or is not visible to this company). */
1596
+ declare class NotFoundError extends WokuAPIError {
1597
+ constructor(...args: ConstructorParameters<typeof WokuAPIError>);
1598
+ }
1599
+ /** 409 — the request conflicts with the resource state. */
1600
+ declare class ConflictError extends WokuAPIError {
1601
+ constructor(...args: ConstructorParameters<typeof WokuAPIError>);
1602
+ }
1603
+ /** 422 — semantically invalid request. */
1604
+ declare class UnprocessableEntityError extends WokuAPIError {
1605
+ constructor(...args: ConstructorParameters<typeof WokuAPIError>);
1606
+ }
1607
+ /** 429 — rate limited. `retryAfterSeconds` mirrors the `Retry-After` header. */
1608
+ declare class RateLimitError extends WokuAPIError {
1609
+ constructor(...args: ConstructorParameters<typeof WokuAPIError>);
1610
+ }
1611
+ /** 5xx — the server failed to process the request. */
1612
+ declare class InternalServerError extends WokuAPIError {
1613
+ constructor(...args: ConstructorParameters<typeof WokuAPIError>);
1614
+ }
1615
+
1616
+ export { type ApiKeyResult, type AssignTrackerByNameParams, AuthenticationError, BadRequestError, type CesTool, type Channel, ConflictError, type CreateActionPlanGroupParams, type CreateActionPlanTaskParams, type CreateCesToolParams, type CreateCsatToolParams, type CreateNpsToolParams, type CreateTicketDestinationParams, type CreateTrackerParams, type CreateWokuParams, type CsatTool, type DeletedResult, type Dispatch, type DispatchStats, type EntitiesByTrackers, type FeedbackType, type FetchLike, InternalServerError, type InvitationsResult, type Locale, type MoveWokuParams, NotFoundError, type NpsTool, Page, type PageResponse, PermissionDeniedError, type PostPlanReplyParams, RateLimitError, type ReorderActionPlanTasksParams, type RequestOptions, type Schemas, type SearchEntitiesByTrackersParams, type SendActionPlanParams, type SendCesInvitationsParams, type SendCsatInvitationsParams, type SendInvitationsParams, type SendNpsInvitationsParams, type Severity, type ShareWokuParams, type TestConnectionResult, type Ticket, type TicketStats, type Tracker, UnprocessableEntityError, type UpdateActionPlanGroupParams, type UpdateActionPlanTaskParams, type UpdateCesToolParams, type UpdateCsatToolParams, type UpdateNpsToolParams, type UpdateTicketDestinationParams, type UpdateTicketParams, type UpdateTrackerParams, type UpdateWokuParams, type UpdateWokuSettingsParams, Woku, WokuAPIError, WokuClient, type WokuClientOptions, WokuConnectionError, WokuError, type WokuErrorBody, type WokuRecord, type WokuResource, WokuTimeoutError };