@lpextend/node-sdk 1.1.2

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,2989 @@
1
+ /**
2
+ * Account Configuration Types
3
+ *
4
+ * TypeScript interfaces for LP Account Configuration APIs.
5
+ * These use standard Bearer authentication.
6
+ */
7
+ interface LPSkill {
8
+ id: number;
9
+ name: string;
10
+ description?: string;
11
+ deleted?: boolean;
12
+ maxWaitTime?: number;
13
+ skillOrder?: number;
14
+ canTransfer?: boolean;
15
+ skillRoutingConfiguration?: LPSkillRoutingConfig[];
16
+ dateUpdated?: string;
17
+ }
18
+ interface LPSkillRoutingConfig {
19
+ priority?: number;
20
+ autoAccept?: boolean;
21
+ maxNumberOfChats?: number;
22
+ }
23
+ interface CreateSkillRequest {
24
+ name: string;
25
+ description?: string;
26
+ maxWaitTime?: number;
27
+ skillOrder?: number;
28
+ canTransfer?: boolean;
29
+ }
30
+ interface UpdateSkillRequest {
31
+ name?: string;
32
+ description?: string;
33
+ maxWaitTime?: number;
34
+ skillOrder?: number;
35
+ canTransfer?: boolean;
36
+ deleted?: boolean;
37
+ }
38
+ interface LPUser {
39
+ id: string;
40
+ pid?: string;
41
+ loginName: string;
42
+ fullName?: string;
43
+ nickname?: string;
44
+ email?: string;
45
+ employeeId?: string;
46
+ isEnabled?: boolean;
47
+ deleted?: boolean;
48
+ userTypeId?: string;
49
+ skillIds?: number[];
50
+ profileIds?: number[];
51
+ maxChats?: number;
52
+ maxAsyncChats?: number;
53
+ memberOf?: MemberOf;
54
+ managerOf?: number[];
55
+ dateUpdated?: string;
56
+ }
57
+ interface MemberOf {
58
+ agentGroupId: number;
59
+ assignmentDate?: string;
60
+ }
61
+ interface CreateUserRequest {
62
+ loginName: string;
63
+ password?: string;
64
+ fullName?: string;
65
+ nickname?: string;
66
+ email?: string;
67
+ employeeId?: string;
68
+ skillIds?: number[];
69
+ profileIds?: number[];
70
+ maxChats?: number;
71
+ maxAsyncChats?: number;
72
+ memberOf?: MemberOf;
73
+ }
74
+ interface UpdateUserRequest {
75
+ fullName?: string;
76
+ nickname?: string;
77
+ email?: string;
78
+ employeeId?: string;
79
+ skillIds?: number[];
80
+ profileIds?: number[];
81
+ isEnabled?: boolean;
82
+ maxChats?: number;
83
+ maxAsyncChats?: number;
84
+ memberOf?: MemberOf;
85
+ managerOf?: number[];
86
+ deleted?: boolean;
87
+ }
88
+ interface LPAgentGroup {
89
+ id: number;
90
+ name: string;
91
+ description?: string;
92
+ parentGroupId?: number;
93
+ isEnabled?: boolean;
94
+ deleted?: boolean;
95
+ dateUpdated?: string;
96
+ }
97
+ interface CreateAgentGroupRequest {
98
+ name: string;
99
+ description?: string;
100
+ parentGroupId?: number;
101
+ }
102
+ interface UpdateAgentGroupRequest {
103
+ name?: string;
104
+ description?: string;
105
+ parentGroupId?: number;
106
+ isEnabled?: boolean;
107
+ deleted?: boolean;
108
+ }
109
+ interface LPProfile {
110
+ id: number;
111
+ name: string;
112
+ description?: string;
113
+ roleTypeId?: number;
114
+ roleTypeName?: string;
115
+ permissions?: LPPermission[];
116
+ dateUpdated?: string;
117
+ }
118
+ interface LPPermission {
119
+ id: number;
120
+ name: string;
121
+ value: boolean;
122
+ }
123
+ interface CreateProfileRequest {
124
+ name: string;
125
+ description?: string;
126
+ roleTypeId: number;
127
+ permissions?: Array<{
128
+ id: number;
129
+ value: boolean;
130
+ }>;
131
+ }
132
+ interface UpdateProfileRequest {
133
+ name?: string;
134
+ description?: string;
135
+ permissions?: Array<{
136
+ id: number;
137
+ value: boolean;
138
+ }>;
139
+ }
140
+ interface LPLOB {
141
+ id: number;
142
+ name: string;
143
+ description?: string;
144
+ deleted?: boolean;
145
+ dateUpdated?: string;
146
+ }
147
+ interface CreateLOBRequest {
148
+ name: string;
149
+ description?: string;
150
+ }
151
+ interface UpdateLOBRequest {
152
+ name?: string;
153
+ description?: string;
154
+ deleted?: boolean;
155
+ }
156
+ interface LPCampaign {
157
+ id: number;
158
+ name: string;
159
+ description?: string;
160
+ lobId?: number;
161
+ status?: 'active' | 'inactive';
162
+ goalId?: number;
163
+ dateUpdated?: string;
164
+ }
165
+ interface CreateCampaignRequest {
166
+ name: string;
167
+ description?: string;
168
+ lobId?: number;
169
+ goalId?: number;
170
+ }
171
+ interface UpdateCampaignRequest {
172
+ name?: string;
173
+ description?: string;
174
+ lobId?: number;
175
+ status?: 'active' | 'inactive';
176
+ goalId?: number;
177
+ }
178
+ interface LPEngagement {
179
+ id: number;
180
+ name: string;
181
+ campaignId: number;
182
+ type?: string;
183
+ skillId?: number;
184
+ skillName?: string;
185
+ status?: 'active' | 'inactive';
186
+ dateUpdated?: string;
187
+ }
188
+ interface CreateEngagementRequest {
189
+ name: string;
190
+ campaignId: number;
191
+ type?: string;
192
+ skillId?: number;
193
+ }
194
+ interface UpdateEngagementRequest {
195
+ name?: string;
196
+ type?: string;
197
+ skillId?: number;
198
+ status?: 'active' | 'inactive';
199
+ }
200
+ interface LPPredefinedContent {
201
+ id: number;
202
+ title: string;
203
+ data: LPPredefinedContentData[];
204
+ categories?: string[];
205
+ hotkey?: string;
206
+ deleted?: boolean;
207
+ dateUpdated?: string;
208
+ }
209
+ interface LPPredefinedContentData {
210
+ text: string;
211
+ lang?: string;
212
+ isDefault?: boolean;
213
+ }
214
+ interface CreatePredefinedContentRequest {
215
+ title: string;
216
+ data: LPPredefinedContentData[];
217
+ categories?: string[];
218
+ hotkey?: string;
219
+ }
220
+ interface UpdatePredefinedContentRequest {
221
+ title?: string;
222
+ data?: LPPredefinedContentData[];
223
+ categories?: string[];
224
+ hotkey?: string;
225
+ deleted?: boolean;
226
+ }
227
+ interface LPAutomaticMessage {
228
+ id: number;
229
+ name: string;
230
+ messageEventId: string;
231
+ data: LPAutomaticMessageData[];
232
+ deleted?: boolean;
233
+ dateUpdated?: string;
234
+ }
235
+ interface LPAutomaticMessageData {
236
+ text: string;
237
+ lang?: string;
238
+ }
239
+ interface CreateAutomaticMessageRequest {
240
+ name: string;
241
+ messageEventId: string;
242
+ data: LPAutomaticMessageData[];
243
+ }
244
+ interface UpdateAutomaticMessageRequest {
245
+ name?: string;
246
+ data?: LPAutomaticMessageData[];
247
+ deleted?: boolean;
248
+ }
249
+ interface LPWorkingHours {
250
+ id: number;
251
+ name: string;
252
+ deleted?: boolean;
253
+ isDefault?: boolean;
254
+ dateUpdated?: string;
255
+ days: LPWorkingDay[];
256
+ }
257
+ interface LPWorkingDay {
258
+ day: 'SUNDAY' | 'MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY';
259
+ isOpen: boolean;
260
+ shifts?: LPShift[];
261
+ }
262
+ interface LPShift {
263
+ start: string;
264
+ end: string;
265
+ }
266
+ interface CreateWorkingHoursRequest {
267
+ name: string;
268
+ days: LPWorkingDay[];
269
+ isDefault?: boolean;
270
+ }
271
+ interface UpdateWorkingHoursRequest {
272
+ name?: string;
273
+ days?: LPWorkingDay[];
274
+ isDefault?: boolean;
275
+ deleted?: boolean;
276
+ }
277
+ interface LPSpecialOccasion {
278
+ id: number;
279
+ name: string;
280
+ deleted?: boolean;
281
+ isDefault?: boolean;
282
+ dateUpdated?: string;
283
+ events: LPSpecialOccasionEvent[];
284
+ }
285
+ interface LPSpecialOccasionEvent {
286
+ name: string;
287
+ startDate: string;
288
+ endDate: string;
289
+ isOpen: boolean;
290
+ shifts?: LPShift[];
291
+ }
292
+ interface CreateSpecialOccasionRequest {
293
+ name: string;
294
+ events: LPSpecialOccasionEvent[];
295
+ isDefault?: boolean;
296
+ }
297
+ interface UpdateSpecialOccasionRequest {
298
+ name?: string;
299
+ events?: LPSpecialOccasionEvent[];
300
+ isDefault?: boolean;
301
+ deleted?: boolean;
302
+ }
303
+
304
+ /**
305
+ * Sentinel (LivePerson IDP) Types
306
+ *
307
+ * Types for authentication and user management via LivePerson's Sentinel API.
308
+ * Sentinel handles OAuth token exchange, user verification, and session management.
309
+ */
310
+ /**
311
+ * OAuth token exchange request
312
+ */
313
+ interface SentinelAuthRequest {
314
+ /** OAuth authorization code from redirect */
315
+ code: string;
316
+ /** Redirect URI used in the authorization request */
317
+ redirect: string;
318
+ /** Application name */
319
+ appname: string;
320
+ }
321
+ /**
322
+ * Token response from Sentinel OAuth exchange
323
+ */
324
+ interface SentinelTokenExchange {
325
+ /** OAuth access token */
326
+ access_token: string;
327
+ /** Token type (usually "Bearer") */
328
+ token_type: string;
329
+ /** OAuth refresh token */
330
+ refresh_token: string;
331
+ /** JWT ID token containing user claims */
332
+ id_token: string;
333
+ /** Token expiration time in seconds */
334
+ expires_in: number;
335
+ /** User data (optional) */
336
+ UserData?: SentinelUserData;
337
+ /** Expiry timestamp string */
338
+ expiry?: string;
339
+ /** Timestamp string */
340
+ timestamp?: string;
341
+ }
342
+ /**
343
+ * Stored LP token document
344
+ */
345
+ interface SentinelToken {
346
+ /** Token document ID (same as access token) */
347
+ id: string;
348
+ /** JWT ID token */
349
+ idToken?: string;
350
+ /** User ID from JWT sub claim */
351
+ uid: string;
352
+ /** OAuth access token */
353
+ accessToken: string;
354
+ /** OAuth refresh token */
355
+ refreshToken: string;
356
+ /** Token expiration in hours */
357
+ expiresIn: number;
358
+ /** Expiry timestamp (Unix ms) */
359
+ expiry?: number;
360
+ /** Conversation Builder API token */
361
+ cbToken?: string;
362
+ /** Conversation Builder organization ID */
363
+ cbOrg?: string;
364
+ /** LP Account ID */
365
+ accountId?: string;
366
+ }
367
+ /**
368
+ * LP Token document stored in Firestore
369
+ */
370
+ interface SentinelLpToken {
371
+ /** LP Account ID */
372
+ accountId: string;
373
+ /** Access token (legacy snake_case) */
374
+ access_token?: string;
375
+ /** CB organization ID */
376
+ cbOrg: string;
377
+ /** CB API token */
378
+ cbToken: string;
379
+ /** Document ID */
380
+ id: string;
381
+ /** User ID */
382
+ uid: string;
383
+ /** Token string */
384
+ token: string;
385
+ /** Access token (camelCase) */
386
+ accessToken?: string;
387
+ /** User data */
388
+ userData: SentinelUserData;
389
+ }
390
+ /**
391
+ * Basic user data from Sentinel
392
+ */
393
+ interface SentinelUserData {
394
+ uid?: string;
395
+ id: number | string;
396
+ email: string;
397
+ first_name: string;
398
+ last_name: string;
399
+ role: string;
400
+ roles?: string[];
401
+ permissions?: string[];
402
+ active: boolean;
403
+ created_by: string;
404
+ updated_by: string;
405
+ created_at: number;
406
+ updated_at: number;
407
+ isLPA?: boolean;
408
+ }
409
+ /**
410
+ * User profile information
411
+ */
412
+ interface SentinelProfile {
413
+ roleTypeId: number;
414
+ name: string;
415
+ id: number;
416
+ }
417
+ /**
418
+ * Agent group membership
419
+ */
420
+ interface SentinelMemberOf {
421
+ agentGroupId: string;
422
+ assignmentDate: string;
423
+ }
424
+ /**
425
+ * Agent group management assignment
426
+ */
427
+ interface SentinelManagerOf {
428
+ agentGroupId: string;
429
+ assignmentDate: string;
430
+ }
431
+ /**
432
+ * User skill assignment
433
+ */
434
+ interface SentinelUserSkill {
435
+ name: string;
436
+ id: number;
437
+ }
438
+ /**
439
+ * LivePerson user from Account Config API
440
+ */
441
+ interface SentinelLpUser {
442
+ id: string;
443
+ deleted: boolean;
444
+ loginName: string;
445
+ fullName: string;
446
+ nickname: string;
447
+ passwordSh: string;
448
+ isEnabled: boolean;
449
+ maxChats: number;
450
+ email: string;
451
+ pictureUrl?: string;
452
+ disabledManually: boolean;
453
+ skillIds: number[];
454
+ profiles: SentinelProfile[];
455
+ profileIds: number[];
456
+ lobIds: number[];
457
+ changePwdNextLogin: boolean;
458
+ memberOf: SentinelMemberOf;
459
+ managerOf: SentinelManagerOf[];
460
+ permissionGroups: string[];
461
+ description: string;
462
+ mobileNumber: string;
463
+ employeeId: string;
464
+ maxAsyncChats: number;
465
+ backgndImgUri: string;
466
+ pnCertName: string;
467
+ dateUpdated: string;
468
+ lastPwdChangeDate: string;
469
+ isApiUser: boolean;
470
+ userTypeId: number;
471
+ }
472
+ /**
473
+ * Application user stored in Firestore
474
+ */
475
+ interface SentinelAppUser extends SentinelLpUser {
476
+ /** Creator user ID */
477
+ createdBy: string;
478
+ /** Updater user ID */
479
+ updatedBy: string;
480
+ /** Creation timestamp */
481
+ createdAt?: number;
482
+ /** Update timestamp */
483
+ updatedAt: number;
484
+ /** Primary LP account ID (first account user logged in with) */
485
+ accountId: string;
486
+ /** Default LP account ID for auto-login after Firebase auth */
487
+ defaultAccountId?: string;
488
+ /** List of LP account IDs the user has access to */
489
+ linkedAccountIds?: string[];
490
+ /** Display name */
491
+ displayName: string;
492
+ /** User roles */
493
+ roles: string[];
494
+ /** User permissions */
495
+ permissions: string[];
496
+ /** Profile photo URL */
497
+ photoUrl: string;
498
+ /** Whether user is a LivePerson Administrator */
499
+ isLPA: boolean;
500
+ /** Whether user has agreed to terms */
501
+ termsAgreed: boolean;
502
+ /** List of installed app IDs */
503
+ installedApps: string[];
504
+ /** App-specific permissions */
505
+ appPermissions: string[];
506
+ }
507
+ /**
508
+ * CC User DTO from LivePerson
509
+ */
510
+ interface SentinelCCUser {
511
+ userTypeId: number;
512
+ isApiUser: boolean;
513
+ profileIds: number[];
514
+ permissionGroups: number[];
515
+ pid: string;
516
+ allowedAppKeys: string;
517
+ skills: SentinelUserSkill[];
518
+ dateCreated: string;
519
+ maxChats: number;
520
+ skillIds: number[];
521
+ loginName: string;
522
+ nickname: string;
523
+ uid: string;
524
+ memberOf: any;
525
+ email: string;
526
+ lobs: string[];
527
+ managerOf: any;
528
+ pictureUrl: string;
529
+ fullName: string;
530
+ employeeId: string;
531
+ managedAgentGroups: any;
532
+ dateUpdated: string;
533
+ deleted: boolean;
534
+ isEnabled: boolean;
535
+ }
536
+ /**
537
+ * Chat bot platform user info
538
+ */
539
+ interface CBChatBotPlatformUser {
540
+ username: string;
541
+ password: string;
542
+ creationTime: string;
543
+ modificationTime: string;
544
+ cb2Enabled: boolean;
545
+ }
546
+ /**
547
+ * Conversation Builder authentication success result
548
+ */
549
+ interface CBSuccessResult {
550
+ /** Chat bot platform user info */
551
+ chatBotPlatformUser: CBChatBotPlatformUser;
552
+ /** CB API access token */
553
+ apiAccessToken: string;
554
+ /** CB API permanent access token */
555
+ apiAccessPermToken: string;
556
+ /** CB configuration */
557
+ config: any;
558
+ /** CB session organization ID */
559
+ sessionOrganizationId: string;
560
+ /** LiveEngage account ID */
561
+ leAccountId: string;
562
+ /** CB region */
563
+ cbRegion: string;
564
+ /** List of enabled features */
565
+ enabledFeatures: string[];
566
+ /** Site settings */
567
+ siteSettings: any[];
568
+ /** LiveEngage user ID */
569
+ leUserId: string;
570
+ /** User privileges */
571
+ privileges: number[];
572
+ /** Whether user is elevated LPA */
573
+ isElevatedLpa: boolean;
574
+ }
575
+ /**
576
+ * Conversation Builder authentication response
577
+ */
578
+ interface CBAuthInfo {
579
+ /** Whether authentication was successful */
580
+ success: boolean;
581
+ /** Success result with tokens and user info */
582
+ successResult: CBSuccessResult;
583
+ /** Status message */
584
+ message: string;
585
+ }
586
+ /**
587
+ * Application setting entry
588
+ */
589
+ interface SentinelAppSetting {
590
+ name: string;
591
+ value: string | number | boolean | object;
592
+ createdBy?: string;
593
+ updatedBy?: string;
594
+ createdAt?: number;
595
+ updatedAt?: number;
596
+ }
597
+ /**
598
+ * Application settings document
599
+ */
600
+ interface SentinelAppSettings {
601
+ id?: string;
602
+ accountId: string;
603
+ settings: SentinelAppSetting[];
604
+ created_by?: string;
605
+ updated_by?: string;
606
+ created_at?: number;
607
+ updated_at?: number;
608
+ }
609
+ /**
610
+ * Login URL response
611
+ */
612
+ interface SentinelLoginUrlResponse {
613
+ url: string;
614
+ }
615
+ /**
616
+ * Domain lookup response
617
+ */
618
+ interface SentinelDomainsResponse {
619
+ [service: string]: string;
620
+ }
621
+
622
+ /**
623
+ * LP Prompt Library Types
624
+ *
625
+ * Types for LivePerson Prompt Library API (domain: promptlibrary)
626
+ * Note: This is different from AI Studio Prompt Library API
627
+ */
628
+ /**
629
+ * Source types for prompt variables
630
+ */
631
+ type LPPromptVariableSourceType = 'PROMPT_LIBRARY_RESERVED_KEYWORD' | 'INTERNAL_VARIABLES' | 'SITE_SETTINGS' | 'BOT_CONTEXT';
632
+ /**
633
+ * Variable configuration in a prompt
634
+ */
635
+ interface LPPromptVariable {
636
+ name: string;
637
+ sourceType: LPPromptVariableSourceType;
638
+ value?: string;
639
+ }
640
+ /**
641
+ * Generic LLM configuration
642
+ */
643
+ interface LPPromptGenericConfig {
644
+ llmProvider: string;
645
+ llm: string;
646
+ llmSubscriptionName?: string;
647
+ samplingTemperature?: number;
648
+ maxResponseTokens?: number;
649
+ maxPromptTokens?: number;
650
+ completionsNumber?: number;
651
+ }
652
+ /**
653
+ * Client-specific configuration
654
+ */
655
+ interface LPPromptClientConfig {
656
+ maxConversationTurns?: number;
657
+ maxConversationMessages?: number;
658
+ maxConversationTokens?: number;
659
+ includeLastUserMessage?: boolean;
660
+ piiMaskingEnabled?: boolean;
661
+ }
662
+ /**
663
+ * Complete prompt configuration
664
+ */
665
+ interface LPPromptConfiguration {
666
+ genericConfig: LPPromptGenericConfig;
667
+ clientConfig: LPPromptClientConfig;
668
+ variables: LPPromptVariable[];
669
+ }
670
+ /**
671
+ * Version detail for a prompt
672
+ */
673
+ interface LPPromptVersionDetail {
674
+ version: number;
675
+ createdBy: string;
676
+ createdAt: number;
677
+ }
678
+ /**
679
+ * Client types for prompts
680
+ */
681
+ type LPPromptClientType = 'AUTO_SUMMARIZATION' | 'MESSAGING_BOT' | 'CONV_ASSIST' | 'COPILOT_REWRITE' | 'VOICE_BOT' | 'VOICE_AGENT' | 'ROUTING_AI_AGENT_MESSAGING_BOT' | 'ROUTING_AI_AGENT_VOICE_BOT' | 'LANGUAGE_DETECTION' | 'TRANSLATION';
682
+ /**
683
+ * Prompt status
684
+ */
685
+ type LPPromptStatus = 'ACTIVE' | 'INACTIVE' | 'DRAFT';
686
+ /**
687
+ * Prompt entity returned by LivePerson Prompt Library API
688
+ */
689
+ interface LPPrompt {
690
+ accountId: string;
691
+ id: string;
692
+ name: string;
693
+ clientType: LPPromptClientType;
694
+ description: string;
695
+ langCode: string;
696
+ promptHeader: string;
697
+ createdBy: string;
698
+ createdAt: number;
699
+ updatedBy?: string;
700
+ updatedAt: number;
701
+ version: number;
702
+ status: LPPromptStatus;
703
+ default: boolean;
704
+ configuration: LPPromptConfiguration;
705
+ versionDetails: LPPromptVersionDetail[];
706
+ }
707
+ /**
708
+ * LLM Provider subscription models
709
+ */
710
+ interface LPLLMProviderModels {
711
+ [modelName: string]: 'ENABLED' | 'DISABLED';
712
+ }
713
+ /**
714
+ * LLM Type
715
+ */
716
+ type LPLLMType = 'INTERNAL' | 'EXTERNAL';
717
+ /**
718
+ * LLM Provider subscription
719
+ */
720
+ interface LPLLMProviderSubscription {
721
+ models: LPLLMProviderModels;
722
+ account_id: string;
723
+ provider_name: string;
724
+ subscription_name: string;
725
+ enable_subscription: boolean;
726
+ llmType: LPLLMType;
727
+ supported_clients?: LPPromptClientType[];
728
+ created_at: number;
729
+ updated_at: number;
730
+ }
731
+ /**
732
+ * Data for creating a new prompt
733
+ */
734
+ interface CreateLPPromptRequest {
735
+ name: string;
736
+ clientType: LPPromptClientType;
737
+ description?: string;
738
+ langCode?: string;
739
+ promptHeader: string;
740
+ status?: LPPromptStatus;
741
+ default?: boolean;
742
+ configuration: LPPromptConfiguration;
743
+ }
744
+ /**
745
+ * Data for updating a prompt
746
+ */
747
+ interface UpdateLPPromptRequest {
748
+ name?: string;
749
+ description?: string;
750
+ langCode?: string;
751
+ promptHeader?: string;
752
+ status?: LPPromptStatus;
753
+ default?: boolean;
754
+ configuration?: Partial<LPPromptConfiguration>;
755
+ }
756
+ /**
757
+ * Query parameters for prompts API
758
+ */
759
+ interface LPPromptsQueryParams {
760
+ /** Source of the request (default: 'ccui') */
761
+ source?: string;
762
+ /** Filter by client type */
763
+ clientType?: LPPromptClientType;
764
+ /** Filter by status */
765
+ status?: LPPromptStatus;
766
+ }
767
+
768
+ /**
769
+ * AI Studio Types
770
+ *
771
+ * TypeScript interfaces for LP AI Studio APIs.
772
+ * These use CC-Bearer authentication.
773
+ */
774
+ interface AIStudioCategory {
775
+ id: string;
776
+ name: string;
777
+ description?: string;
778
+ parentId?: string;
779
+ createdAt?: string;
780
+ updatedAt?: string;
781
+ }
782
+ interface CreateCategoryRequest {
783
+ name: string;
784
+ description?: string;
785
+ parentId?: string;
786
+ }
787
+ interface UpdateCategoryRequest {
788
+ name?: string;
789
+ description?: string;
790
+ parentId?: string;
791
+ }
792
+ interface AIStudioConversation {
793
+ id: string;
794
+ categoryId?: string;
795
+ title?: string;
796
+ messages: AIStudioMessage[];
797
+ attributes?: Record<string, unknown>;
798
+ status?: 'open' | 'closed';
799
+ createdAt?: string;
800
+ updatedAt?: string;
801
+ }
802
+ interface AIStudioMessage {
803
+ role: 'user' | 'assistant' | 'system';
804
+ content: string;
805
+ timestamp?: string;
806
+ }
807
+ interface CreateConversationRequest$1 {
808
+ categoryId?: string;
809
+ title?: string;
810
+ messages?: AIStudioMessage[];
811
+ attributes?: Record<string, unknown>;
812
+ }
813
+ interface UpdateConversationRequest {
814
+ categoryId?: string;
815
+ title?: string;
816
+ messages?: AIStudioMessage[];
817
+ attributes?: Record<string, unknown>;
818
+ }
819
+ interface ConversationQueryParams {
820
+ categoryId?: string;
821
+ status?: 'open' | 'closed';
822
+ limit?: number;
823
+ offset?: number;
824
+ }
825
+ interface UpdateConversationAttributesRequest {
826
+ attributes: Record<string, unknown>;
827
+ }
828
+ interface SummaryRequest {
829
+ conversationId: string;
830
+ type?: 'short' | 'detailed';
831
+ }
832
+ interface BatchSummaryRequest {
833
+ conversationIds: string[];
834
+ type?: 'short' | 'detailed';
835
+ }
836
+ interface AIStudioSummary {
837
+ id: string;
838
+ conversationId: string;
839
+ summary: string;
840
+ type: string;
841
+ createdAt?: string;
842
+ }
843
+ interface QueryGenerateRequest {
844
+ prompt: string;
845
+ context?: Record<string, unknown>;
846
+ }
847
+ interface QueryGenerateResponse {
848
+ query: string;
849
+ confidence?: number;
850
+ }
851
+ interface AIStudioSimulation {
852
+ id: string;
853
+ name: string;
854
+ description?: string;
855
+ status: 'draft' | 'running' | 'completed' | 'failed' | 'cancelled';
856
+ config?: SimulationConfig;
857
+ results?: SimulationResults;
858
+ createdAt?: string;
859
+ updatedAt?: string;
860
+ }
861
+ interface SimulationConfig {
862
+ flowId?: string;
863
+ iterations?: number;
864
+ testCases?: SimulationTestCase[];
865
+ }
866
+ interface SimulationTestCase {
867
+ input: string;
868
+ expectedOutput?: string;
869
+ }
870
+ interface SimulationResults {
871
+ totalTests: number;
872
+ passed: number;
873
+ failed: number;
874
+ accuracy?: number;
875
+ }
876
+ interface CreateSimulationRequest {
877
+ name: string;
878
+ description?: string;
879
+ config: SimulationConfig;
880
+ }
881
+ interface UpdateSimulationRequest {
882
+ name?: string;
883
+ description?: string;
884
+ config?: SimulationConfig;
885
+ }
886
+ interface SimulationQueryParams {
887
+ status?: string;
888
+ limit?: number;
889
+ offset?: number;
890
+ }
891
+ interface SimulationJobResult {
892
+ jobId: string;
893
+ status: string;
894
+ results?: Record<string, unknown>;
895
+ }
896
+ interface TranscriptAnalysis {
897
+ id: string;
898
+ name?: string;
899
+ owner?: string;
900
+ status: 'pending' | 'processing' | 'completed' | 'failed';
901
+ conversations?: TranscriptConversation[];
902
+ questions?: TranscriptQuestion[];
903
+ createdAt?: string;
904
+ updatedAt?: string;
905
+ }
906
+ interface TranscriptConversation {
907
+ id: string;
908
+ transcript: string;
909
+ analysis?: Record<string, unknown>;
910
+ }
911
+ interface TranscriptQuestion {
912
+ question: string;
913
+ answer?: string;
914
+ }
915
+ interface CreateTranscriptAnalysisRequest {
916
+ name?: string;
917
+ conversations: TranscriptConversation[];
918
+ questions?: string[];
919
+ }
920
+ interface UpdateTranscriptAnalysisRequest {
921
+ name?: string;
922
+ conversations?: TranscriptConversation[];
923
+ questions?: string[];
924
+ }
925
+ interface Knowledgebase {
926
+ id: string;
927
+ name: string;
928
+ description?: string;
929
+ type?: 'standard' | 'kai';
930
+ itemCount?: number;
931
+ health?: KnowledgebaseHealth;
932
+ createdAt?: string;
933
+ updatedAt?: string;
934
+ }
935
+ interface KnowledgebaseHealth {
936
+ status: 'healthy' | 'warning' | 'error';
937
+ score?: number;
938
+ issues?: string[];
939
+ }
940
+ interface KnowledgebaseSearchRequest {
941
+ query: string;
942
+ limit?: number;
943
+ threshold?: number;
944
+ filters?: Record<string, unknown>;
945
+ }
946
+ interface KnowledgebaseSearchResult {
947
+ id: string;
948
+ content: string;
949
+ score: number;
950
+ metadata?: Record<string, unknown>;
951
+ }
952
+ interface KnowledgebaseItem {
953
+ id: string;
954
+ sourceId: string;
955
+ content: string;
956
+ metadata?: Record<string, unknown>;
957
+ createdAt?: string;
958
+ updatedAt?: string;
959
+ }
960
+ interface KnowledgebaseTextItem {
961
+ id?: string;
962
+ content: string;
963
+ metadata?: Record<string, unknown>;
964
+ }
965
+ interface SimilarityEvaluationRequest {
966
+ text1: string;
967
+ text2: string;
968
+ model?: string;
969
+ }
970
+ interface SimilarityEvaluationResponse {
971
+ similarity: number;
972
+ model: string;
973
+ }
974
+ interface ResolutionEvaluationRequest {
975
+ conversation: AIStudioMessage[];
976
+ expectedResolution?: string;
977
+ }
978
+ interface ResolutionEvaluationResponse {
979
+ resolved: boolean;
980
+ confidence: number;
981
+ explanation?: string;
982
+ }
983
+ interface GuidedRoutingEvaluationRequest {
984
+ input: string;
985
+ routes: GuidedRoute[];
986
+ }
987
+ interface GuidedRoute {
988
+ id: string;
989
+ name: string;
990
+ description?: string;
991
+ }
992
+ interface GuidedRoutingEvaluationResponse {
993
+ selectedRoute: string;
994
+ confidence: number;
995
+ reasoning?: string;
996
+ }
997
+ interface QuestionGeneratorRequest {
998
+ context: string;
999
+ count?: number;
1000
+ style?: 'simple' | 'complex';
1001
+ }
1002
+ interface QuestionGeneratorResponse {
1003
+ questions: GeneratedQuestion[];
1004
+ }
1005
+ interface GeneratedQuestion {
1006
+ question: string;
1007
+ answer?: string;
1008
+ confidence?: number;
1009
+ }
1010
+ interface KAIRouteGeneratorRequest {
1011
+ flowId: string;
1012
+ inputData?: Record<string, unknown>;
1013
+ useLlm?: boolean;
1014
+ }
1015
+ interface KAIRouteGeneratorResponse {
1016
+ routes: GeneratedRoute[];
1017
+ status?: string;
1018
+ }
1019
+ interface GeneratedRoute {
1020
+ id: string;
1021
+ name: string;
1022
+ conditions?: string[];
1023
+ }
1024
+ interface KAIRouteGenerationStatus {
1025
+ flowId: string;
1026
+ status: 'pending' | 'processing' | 'completed' | 'failed';
1027
+ progress?: number;
1028
+ routes?: GeneratedRoute[];
1029
+ }
1030
+ interface Prompt {
1031
+ id: string;
1032
+ name: string;
1033
+ description?: string;
1034
+ content: string;
1035
+ type?: 'system' | 'user' | 'custom';
1036
+ variables?: PromptVariable[];
1037
+ createdAt?: string;
1038
+ updatedAt?: string;
1039
+ }
1040
+ interface PromptVariable {
1041
+ name: string;
1042
+ type: 'string' | 'number' | 'boolean';
1043
+ required?: boolean;
1044
+ defaultValue?: unknown;
1045
+ }
1046
+ interface CreatePromptRequest {
1047
+ name: string;
1048
+ description?: string;
1049
+ content: string;
1050
+ type?: 'system' | 'user' | 'custom';
1051
+ variables?: PromptVariable[];
1052
+ }
1053
+ interface UpdatePromptRequest {
1054
+ name?: string;
1055
+ description?: string;
1056
+ content?: string;
1057
+ variables?: PromptVariable[];
1058
+ }
1059
+ interface LLMProvider {
1060
+ id: string;
1061
+ name: string;
1062
+ models: LLMModel[];
1063
+ }
1064
+ interface LLMModel {
1065
+ id: string;
1066
+ name: string;
1067
+ contextWindow?: number;
1068
+ capabilities?: string[];
1069
+ }
1070
+ interface AIStudioUser {
1071
+ id: string;
1072
+ email?: string;
1073
+ name?: string;
1074
+ role?: string;
1075
+ models?: string[];
1076
+ termsAgreed?: boolean;
1077
+ createdAt?: string;
1078
+ updatedAt?: string;
1079
+ }
1080
+ interface CreateAIStudioUserRequest {
1081
+ email: string;
1082
+ name?: string;
1083
+ role?: string;
1084
+ models?: string[];
1085
+ }
1086
+ interface UpdateAIStudioUserRequest {
1087
+ name?: string;
1088
+ role?: string;
1089
+ }
1090
+ interface UpdateAIStudioUserModelsRequest {
1091
+ models: string[];
1092
+ }
1093
+ interface AIStudioFlow {
1094
+ id: string;
1095
+ name: string;
1096
+ description?: string;
1097
+ status: 'draft' | 'published' | 'archived';
1098
+ version?: string;
1099
+ config?: Record<string, unknown>;
1100
+ createdAt?: string;
1101
+ updatedAt?: string;
1102
+ }
1103
+ interface InvokeFlowRequest {
1104
+ input: Record<string, unknown>;
1105
+ variables?: Record<string, unknown>;
1106
+ }
1107
+ interface InvokeFlowResponse {
1108
+ executionId: string;
1109
+ output: Record<string, unknown>;
1110
+ status: 'completed' | 'failed';
1111
+ error?: string;
1112
+ duration?: number;
1113
+ }
1114
+
1115
+ /**
1116
+ * Messaging & Conversation Types
1117
+ *
1118
+ * TypeScript interfaces for LP Messaging APIs.
1119
+ */
1120
+ interface MessagingConversation {
1121
+ conversationId: string;
1122
+ brandId: string;
1123
+ status: 'OPEN' | 'CLOSE';
1124
+ startTs?: number;
1125
+ endTs?: number;
1126
+ closeReason?: string;
1127
+ closeReasonDescription?: string;
1128
+ firstConversation?: boolean;
1129
+ participants?: ConversationParticipant[];
1130
+ consumerParticipants?: ConsumerParticipant[];
1131
+ transfers?: ConversationTransfer[];
1132
+ interactions?: ConversationInteraction[];
1133
+ messageRecords?: MessageRecord[];
1134
+ agentParticipants?: AgentParticipant[];
1135
+ summary?: ConversationSummary;
1136
+ sdes?: SDERecord;
1137
+ coBrowseSessions?: CoBrowseSession[];
1138
+ surveys?: SurveyRecord[];
1139
+ }
1140
+ interface ConversationParticipant {
1141
+ id: string;
1142
+ role: 'CONSUMER' | 'AGENT' | 'MANAGER' | 'SYSTEM';
1143
+ }
1144
+ interface ConsumerParticipant {
1145
+ participantId: string;
1146
+ firstName?: string;
1147
+ lastName?: string;
1148
+ phone?: string;
1149
+ email?: string;
1150
+ avatarURL?: string;
1151
+ consumerName?: string;
1152
+ token?: string;
1153
+ time?: string;
1154
+ timeL?: number;
1155
+ joinTime?: string;
1156
+ joinTimeL?: number;
1157
+ }
1158
+ interface AgentParticipant {
1159
+ agentId: string;
1160
+ agentLoginName?: string;
1161
+ agentNickname?: string;
1162
+ agentFullName?: string;
1163
+ agentPid?: string;
1164
+ userType?: string;
1165
+ userTypeName?: string;
1166
+ role?: string;
1167
+ agentGroupId?: number;
1168
+ agentGroupName?: string;
1169
+ time?: string;
1170
+ timeL?: number;
1171
+ permission?: string;
1172
+ }
1173
+ interface ConversationTransfer {
1174
+ sourceSkillId?: number;
1175
+ sourceSkillName?: string;
1176
+ sourceAgentId?: string;
1177
+ sourceAgentLoginName?: string;
1178
+ sourceAgentNickname?: string;
1179
+ sourceAgentFullName?: string;
1180
+ targetSkillId?: number;
1181
+ targetSkillName?: string;
1182
+ reason?: string;
1183
+ time?: string;
1184
+ timeL?: number;
1185
+ by?: string;
1186
+ contextData?: Record<string, unknown>;
1187
+ }
1188
+ interface ConversationInteraction {
1189
+ assignedAgentId?: string;
1190
+ assignedAgentLoginName?: string;
1191
+ assignedAgentNickname?: string;
1192
+ assignedAgentFullName?: string;
1193
+ agentGroupId?: number;
1194
+ agentGroupName?: string;
1195
+ interactionTime?: string;
1196
+ interactionTimeL?: number;
1197
+ interactiveSequence?: number;
1198
+ }
1199
+ interface MessageRecord {
1200
+ type: 'TEXT_PLAIN' | 'TEXT_HTML' | 'HOSTED_FILE' | 'EXTERNAL_FILE' | 'LINE_ITEM' | 'RICH_CONTENT';
1201
+ messageData?: MessageData;
1202
+ messageId?: string;
1203
+ seq?: number;
1204
+ dialogId?: string;
1205
+ participantId?: string;
1206
+ source?: string;
1207
+ time?: string;
1208
+ timeL?: number;
1209
+ device?: string;
1210
+ sentBy?: string;
1211
+ contextData?: Record<string, unknown>;
1212
+ }
1213
+ interface MessageData {
1214
+ msg?: TextMessage;
1215
+ file?: FileMessage;
1216
+ richContent?: RichContentMessage;
1217
+ }
1218
+ interface TextMessage {
1219
+ text?: string;
1220
+ }
1221
+ interface FileMessage {
1222
+ relativePath?: string;
1223
+ fileType?: string;
1224
+ caption?: string;
1225
+ }
1226
+ interface RichContentMessage {
1227
+ content: Record<string, unknown>;
1228
+ }
1229
+ interface ConversationSummary {
1230
+ text?: string;
1231
+ lastUpdatedTime?: number;
1232
+ }
1233
+ interface SDERecord {
1234
+ events: SDEEvent[];
1235
+ }
1236
+ interface SDEEvent {
1237
+ sdeType: string;
1238
+ serverTimeStamp?: string;
1239
+ customerInfo?: Record<string, unknown>;
1240
+ personalInfo?: Record<string, unknown>;
1241
+ marketingCampaignInfo?: Record<string, unknown>;
1242
+ lead?: Record<string, unknown>;
1243
+ transaction?: Record<string, unknown>;
1244
+ viewedProduct?: Record<string, unknown>[];
1245
+ cartStatus?: Record<string, unknown>;
1246
+ serviceActivity?: Record<string, unknown>;
1247
+ visitorError?: Record<string, unknown>;
1248
+ searchContent?: Record<string, unknown>;
1249
+ }
1250
+ interface CoBrowseSession {
1251
+ sessionId: string;
1252
+ startTime?: string;
1253
+ startTimeL?: number;
1254
+ endTime?: string;
1255
+ endTimeL?: number;
1256
+ interactiveTime?: string;
1257
+ interactiveTimeL?: number;
1258
+ endReason?: string;
1259
+ duration?: number;
1260
+ type?: string;
1261
+ agentId?: string;
1262
+ }
1263
+ interface SurveyRecord {
1264
+ surveyType?: string;
1265
+ surveyData?: Record<string, unknown>[];
1266
+ surveyStatus?: string;
1267
+ }
1268
+ interface MessagingHistoryQuery {
1269
+ start: {
1270
+ from: number;
1271
+ to: number;
1272
+ };
1273
+ status?: ('OPEN' | 'CLOSE')[];
1274
+ skillIds?: number[];
1275
+ agentIds?: string[];
1276
+ agentGroupIds?: number[];
1277
+ keyword?: string;
1278
+ summary?: boolean;
1279
+ contentToRetrieve?: ContentToRetrieve[];
1280
+ sort?: 'start:asc' | 'start:desc' | 'end:asc' | 'end:desc';
1281
+ offset?: number;
1282
+ limit?: number;
1283
+ }
1284
+ type ContentToRetrieve = 'campaign' | 'messageRecords' | 'agentParticipants' | 'agentParticipantsLeave' | 'agentParticipantsActive' | 'consumerParticipants' | 'transfers' | 'interactions' | 'messageStatuses' | 'messageScores' | 'conversationSurveys' | 'coBrowseSessions' | 'summary' | 'sdes' | 'responseTime' | 'skillsInfo' | 'dialogs' | 'intents';
1285
+ interface MessagingHistoryResponse {
1286
+ _metadata: {
1287
+ count: number;
1288
+ self: {
1289
+ rel: string;
1290
+ href: string;
1291
+ };
1292
+ next?: {
1293
+ rel: string;
1294
+ href: string;
1295
+ };
1296
+ prev?: {
1297
+ rel: string;
1298
+ href: string;
1299
+ };
1300
+ shardsStatusResult?: {
1301
+ partialResult: boolean;
1302
+ };
1303
+ };
1304
+ conversationHistoryRecords: MessagingConversation[];
1305
+ }
1306
+ interface MessagingInteraction {
1307
+ consumerMessages?: number;
1308
+ agentMessages?: number;
1309
+ transfers?: number;
1310
+ duration?: number;
1311
+ effectiveDuration?: number;
1312
+ mcs?: number;
1313
+ alertedMcs?: number;
1314
+ csat?: number;
1315
+ csatRate?: number;
1316
+ }
1317
+ interface AgentMetrics {
1318
+ agentId: string;
1319
+ loginName?: string;
1320
+ currentStatusDuration?: number;
1321
+ currentAvailabilityState?: string;
1322
+ currentStatus?: AgentStatus;
1323
+ load?: number;
1324
+ ringingSlots?: number;
1325
+ configuredMaxSlots?: number;
1326
+ openAssignedConversations?: number;
1327
+ intenseConversations?: number;
1328
+ }
1329
+ interface AgentStatus {
1330
+ statusId: number;
1331
+ statusName?: string;
1332
+ statusChangedTimestamp?: number;
1333
+ statusReasonId?: number;
1334
+ statusReasonName?: string;
1335
+ }
1336
+ interface AgentMetricsQuery {
1337
+ agentIds?: string[];
1338
+ skillIds?: number[];
1339
+ agentGroupIds?: number[];
1340
+ includeAgentMetadata?: boolean;
1341
+ }
1342
+ interface AgentActivity {
1343
+ agentId: string;
1344
+ loginName?: string;
1345
+ activities: ActivityRecord[];
1346
+ }
1347
+ interface ActivityRecord {
1348
+ timestamp: number;
1349
+ activityType: 'LOGIN' | 'LOGOUT' | 'STATUS_CHANGE' | 'CONVERSATION_ASSIGNED' | 'CONVERSATION_CLOSED';
1350
+ details?: Record<string, unknown>;
1351
+ }
1352
+ interface AgentActivityQuery {
1353
+ agentIds?: string[];
1354
+ from: number;
1355
+ to: number;
1356
+ activityTypes?: string[];
1357
+ }
1358
+ interface TransferConversationRequest {
1359
+ conversationId: string;
1360
+ targetSkillId?: number;
1361
+ targetAgentId?: string;
1362
+ reason?: string;
1363
+ }
1364
+ interface CloseConversationRequest {
1365
+ conversationId: string;
1366
+ closeReason?: string;
1367
+ }
1368
+ interface SendMessageRequest {
1369
+ conversationId: string;
1370
+ message: string;
1371
+ contentType?: 'text/plain' | 'text/html';
1372
+ richContent?: Record<string, unknown>;
1373
+ }
1374
+ interface CreateConversationRequest {
1375
+ campaignId: number;
1376
+ engagementId: number;
1377
+ skillId?: number;
1378
+ consumerProfile?: ConsumerProfile;
1379
+ context?: ConversationContext;
1380
+ }
1381
+ interface ConsumerProfile {
1382
+ firstName?: string;
1383
+ lastName?: string;
1384
+ email?: string;
1385
+ phone?: string;
1386
+ avatarURL?: string;
1387
+ }
1388
+ interface ConversationContext {
1389
+ type?: string;
1390
+ name?: string;
1391
+ engagementAttributes?: Record<string, unknown>[];
1392
+ }
1393
+ interface CreateConversationResponse {
1394
+ conversationId: string;
1395
+ status: string;
1396
+ }
1397
+ interface OutboundCampaignReport {
1398
+ campaignId: string;
1399
+ campaignName?: string;
1400
+ sent?: number;
1401
+ delivered?: number;
1402
+ opened?: number;
1403
+ clicked?: number;
1404
+ bounced?: number;
1405
+ unsubscribed?: number;
1406
+ complaints?: number;
1407
+ }
1408
+ interface OutboundReportQuery {
1409
+ campaignIds?: string[];
1410
+ from: number;
1411
+ to: number;
1412
+ aggregation?: 'hourly' | 'daily' | 'weekly';
1413
+ }
1414
+
1415
+ /**
1416
+ * LP Extend Client SDK - Type Definitions Index
1417
+ *
1418
+ * Re-exports all types from domain-specific type files.
1419
+ */
1420
+
1421
+ /**
1422
+ * Configuration options for initializing the SDK
1423
+ */
1424
+ interface LPExtendSDKConfig {
1425
+ /**
1426
+ * Your registered app ID from LP Extend
1427
+ * @example 'my-qa-app'
1428
+ */
1429
+ appId: string;
1430
+ /**
1431
+ * LivePerson account ID
1432
+ * @example '12345678'
1433
+ */
1434
+ accountId: string;
1435
+ /**
1436
+ * LP Access token (obtained from shell auth)
1437
+ * This is the user's LP bearer token passed to the child app.
1438
+ *
1439
+ * Either provide this directly OR provide extendToken OR provide shellToken.
1440
+ */
1441
+ accessToken?: string;
1442
+ /**
1443
+ * ExtendJWT token (NEW - preferred method)
1444
+ * Encrypted JWT from shell containing all auth data.
1445
+ * SDK will verify with shell and get LP access token.
1446
+ *
1447
+ * @example Received via URL params: ?extendToken=xxx
1448
+ */
1449
+ extendToken?: string;
1450
+ /**
1451
+ * Shell JWT token (X-Shell-Token) - LEGACY
1452
+ * If provided instead of accessToken, the SDK will automatically
1453
+ * fetch the LP access token from the shell during initialization.
1454
+ *
1455
+ * @example Received via URL params: ?shellToken=xxx
1456
+ * @deprecated Use extendToken instead
1457
+ */
1458
+ shellToken?: string;
1459
+ /**
1460
+ * Shell backend base URL
1461
+ * Required when using extendToken or shellToken for automatic token retrieval.
1462
+ * @default Derived from window.location.origin or parent frame
1463
+ * @example 'https://lp-extend.example.com'
1464
+ */
1465
+ shellBaseUrl?: string;
1466
+ /**
1467
+ * Scopes your app requests access to
1468
+ * These are validated against app registration
1469
+ * @example ['skills', 'users', 'agentGroups']
1470
+ */
1471
+ scopes?: string[];
1472
+ /**
1473
+ * Enable debug logging
1474
+ * @default false
1475
+ */
1476
+ debug?: boolean;
1477
+ /**
1478
+ * Request timeout in milliseconds
1479
+ * @default 30000
1480
+ */
1481
+ timeout?: number;
1482
+ }
1483
+ /**
1484
+ * SDK initialization result
1485
+ */
1486
+ interface SDKInitResult {
1487
+ /** App ID confirmed by shell */
1488
+ appId: string;
1489
+ /** Account ID */
1490
+ accountId: string;
1491
+ /** Scopes granted based on app registration */
1492
+ grantedScopes: string[];
1493
+ /** App name from registration */
1494
+ appName: string;
1495
+ /** App version */
1496
+ version?: string;
1497
+ }
1498
+ /**
1499
+ * Standard API response wrapper
1500
+ */
1501
+ interface APIResponse<T> {
1502
+ /** Response data */
1503
+ data: T;
1504
+ /** Revision number for optimistic locking (used for updates/deletes) */
1505
+ revision?: string;
1506
+ }
1507
+ /**
1508
+ * Paginated response
1509
+ */
1510
+ interface PaginatedResponse<T> {
1511
+ /** Array of items */
1512
+ items: T[];
1513
+ /** Total count */
1514
+ total: number;
1515
+ /** Current offset */
1516
+ offset: number;
1517
+ /** Page size */
1518
+ limit: number;
1519
+ /** Next page token if available */
1520
+ nextOffset?: number;
1521
+ }
1522
+ /**
1523
+ * SDK Error
1524
+ */
1525
+ declare class LPExtendSDKError extends Error {
1526
+ readonly code: string;
1527
+ readonly status?: number | undefined;
1528
+ readonly details?: Record<string, unknown> | undefined;
1529
+ constructor(message: string, code: string, status?: number | undefined, details?: Record<string, unknown> | undefined);
1530
+ }
1531
+ /**
1532
+ * Error codes
1533
+ */
1534
+ declare const ErrorCodes: {
1535
+ /** Not running inside shell iframe */
1536
+ readonly NOT_IN_SHELL: "NOT_IN_SHELL";
1537
+ /** SDK initialization failed */
1538
+ readonly INIT_FAILED: "INIT_FAILED";
1539
+ /** App not registered or disabled */
1540
+ readonly APP_NOT_REGISTERED: "APP_NOT_REGISTERED";
1541
+ /** Authentication failed */
1542
+ readonly UNAUTHORIZED: "UNAUTHORIZED";
1543
+ /** Scope not granted - update app registration */
1544
+ readonly SCOPE_DENIED: "SCOPE_DENIED";
1545
+ /** Resource not found */
1546
+ readonly NOT_FOUND: "NOT_FOUND";
1547
+ /** API call failed */
1548
+ readonly API_ERROR: "API_ERROR";
1549
+ /** Request timeout */
1550
+ readonly TIMEOUT: "TIMEOUT";
1551
+ /** Invalid configuration */
1552
+ readonly INVALID_CONFIG: "INVALID_CONFIG";
1553
+ /** Revision conflict - resource was modified */
1554
+ readonly REVISION_CONFLICT: "REVISION_CONFLICT";
1555
+ /** Rate limit exceeded */
1556
+ readonly RATE_LIMITED: "RATE_LIMITED";
1557
+ };
1558
+ type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
1559
+ /**
1560
+ * Configuration for retrieving LP token from shell
1561
+ */
1562
+ interface ShellTokenConfig {
1563
+ /**
1564
+ * Shell backend base URL
1565
+ * @example 'https://lp-extend.example.com'
1566
+ */
1567
+ shellBaseUrl: string;
1568
+ /**
1569
+ * LP Account ID
1570
+ * @example '12345678'
1571
+ */
1572
+ accountId: string;
1573
+ /**
1574
+ * Shell JWT token (X-Shell-Token)
1575
+ * Received from shell via postMessage or URL params
1576
+ */
1577
+ shellToken: string;
1578
+ /**
1579
+ * Your registered app ID
1580
+ * @example 'my-qa-app'
1581
+ */
1582
+ appId: string;
1583
+ /**
1584
+ * Optional scopes to request validation for
1585
+ */
1586
+ scopes?: string[];
1587
+ /**
1588
+ * Request timeout in milliseconds
1589
+ * @default 10000
1590
+ */
1591
+ timeout?: number;
1592
+ }
1593
+ /**
1594
+ * User profile data returned with LP token
1595
+ */
1596
+ interface ShellTokenUser {
1597
+ id: string;
1598
+ fullName?: string;
1599
+ email?: string;
1600
+ loginName?: string;
1601
+ profileIds?: number[];
1602
+ skillIds?: number[];
1603
+ }
1604
+ /**
1605
+ * Response from shell token retrieval
1606
+ */
1607
+ interface ShellTokenResponse {
1608
+ /** LP Bearer access token for API calls */
1609
+ accessToken: string;
1610
+ /** Token expiration timestamp (Unix ms) */
1611
+ expiresAt: number;
1612
+ /** LP Account ID */
1613
+ accountId: string;
1614
+ /** LP User ID */
1615
+ userId: string;
1616
+ /** User profile data */
1617
+ user?: ShellTokenUser;
1618
+ /**
1619
+ * Conversation Builder API token
1620
+ * Used for authenticating CB API calls
1621
+ */
1622
+ cbToken?: string;
1623
+ /**
1624
+ * Conversation Builder organization ID
1625
+ * Required for CB API calls
1626
+ */
1627
+ cbOrg?: string;
1628
+ }
1629
+
1630
+ /**
1631
+ * HTTP Client
1632
+ *
1633
+ * Makes HTTP requests directly to LivePerson APIs.
1634
+ * Handles domain resolution, authentication, and revision management.
1635
+ * Supports both Bearer (standard LP) and CC-Bearer (AI Studio) auth modes.
1636
+ */
1637
+
1638
+ /**
1639
+ * Auth mode for LP APIs
1640
+ */
1641
+ type AuthMode = 'bearer' | 'cc-bearer';
1642
+ /**
1643
+ * Request options
1644
+ */
1645
+ interface RequestOptions {
1646
+ body?: unknown;
1647
+ headers?: Record<string, string>;
1648
+ params?: Record<string, string | number | boolean | undefined>;
1649
+ /** Revision for optimistic locking (If-Match header) */
1650
+ revision?: string;
1651
+ /** Auth mode override (default: bearer) */
1652
+ authMode?: AuthMode;
1653
+ /** Custom timeout for this request */
1654
+ timeout?: number;
1655
+ }
1656
+ /**
1657
+ * HTTP Client for direct LP API calls
1658
+ *
1659
+ * All requests go directly to LivePerson APIs.
1660
+ * Domain resolution is handled via CSDS.
1661
+ * The shell is only consulted for scope validation during SDK init.
1662
+ */
1663
+ declare class HTTPClient {
1664
+ private readonly accountId;
1665
+ private readonly accessToken;
1666
+ private readonly defaultTimeout;
1667
+ private readonly debug;
1668
+ private readonly domainResolver;
1669
+ constructor(accountId: string, accessToken: string, defaultTimeout: number, debug: boolean);
1670
+ /**
1671
+ * Make a GET request
1672
+ */
1673
+ get<T>(path: string, options?: RequestOptions): Promise<APIResponse<T>>;
1674
+ /**
1675
+ * Make a POST request
1676
+ */
1677
+ post<T>(path: string, body?: unknown, options?: RequestOptions): Promise<APIResponse<T>>;
1678
+ /**
1679
+ * Make a PUT request
1680
+ */
1681
+ put<T>(path: string, body?: unknown, options?: RequestOptions): Promise<APIResponse<T>>;
1682
+ /**
1683
+ * Make a DELETE request
1684
+ */
1685
+ delete<T>(path: string, options?: RequestOptions): Promise<APIResponse<T>>;
1686
+ /**
1687
+ * Make a PATCH request
1688
+ */
1689
+ patch<T>(path: string, body?: unknown, options?: RequestOptions): Promise<APIResponse<T>>;
1690
+ /**
1691
+ * Create a scoped client for a specific API domain
1692
+ * This allows setting default options like authMode for all requests
1693
+ */
1694
+ withDefaults(defaults: Partial<RequestOptions>): ScopedHTTPClient;
1695
+ /**
1696
+ * Build the full URL for an LP API endpoint
1697
+ */
1698
+ private buildUrl;
1699
+ /**
1700
+ * Determine scope from path
1701
+ */
1702
+ private getScopeFromPath;
1703
+ /**
1704
+ * Make HTTP request to LP API
1705
+ */
1706
+ private request;
1707
+ /**
1708
+ * Strip the scope prefix from the path
1709
+ */
1710
+ private stripScopeFromPath;
1711
+ /**
1712
+ * Handle HTTP error responses
1713
+ */
1714
+ private handleError;
1715
+ /**
1716
+ * Debug logging
1717
+ */
1718
+ private log;
1719
+ }
1720
+ /**
1721
+ * Scoped HTTP client with preset defaults
1722
+ * Used for API modules that need specific auth modes
1723
+ */
1724
+ declare class ScopedHTTPClient {
1725
+ private readonly client;
1726
+ private readonly defaults;
1727
+ constructor(client: HTTPClient, defaults: Partial<RequestOptions>);
1728
+ get<T>(path: string, options?: RequestOptions): Promise<APIResponse<T>>;
1729
+ post<T>(path: string, body?: unknown, options?: RequestOptions): Promise<APIResponse<T>>;
1730
+ put<T>(path: string, body?: unknown, options?: RequestOptions): Promise<APIResponse<T>>;
1731
+ delete<T>(path: string, options?: RequestOptions): Promise<APIResponse<T>>;
1732
+ patch<T>(path: string, body?: unknown, options?: RequestOptions): Promise<APIResponse<T>>;
1733
+ private mergeOptions;
1734
+ }
1735
+
1736
+ /**
1737
+ * Account Configuration API Module
1738
+ *
1739
+ * Provides access to LivePerson Account Configuration APIs.
1740
+ * These include Skills, Users, Agent Groups, Profiles, LOBs, Campaigns, etc.
1741
+ * Uses standard Bearer authentication.
1742
+ */
1743
+
1744
+ /**
1745
+ * Skills API
1746
+ *
1747
+ * Manage LivePerson skills for routing conversations.
1748
+ */
1749
+ declare class SkillsAPI {
1750
+ private http;
1751
+ constructor(http: HTTPClient);
1752
+ /**
1753
+ * Get all skills
1754
+ */
1755
+ getAll(): Promise<APIResponse<LPSkill[]>>;
1756
+ /**
1757
+ * Get a skill by ID
1758
+ */
1759
+ getById(skillId: number): Promise<APIResponse<LPSkill>>;
1760
+ /**
1761
+ * Create a new skill
1762
+ */
1763
+ create(skill: CreateSkillRequest): Promise<APIResponse<LPSkill>>;
1764
+ /**
1765
+ * Update a skill
1766
+ * @param skillId - The skill ID
1767
+ * @param skill - Updated skill data
1768
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1769
+ */
1770
+ update(skillId: number, skill: UpdateSkillRequest, revision?: string): Promise<APIResponse<LPSkill>>;
1771
+ /**
1772
+ * Delete a skill
1773
+ * @param skillId - The skill ID
1774
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1775
+ */
1776
+ delete(skillId: number, revision?: string): Promise<APIResponse<void>>;
1777
+ }
1778
+ /**
1779
+ * Users API
1780
+ *
1781
+ * Manage LivePerson users and agents.
1782
+ */
1783
+ declare class UsersAPI {
1784
+ private http;
1785
+ constructor(http: HTTPClient);
1786
+ /**
1787
+ * Get all users
1788
+ */
1789
+ getAll(): Promise<APIResponse<LPUser[]>>;
1790
+ /**
1791
+ * Get a user by ID
1792
+ */
1793
+ getById(userId: string): Promise<APIResponse<LPUser>>;
1794
+ /**
1795
+ * Create a new user
1796
+ */
1797
+ create(user: CreateUserRequest): Promise<APIResponse<LPUser>>;
1798
+ /**
1799
+ * Update a user
1800
+ * @param userId - The user ID
1801
+ * @param user - Updated user data
1802
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1803
+ */
1804
+ update(userId: string, user: UpdateUserRequest, revision?: string): Promise<APIResponse<LPUser>>;
1805
+ /**
1806
+ * Delete a user
1807
+ * @param userId - The user ID
1808
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1809
+ */
1810
+ delete(userId: string, revision?: string): Promise<APIResponse<void>>;
1811
+ /**
1812
+ * Get the current authenticated user
1813
+ */
1814
+ getSelf(): Promise<APIResponse<LPUser>>;
1815
+ }
1816
+ /**
1817
+ * Agent Groups API
1818
+ */
1819
+ declare class AgentGroupsAPI {
1820
+ private http;
1821
+ constructor(http: HTTPClient);
1822
+ /**
1823
+ * Get all agent groups
1824
+ */
1825
+ getAll(): Promise<APIResponse<LPAgentGroup[]>>;
1826
+ /**
1827
+ * Get an agent group by ID
1828
+ */
1829
+ getById(groupId: number): Promise<APIResponse<LPAgentGroup>>;
1830
+ /**
1831
+ * Create a new agent group
1832
+ */
1833
+ create(group: CreateAgentGroupRequest): Promise<APIResponse<LPAgentGroup>>;
1834
+ /**
1835
+ * Update an agent group
1836
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1837
+ */
1838
+ update(groupId: number, group: UpdateAgentGroupRequest, revision?: string): Promise<APIResponse<LPAgentGroup>>;
1839
+ /**
1840
+ * Delete an agent group
1841
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1842
+ */
1843
+ delete(groupId: number, revision?: string): Promise<APIResponse<void>>;
1844
+ }
1845
+ /**
1846
+ * Profiles API
1847
+ */
1848
+ declare class ProfilesAPI {
1849
+ private http;
1850
+ constructor(http: HTTPClient);
1851
+ /**
1852
+ * Get all profiles
1853
+ */
1854
+ getAll(): Promise<APIResponse<LPProfile[]>>;
1855
+ /**
1856
+ * Get a profile by ID
1857
+ */
1858
+ getById(profileId: number): Promise<APIResponse<LPProfile>>;
1859
+ /**
1860
+ * Create a new profile
1861
+ */
1862
+ create(profile: CreateProfileRequest): Promise<APIResponse<LPProfile>>;
1863
+ /**
1864
+ * Update a profile
1865
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1866
+ */
1867
+ update(profileId: number, profile: UpdateProfileRequest, revision?: string): Promise<APIResponse<LPProfile>>;
1868
+ /**
1869
+ * Delete a profile
1870
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1871
+ */
1872
+ delete(profileId: number, revision?: string): Promise<APIResponse<void>>;
1873
+ }
1874
+ /**
1875
+ * LOBs (Lines of Business) API
1876
+ */
1877
+ declare class LOBsAPI {
1878
+ private http;
1879
+ constructor(http: HTTPClient);
1880
+ /**
1881
+ * Get all LOBs
1882
+ */
1883
+ getAll(): Promise<APIResponse<LPLOB[]>>;
1884
+ /**
1885
+ * Get a LOB by ID
1886
+ */
1887
+ getById(lobId: number): Promise<APIResponse<LPLOB>>;
1888
+ /**
1889
+ * Create a new LOB
1890
+ */
1891
+ create(lob: CreateLOBRequest): Promise<APIResponse<LPLOB>>;
1892
+ /**
1893
+ * Update a LOB
1894
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1895
+ */
1896
+ update(lobId: number, lob: UpdateLOBRequest, revision?: string): Promise<APIResponse<LPLOB>>;
1897
+ /**
1898
+ * Delete a LOB
1899
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1900
+ */
1901
+ delete(lobId: number, revision?: string): Promise<APIResponse<void>>;
1902
+ }
1903
+ /**
1904
+ * Campaigns API
1905
+ */
1906
+ declare class CampaignsAPI {
1907
+ private http;
1908
+ constructor(http: HTTPClient);
1909
+ /**
1910
+ * Get all campaigns
1911
+ */
1912
+ getAll(): Promise<APIResponse<LPCampaign[]>>;
1913
+ /**
1914
+ * Get a campaign by ID
1915
+ */
1916
+ getById(campaignId: number): Promise<APIResponse<LPCampaign>>;
1917
+ /**
1918
+ * Create a new campaign
1919
+ */
1920
+ create(campaign: CreateCampaignRequest): Promise<APIResponse<LPCampaign>>;
1921
+ /**
1922
+ * Update a campaign
1923
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1924
+ */
1925
+ update(campaignId: number, campaign: UpdateCampaignRequest, revision?: string): Promise<APIResponse<LPCampaign>>;
1926
+ /**
1927
+ * Delete a campaign
1928
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1929
+ */
1930
+ delete(campaignId: number, revision?: string): Promise<APIResponse<void>>;
1931
+ }
1932
+ /**
1933
+ * Engagements API
1934
+ */
1935
+ declare class EngagementsAPI {
1936
+ private http;
1937
+ constructor(http: HTTPClient);
1938
+ /**
1939
+ * Get all engagements for a campaign
1940
+ */
1941
+ getByCampaign(campaignId: number): Promise<APIResponse<LPEngagement[]>>;
1942
+ /**
1943
+ * Get an engagement by ID
1944
+ */
1945
+ getById(campaignId: number, engagementId: number): Promise<APIResponse<LPEngagement>>;
1946
+ /**
1947
+ * Create a new engagement
1948
+ */
1949
+ create(engagement: CreateEngagementRequest): Promise<APIResponse<LPEngagement>>;
1950
+ /**
1951
+ * Update an engagement
1952
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1953
+ */
1954
+ update(campaignId: number, engagementId: number, engagement: UpdateEngagementRequest, revision?: string): Promise<APIResponse<LPEngagement>>;
1955
+ /**
1956
+ * Delete an engagement
1957
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1958
+ */
1959
+ delete(campaignId: number, engagementId: number, revision?: string): Promise<APIResponse<void>>;
1960
+ }
1961
+ /**
1962
+ * Predefined Content (Canned Responses) API
1963
+ */
1964
+ declare class PredefinedContentAPI {
1965
+ private http;
1966
+ constructor(http: HTTPClient);
1967
+ /**
1968
+ * Get all predefined content
1969
+ */
1970
+ getAll(): Promise<APIResponse<LPPredefinedContent[]>>;
1971
+ /**
1972
+ * Get predefined content by ID
1973
+ */
1974
+ getById(contentId: number): Promise<APIResponse<LPPredefinedContent>>;
1975
+ /**
1976
+ * Create new predefined content
1977
+ */
1978
+ create(content: CreatePredefinedContentRequest): Promise<APIResponse<LPPredefinedContent>>;
1979
+ /**
1980
+ * Update predefined content
1981
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1982
+ */
1983
+ update(contentId: number, content: UpdatePredefinedContentRequest, revision?: string): Promise<APIResponse<LPPredefinedContent>>;
1984
+ /**
1985
+ * Delete predefined content
1986
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
1987
+ */
1988
+ delete(contentId: number, revision?: string): Promise<APIResponse<void>>;
1989
+ }
1990
+ /**
1991
+ * Automatic Messages API
1992
+ */
1993
+ declare class AutomaticMessagesAPI {
1994
+ private http;
1995
+ constructor(http: HTTPClient);
1996
+ /**
1997
+ * Get all automatic messages
1998
+ */
1999
+ getAll(): Promise<APIResponse<LPAutomaticMessage[]>>;
2000
+ /**
2001
+ * Get an automatic message by ID
2002
+ */
2003
+ getById(messageId: number): Promise<APIResponse<LPAutomaticMessage>>;
2004
+ /**
2005
+ * Create a new automatic message
2006
+ */
2007
+ create(message: CreateAutomaticMessageRequest): Promise<APIResponse<LPAutomaticMessage>>;
2008
+ /**
2009
+ * Update an automatic message
2010
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
2011
+ */
2012
+ update(messageId: number, message: UpdateAutomaticMessageRequest, revision?: string): Promise<APIResponse<LPAutomaticMessage>>;
2013
+ /**
2014
+ * Delete an automatic message
2015
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
2016
+ */
2017
+ delete(messageId: number, revision?: string): Promise<APIResponse<void>>;
2018
+ }
2019
+ /**
2020
+ * Working Hours API
2021
+ */
2022
+ declare class WorkingHoursAPI {
2023
+ private http;
2024
+ constructor(http: HTTPClient);
2025
+ /**
2026
+ * Get all working hours schedules
2027
+ */
2028
+ getAll(): Promise<APIResponse<LPWorkingHours[]>>;
2029
+ /**
2030
+ * Get working hours by ID
2031
+ */
2032
+ getById(scheduleId: number): Promise<APIResponse<LPWorkingHours>>;
2033
+ /**
2034
+ * Create new working hours schedule
2035
+ */
2036
+ create(schedule: CreateWorkingHoursRequest): Promise<APIResponse<LPWorkingHours>>;
2037
+ /**
2038
+ * Update working hours schedule
2039
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
2040
+ */
2041
+ update(scheduleId: number, schedule: UpdateWorkingHoursRequest, revision?: string): Promise<APIResponse<LPWorkingHours>>;
2042
+ /**
2043
+ * Delete working hours schedule
2044
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
2045
+ */
2046
+ delete(scheduleId: number, revision?: string): Promise<APIResponse<void>>;
2047
+ }
2048
+ /**
2049
+ * Special Occasions API
2050
+ */
2051
+ declare class SpecialOccasionsAPI {
2052
+ private http;
2053
+ constructor(http: HTTPClient);
2054
+ /**
2055
+ * Get all special occasions
2056
+ */
2057
+ getAll(): Promise<APIResponse<LPSpecialOccasion[]>>;
2058
+ /**
2059
+ * Get a special occasion by ID
2060
+ */
2061
+ getById(occasionId: number): Promise<APIResponse<LPSpecialOccasion>>;
2062
+ /**
2063
+ * Create a new special occasion
2064
+ */
2065
+ create(occasion: CreateSpecialOccasionRequest): Promise<APIResponse<LPSpecialOccasion>>;
2066
+ /**
2067
+ * Update a special occasion
2068
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
2069
+ */
2070
+ update(occasionId: number, occasion: UpdateSpecialOccasionRequest, revision?: string): Promise<APIResponse<LPSpecialOccasion>>;
2071
+ /**
2072
+ * Delete a special occasion
2073
+ * @param revision - Optional revision for optimistic locking (auto-fetched if not provided)
2074
+ */
2075
+ delete(occasionId: number, revision?: string): Promise<APIResponse<void>>;
2076
+ }
2077
+
2078
+ /**
2079
+ * AI Studio API Module
2080
+ *
2081
+ * Provides access to LivePerson AI Studio APIs.
2082
+ * Uses CC-Bearer authentication mode.
2083
+ */
2084
+
2085
+ /**
2086
+ * AI Studio Categories API
2087
+ */
2088
+ declare class CategoriesAPI {
2089
+ private http;
2090
+ constructor(http: ScopedHTTPClient);
2091
+ getAll(): Promise<APIResponse<AIStudioCategory[]>>;
2092
+ create(data: CreateCategoryRequest): Promise<APIResponse<AIStudioCategory>>;
2093
+ update(categoryId: string, data: UpdateCategoryRequest): Promise<APIResponse<AIStudioCategory>>;
2094
+ delete(categoryId: string): Promise<APIResponse<void>>;
2095
+ }
2096
+ /**
2097
+ * AI Studio Conversations API
2098
+ */
2099
+ declare class ConversationsAPI {
2100
+ private http;
2101
+ constructor(http: ScopedHTTPClient);
2102
+ getAll(params?: ConversationQueryParams): Promise<APIResponse<AIStudioConversation[]>>;
2103
+ getById(convId: string): Promise<APIResponse<AIStudioConversation>>;
2104
+ create(data: CreateConversationRequest$1): Promise<APIResponse<AIStudioConversation>>;
2105
+ update(convId: string, data: UpdateConversationRequest): Promise<APIResponse<AIStudioConversation>>;
2106
+ delete(convId: string): Promise<APIResponse<void>>;
2107
+ updateAttributes(convId: string, data: UpdateConversationAttributesRequest): Promise<APIResponse<AIStudioConversation>>;
2108
+ close(convId: string): Promise<APIResponse<void>>;
2109
+ export(params?: ConversationQueryParams): Promise<APIResponse<AIStudioConversation[]>>;
2110
+ upload(conversations: AIStudioConversation[]): Promise<APIResponse<AIStudioConversation[]>>;
2111
+ }
2112
+ /**
2113
+ * AI Studio Summary API
2114
+ */
2115
+ declare class SummaryAPI {
2116
+ private http;
2117
+ constructor(http: ScopedHTTPClient);
2118
+ create(data: SummaryRequest): Promise<APIResponse<AIStudioSummary>>;
2119
+ createBatch(data: BatchSummaryRequest): Promise<APIResponse<AIStudioSummary>>;
2120
+ getBatch(offset?: number, limit?: number): Promise<APIResponse<AIStudioSummary[]>>;
2121
+ getBatchById(summaryId: string): Promise<APIResponse<AIStudioSummary>>;
2122
+ deleteBatch(summaryId: string): Promise<APIResponse<void>>;
2123
+ }
2124
+ /**
2125
+ * AI Studio Query API
2126
+ */
2127
+ declare class QueryAPI {
2128
+ private http;
2129
+ constructor(http: ScopedHTTPClient);
2130
+ generate(data: QueryGenerateRequest): Promise<APIResponse<QueryGenerateResponse>>;
2131
+ }
2132
+ /**
2133
+ * AI Studio Simulations API
2134
+ */
2135
+ declare class SimulationsAPI {
2136
+ private http;
2137
+ constructor(http: ScopedHTTPClient);
2138
+ getAll(params?: SimulationQueryParams): Promise<APIResponse<AIStudioSimulation[]>>;
2139
+ getById(simulationId: string): Promise<APIResponse<AIStudioSimulation>>;
2140
+ create(data: CreateSimulationRequest): Promise<APIResponse<AIStudioSimulation>>;
2141
+ update(simulationId: string, data: UpdateSimulationRequest): Promise<APIResponse<AIStudioSimulation>>;
2142
+ delete(simulationId: string): Promise<APIResponse<void>>;
2143
+ getStatus(simulationId: string): Promise<APIResponse<AIStudioSimulation>>;
2144
+ getJobResults(simulationId: string, jobId: string): Promise<APIResponse<SimulationJobResult>>;
2145
+ cancel(simulationId: string): Promise<APIResponse<void>>;
2146
+ }
2147
+ /**
2148
+ * AI Studio Transcript Analysis API
2149
+ */
2150
+ declare class TranscriptAnalysisAPI {
2151
+ private http;
2152
+ constructor(http: ScopedHTTPClient);
2153
+ getAll(owner?: string, limit?: number, startAfterId?: string): Promise<APIResponse<TranscriptAnalysis[]>>;
2154
+ getById(analysisId: string, excludeConversations?: boolean, excludeQuestions?: boolean): Promise<APIResponse<TranscriptAnalysis>>;
2155
+ create(data: CreateTranscriptAnalysisRequest): Promise<APIResponse<TranscriptAnalysis>>;
2156
+ update(analysisId: string, data: UpdateTranscriptAnalysisRequest): Promise<APIResponse<TranscriptAnalysis>>;
2157
+ delete(analysisId: string): Promise<APIResponse<void>>;
2158
+ }
2159
+ /**
2160
+ * AI Studio Knowledgebases API
2161
+ */
2162
+ declare class KnowledgebasesAPI {
2163
+ private http;
2164
+ constructor(http: ScopedHTTPClient);
2165
+ getAll(): Promise<APIResponse<Knowledgebase[]>>;
2166
+ getKai(): Promise<APIResponse<Knowledgebase[]>>;
2167
+ getById(kbId: string): Promise<APIResponse<Knowledgebase>>;
2168
+ delete(kbId: string): Promise<APIResponse<void>>;
2169
+ getHealth(kbId: string): Promise<APIResponse<KnowledgebaseHealth>>;
2170
+ refresh(kbId: string): Promise<APIResponse<Knowledgebase>>;
2171
+ search(kbId: string, data: KnowledgebaseSearchRequest): Promise<APIResponse<KnowledgebaseSearchResult[]>>;
2172
+ getItems(kbId: string): Promise<APIResponse<KnowledgebaseItem[]>>;
2173
+ getItemsBySource(kbId: string, sourceId: string): Promise<APIResponse<KnowledgebaseItem[]>>;
2174
+ createItems(kbId: string, sourceId: string, items: KnowledgebaseTextItem[]): Promise<APIResponse<KnowledgebaseItem[]>>;
2175
+ updateItems(kbId: string, sourceId: string, items: KnowledgebaseTextItem[]): Promise<APIResponse<KnowledgebaseItem[]>>;
2176
+ deleteItems(kbId: string, sourceId: string, itemIds: string[]): Promise<APIResponse<string[]>>;
2177
+ }
2178
+ /**
2179
+ * AI Studio Evaluators API
2180
+ */
2181
+ declare class EvaluatorsAPI {
2182
+ private http;
2183
+ constructor(http: ScopedHTTPClient);
2184
+ similarity(evaluationType: string, data: SimilarityEvaluationRequest): Promise<APIResponse<SimilarityEvaluationResponse>>;
2185
+ resolution(data: ResolutionEvaluationRequest): Promise<APIResponse<ResolutionEvaluationResponse>>;
2186
+ guidedRouting(data: GuidedRoutingEvaluationRequest): Promise<APIResponse<GuidedRoutingEvaluationResponse>>;
2187
+ }
2188
+ /**
2189
+ * AI Studio Generators API
2190
+ */
2191
+ declare class GeneratorsAPI {
2192
+ private http;
2193
+ constructor(http: ScopedHTTPClient);
2194
+ qaFromModel(modelId: string): Promise<APIResponse<QuestionGeneratorResponse>>;
2195
+ qaFromKnowledgebase(kbIds: string[], generateAnswers?: boolean, useRandomSections?: boolean): Promise<APIResponse<QuestionGeneratorResponse>>;
2196
+ qaFromConversationCloud(data: QuestionGeneratorRequest): Promise<APIResponse<QuestionGeneratorResponse>>;
2197
+ kaiRoutesLlm(data: KAIRouteGeneratorRequest): Promise<APIResponse<KAIRouteGeneratorResponse>>;
2198
+ kaiRoutes(data: KAIRouteGeneratorRequest): Promise<APIResponse<number>>;
2199
+ kaiRoutesStatus(flowId: string): Promise<APIResponse<KAIRouteGenerationStatus>>;
2200
+ }
2201
+ /**
2202
+ * AI Studio Prompt Library API
2203
+ */
2204
+ declare class PromptLibraryAPI {
2205
+ private http;
2206
+ constructor(http: ScopedHTTPClient);
2207
+ getAll(): Promise<APIResponse<Prompt[]>>;
2208
+ create(data: CreatePromptRequest): Promise<APIResponse<Prompt>>;
2209
+ update(promptId: string, data: UpdatePromptRequest): Promise<APIResponse<Prompt>>;
2210
+ getProviders(): Promise<APIResponse<LLMProvider[]>>;
2211
+ getSystemPrompts(): Promise<APIResponse<Prompt[]>>;
2212
+ }
2213
+ /**
2214
+ * AI Studio Users API
2215
+ */
2216
+ declare class AIStudioUsersAPI {
2217
+ private http;
2218
+ constructor(http: ScopedHTTPClient);
2219
+ getSelf(): Promise<APIResponse<AIStudioUser>>;
2220
+ getAll(): Promise<APIResponse<AIStudioUser[]>>;
2221
+ getDetails(): Promise<APIResponse<AIStudioUser[]>>;
2222
+ create(data: CreateAIStudioUserRequest): Promise<APIResponse<AIStudioUser>>;
2223
+ update(userId: string, data: UpdateAIStudioUserRequest): Promise<APIResponse<AIStudioUser>>;
2224
+ delete(userId: string): Promise<APIResponse<void>>;
2225
+ updateModels(userId: string, data: UpdateAIStudioUserModelsRequest): Promise<APIResponse<AIStudioUser>>;
2226
+ agreeToTerms(userId: string): Promise<APIResponse<AIStudioUser>>;
2227
+ }
2228
+ /**
2229
+ * AI Studio Flows API
2230
+ *
2231
+ * Uses /api/v2/flows endpoints.
2232
+ * Reference: ai-studio.service.ts in lp-demo
2233
+ */
2234
+ declare class FlowsAPI {
2235
+ private http;
2236
+ private accountId;
2237
+ constructor(http: ScopedHTTPClient, accountId: string);
2238
+ /**
2239
+ * List all flows for the account
2240
+ * GET /api/v2/flows?account_id={accountId}
2241
+ */
2242
+ getAll(): Promise<APIResponse<AIStudioFlow[]>>;
2243
+ /**
2244
+ * Get a specific flow by ID
2245
+ * GET /api/v2/flows/{flowId}
2246
+ */
2247
+ getById(flowId: string): Promise<APIResponse<AIStudioFlow>>;
2248
+ /**
2249
+ * Invoke a flow
2250
+ * POST /api/v2/flows/{flowId}
2251
+ */
2252
+ invoke(flowId: string, data: InvokeFlowRequest): Promise<APIResponse<InvokeFlowResponse>>;
2253
+ /**
2254
+ * Invoke a promptless flow (quick response)
2255
+ * POST /api/v2/flows/response
2256
+ */
2257
+ invokeWithResponse(prompt: string, messages?: Array<{
2258
+ text: string;
2259
+ speaker: string;
2260
+ }>, text?: string): Promise<APIResponse<InvokeFlowResponse>>;
2261
+ }
2262
+ /**
2263
+ * Main AI Studio API
2264
+ *
2265
+ * Provides access to all AI Studio sub-APIs.
2266
+ * Uses CC-Bearer authentication.
2267
+ */
2268
+ declare class AIStudioAPI {
2269
+ readonly categories: CategoriesAPI;
2270
+ readonly conversations: ConversationsAPI;
2271
+ readonly summary: SummaryAPI;
2272
+ readonly query: QueryAPI;
2273
+ readonly simulations: SimulationsAPI;
2274
+ readonly transcriptAnalysis: TranscriptAnalysisAPI;
2275
+ readonly knowledgebases: KnowledgebasesAPI;
2276
+ readonly evaluators: EvaluatorsAPI;
2277
+ readonly generators: GeneratorsAPI;
2278
+ readonly promptLibrary: PromptLibraryAPI;
2279
+ readonly users: AIStudioUsersAPI;
2280
+ readonly flows: FlowsAPI;
2281
+ constructor(http: HTTPClient, accountId: string);
2282
+ }
2283
+
2284
+ /**
2285
+ * Messaging API Module
2286
+ *
2287
+ * Provides access to LivePerson Messaging APIs.
2288
+ * Includes Messaging History, Agent Metrics, Agent Activity, and Operations.
2289
+ */
2290
+
2291
+ /**
2292
+ * Messaging History API
2293
+ *
2294
+ * Access conversation history and transcripts.
2295
+ */
2296
+ declare class MessagingHistoryAPI {
2297
+ private http;
2298
+ constructor(http: HTTPClient);
2299
+ /**
2300
+ * Query messaging conversations
2301
+ */
2302
+ query(params: MessagingHistoryQuery): Promise<APIResponse<MessagingHistoryResponse>>;
2303
+ /**
2304
+ * Get a single conversation by ID
2305
+ */
2306
+ getConversation(conversationId: string): Promise<APIResponse<MessagingConversation>>;
2307
+ /**
2308
+ * Get conversations by IDs (batch)
2309
+ */
2310
+ getConversations(conversationIds: string[]): Promise<APIResponse<MessagingConversation[]>>;
2311
+ /**
2312
+ * Export conversations matching criteria
2313
+ */
2314
+ export(params: MessagingHistoryQuery): Promise<APIResponse<MessagingHistoryResponse>>;
2315
+ }
2316
+ /**
2317
+ * Agent Metrics API
2318
+ *
2319
+ * Real-time agent metrics and status.
2320
+ */
2321
+ declare class AgentMetricsAPI {
2322
+ private http;
2323
+ constructor(http: HTTPClient);
2324
+ /**
2325
+ * Get current metrics for agents
2326
+ */
2327
+ getMetrics(params?: AgentMetricsQuery): Promise<APIResponse<AgentMetrics[]>>;
2328
+ /**
2329
+ * Get metrics for a specific agent
2330
+ */
2331
+ getAgentMetrics(agentId: string): Promise<APIResponse<AgentMetrics>>;
2332
+ /**
2333
+ * Get metrics summary by skill
2334
+ */
2335
+ getBySkill(skillId: number): Promise<APIResponse<AgentMetrics[]>>;
2336
+ /**
2337
+ * Get metrics summary by agent group
2338
+ */
2339
+ getByAgentGroup(groupId: number): Promise<APIResponse<AgentMetrics[]>>;
2340
+ }
2341
+ /**
2342
+ * Agent Activity API
2343
+ *
2344
+ * Historical agent activity and session data.
2345
+ */
2346
+ declare class AgentActivityAPI {
2347
+ private http;
2348
+ constructor(http: HTTPClient);
2349
+ /**
2350
+ * Query agent activity
2351
+ */
2352
+ query(params: AgentActivityQuery): Promise<APIResponse<AgentActivity[]>>;
2353
+ /**
2354
+ * Get activity for a specific agent
2355
+ */
2356
+ getAgentActivity(agentId: string, from: number, to: number): Promise<APIResponse<AgentActivity>>;
2357
+ }
2358
+ /**
2359
+ * Messaging Operations API
2360
+ *
2361
+ * Perform actions on conversations.
2362
+ */
2363
+ declare class MessagingOperationsAPI {
2364
+ private http;
2365
+ constructor(http: HTTPClient);
2366
+ /**
2367
+ * Transfer a conversation to another skill or agent
2368
+ */
2369
+ transfer(request: TransferConversationRequest): Promise<APIResponse<void>>;
2370
+ /**
2371
+ * Close a conversation
2372
+ */
2373
+ close(request: CloseConversationRequest): Promise<APIResponse<void>>;
2374
+ /**
2375
+ * Send a message to a conversation
2376
+ */
2377
+ sendMessage(request: SendMessageRequest): Promise<APIResponse<void>>;
2378
+ /**
2379
+ * Set conversation priority
2380
+ */
2381
+ setPriority(conversationId: string, priority: number): Promise<APIResponse<void>>;
2382
+ /**
2383
+ * Set conversation TTR (Time To Respond)
2384
+ */
2385
+ setTTR(conversationId: string, ttrType: 'URGENT' | 'NORMAL' | 'PRIORITIZED', value?: number): Promise<APIResponse<void>>;
2386
+ }
2387
+ /**
2388
+ * Connect to Messaging API
2389
+ *
2390
+ * Create new messaging conversations programmatically.
2391
+ */
2392
+ declare class ConnectToMessagingAPI {
2393
+ private http;
2394
+ constructor(http: HTTPClient);
2395
+ /**
2396
+ * Create a new conversation
2397
+ */
2398
+ createConversation(request: CreateConversationRequest): Promise<APIResponse<CreateConversationResponse>>;
2399
+ /**
2400
+ * Get available campaigns and engagements for creating conversations
2401
+ */
2402
+ getAvailableEngagements(): Promise<APIResponse<{
2403
+ campaigns: Array<{
2404
+ id: number;
2405
+ name: string;
2406
+ engagements: Array<{
2407
+ id: number;
2408
+ name: string;
2409
+ }>;
2410
+ }>;
2411
+ }>>;
2412
+ }
2413
+ /**
2414
+ * Outbound Reporting API
2415
+ *
2416
+ * Reports on outbound messaging campaigns.
2417
+ */
2418
+ declare class OutboundReportingAPI {
2419
+ private http;
2420
+ constructor(http: HTTPClient);
2421
+ /**
2422
+ * Query outbound campaign reports
2423
+ */
2424
+ query(params: OutboundReportQuery): Promise<APIResponse<OutboundCampaignReport[]>>;
2425
+ /**
2426
+ * Get report for a specific campaign
2427
+ */
2428
+ getCampaignReport(campaignId: string, from: number, to: number): Promise<APIResponse<OutboundCampaignReport>>;
2429
+ /**
2430
+ * Get aggregate outbound stats
2431
+ */
2432
+ getAggregateStats(from: number, to: number): Promise<APIResponse<OutboundCampaignReport>>;
2433
+ }
2434
+ /**
2435
+ * Main Messaging API
2436
+ *
2437
+ * Provides access to all Messaging sub-APIs.
2438
+ */
2439
+ declare class MessagingAPI {
2440
+ readonly history: MessagingHistoryAPI;
2441
+ readonly agentMetrics: AgentMetricsAPI;
2442
+ readonly agentActivity: AgentActivityAPI;
2443
+ readonly operations: MessagingOperationsAPI;
2444
+ readonly connect: ConnectToMessagingAPI;
2445
+ readonly outbound: OutboundReportingAPI;
2446
+ constructor(http: HTTPClient);
2447
+ }
2448
+
2449
+ /**
2450
+ * Sentinel API Module
2451
+ *
2452
+ * Provides access to LivePerson's Sentinel (IDP) authentication APIs.
2453
+ * Handles OAuth token exchange, login URL generation, and session management.
2454
+ */
2455
+
2456
+ /**
2457
+ * Sentinel Authentication API
2458
+ *
2459
+ * Handles LivePerson OAuth authentication flow via the Sentinel service.
2460
+ *
2461
+ * @example
2462
+ * ```typescript
2463
+ * // Get login URL for OAuth redirect
2464
+ * const { url } = await sdk.sentinel.getLoginUrl();
2465
+ * window.location.href = url;
2466
+ *
2467
+ * // After redirect, exchange code for token
2468
+ * const token = await sdk.sentinel.exchangeToken({
2469
+ * code: authCode,
2470
+ * redirect: window.location.origin + '/callback',
2471
+ * appname: 'my-app',
2472
+ * });
2473
+ * ```
2474
+ */
2475
+ declare class SentinelAPI {
2476
+ private http;
2477
+ constructor(http: HTTPClient);
2478
+ /**
2479
+ * Get login URL for OAuth redirect
2480
+ *
2481
+ * Returns a URL to redirect the user to for LivePerson authentication.
2482
+ * After successful auth, user is redirected back with an authorization code.
2483
+ *
2484
+ * @returns Login URL for OAuth redirect
2485
+ *
2486
+ * @example
2487
+ * ```typescript
2488
+ * const { url } = await sdk.sentinel.getLoginUrl();
2489
+ * // Redirect user to LP login
2490
+ * window.location.href = url;
2491
+ * ```
2492
+ */
2493
+ getLoginUrl(): Promise<SentinelLoginUrlResponse>;
2494
+ /**
2495
+ * Exchange OAuth authorization code for access token
2496
+ *
2497
+ * After the user completes LP authentication and is redirected back,
2498
+ * use this method to exchange the authorization code for tokens.
2499
+ *
2500
+ * @param request - Token exchange request with code and redirect URI
2501
+ * @returns Token object with access token, refresh token, and user info
2502
+ *
2503
+ * @example
2504
+ * ```typescript
2505
+ * // Get code from URL params after redirect
2506
+ * const urlParams = new URLSearchParams(window.location.search);
2507
+ * const code = urlParams.get('code');
2508
+ *
2509
+ * const token = await sdk.sentinel.exchangeToken({
2510
+ * code,
2511
+ * redirect: window.location.origin + '/callback',
2512
+ * appname: 'my-app',
2513
+ * });
2514
+ *
2515
+ * // Store token for API calls
2516
+ * localStorage.setItem('lpToken', token.accessToken);
2517
+ * ```
2518
+ */
2519
+ exchangeToken(request: SentinelAuthRequest): Promise<SentinelToken>;
2520
+ /**
2521
+ * Logout and revoke token
2522
+ *
2523
+ * Revokes the current access token, ending the user's session.
2524
+ *
2525
+ * @example
2526
+ * ```typescript
2527
+ * await sdk.sentinel.logout();
2528
+ * // Clear local storage and redirect to login
2529
+ * localStorage.removeItem('lpToken');
2530
+ * window.location.href = '/login';
2531
+ * ```
2532
+ */
2533
+ logout(): Promise<void>;
2534
+ /**
2535
+ * Get LivePerson domains for the account
2536
+ *
2537
+ * Returns the domain URLs for various LP services.
2538
+ * Useful for making direct API calls to specific LP services.
2539
+ *
2540
+ * @returns Map of service names to domain URLs
2541
+ *
2542
+ * @example
2543
+ * ```typescript
2544
+ * const domains = await sdk.sentinel.getDomains();
2545
+ * console.log('Sentinel domain:', domains.sentinel);
2546
+ * console.log('Account Config domain:', domains.accountConfigReadOnly);
2547
+ * ```
2548
+ */
2549
+ getDomains(): Promise<SentinelDomainsResponse>;
2550
+ /**
2551
+ * Authenticate with Conversation Builder
2552
+ *
2553
+ * Exchanges the LP access token for a CB-specific token.
2554
+ * Required for making Conversation Builder API calls.
2555
+ *
2556
+ * @returns CB authentication info with token and organization ID
2557
+ *
2558
+ * @example
2559
+ * ```typescript
2560
+ * const cbAuth = await sdk.sentinel.authenticateCB();
2561
+ * if (cbAuth.success) {
2562
+ * const cbToken = cbAuth.successResult.apiAccessToken;
2563
+ * const cbOrg = cbAuth.successResult.sessionOrganizationId;
2564
+ * // Use cbToken for CB API calls
2565
+ * }
2566
+ * ```
2567
+ */
2568
+ authenticateCB(): Promise<CBAuthInfo>;
2569
+ }
2570
+
2571
+ /**
2572
+ * LP Prompts API Module
2573
+ *
2574
+ * Provides access to LivePerson Prompt Library API.
2575
+ * Domain: promptlibrary
2576
+ * Note: This is different from AI Studio Prompt Library API.
2577
+ */
2578
+
2579
+ /**
2580
+ * LP Prompts API
2581
+ *
2582
+ * Manage LivePerson Prompt Library prompts.
2583
+ * Uses Bearer authentication and the promptlibrary domain.
2584
+ */
2585
+ declare class LPPromptsAPI {
2586
+ private readonly scopedHttp;
2587
+ constructor(http: HTTPClient);
2588
+ /**
2589
+ * Get all system prompts (read-only, provided by LivePerson)
2590
+ */
2591
+ getSystemPrompts(params?: LPPromptsQueryParams): Promise<APIResponse<LPPrompt[]>>;
2592
+ /**
2593
+ * Get all account prompts
2594
+ */
2595
+ getAccountPrompts(params?: LPPromptsQueryParams): Promise<APIResponse<LPPrompt[]>>;
2596
+ /**
2597
+ * Get a single account prompt by ID
2598
+ */
2599
+ getById(promptId: string): Promise<APIResponse<LPPrompt>>;
2600
+ /**
2601
+ * Create a new account prompt
2602
+ */
2603
+ create(prompt: CreateLPPromptRequest): Promise<APIResponse<LPPrompt>>;
2604
+ /**
2605
+ * Update an account prompt
2606
+ * @param promptId - The prompt ID
2607
+ * @param prompt - Updated prompt data
2608
+ */
2609
+ update(promptId: string, prompt: UpdateLPPromptRequest): Promise<APIResponse<LPPrompt>>;
2610
+ /**
2611
+ * Delete an account prompt
2612
+ * @param promptId - The prompt ID
2613
+ */
2614
+ delete(promptId: string): Promise<APIResponse<void>>;
2615
+ /**
2616
+ * Get LLM provider subscriptions for the account
2617
+ */
2618
+ getLLMProviders(): Promise<APIResponse<LPLLMProviderSubscription[]>>;
2619
+ }
2620
+
2621
+ /**
2622
+ * LP Extend Client SDK
2623
+ *
2624
+ * Main SDK class providing typed access to LivePerson APIs.
2625
+ * The SDK calls LP APIs directly after verifying scopes with the shell.
2626
+ *
2627
+ * @example
2628
+ * ```typescript
2629
+ * import { initializeSDK } from '@lpextend/client-sdk';
2630
+ *
2631
+ * // Initialize the SDK
2632
+ * const sdk = await initializeSDK({
2633
+ * appId: 'my-app',
2634
+ * accountId: '12345678',
2635
+ * accessToken: 'user-lp-token',
2636
+ * scopes: ['skills', 'users', 'aiStudio'],
2637
+ * });
2638
+ *
2639
+ * // Check granted scopes
2640
+ * console.log('Granted scopes:', sdk.grantedScopes);
2641
+ *
2642
+ * // Use the typed APIs - calls LP APIs directly
2643
+ * const { data: skills, revision } = await sdk.skills.getAll();
2644
+ *
2645
+ * // Update with revision for optimistic locking
2646
+ * await sdk.skills.update(skills[0].id, { name: 'New Name' }, revision);
2647
+ *
2648
+ * // AI Studio (uses CC-Bearer auth automatically)
2649
+ * const { data: flows } = await sdk.aiStudio.flows.getAll();
2650
+ * ```
2651
+ */
2652
+
2653
+ /**
2654
+ * LP Extend Client SDK
2655
+ *
2656
+ * Main SDK instance providing access to all LivePerson APIs.
2657
+ * Calls LP APIs directly after verifying scopes with the shell.
2658
+ *
2659
+ * Account Configuration APIs (Bearer auth):
2660
+ * - skills: Manage routing skills
2661
+ * - users: Manage users and agents
2662
+ * - agentGroups: Manage agent groups
2663
+ * - profiles: Manage permission profiles
2664
+ * - lobs: Manage lines of business
2665
+ * - campaigns: Manage campaigns
2666
+ * - engagements: Manage campaign engagements
2667
+ * - predefinedContent: Manage canned responses
2668
+ * - automaticMessages: Manage automatic messages
2669
+ * - workingHours: Manage working hours schedules
2670
+ * - specialOccasions: Manage special occasions
2671
+ *
2672
+ * AI Studio APIs (CC-Bearer auth):
2673
+ * - aiStudio.categories: Manage categories
2674
+ * - aiStudio.conversations: Manage conversations
2675
+ * - aiStudio.summary: Generate summaries
2676
+ * - aiStudio.simulations: Run simulations
2677
+ * - aiStudio.knowledgebases: Manage knowledge bases
2678
+ * - aiStudio.flows: Invoke AI flows
2679
+ * - aiStudio.promptLibrary: Manage prompts
2680
+ * - And more...
2681
+ *
2682
+ * Messaging APIs:
2683
+ * - messaging.history: Query conversation history
2684
+ * - messaging.agentMetrics: Get agent metrics
2685
+ * - messaging.operations: Transfer, close, send messages
2686
+ * - messaging.connect: Create new conversations
2687
+ */
2688
+ declare class LPExtendSDK {
2689
+ private readonly config;
2690
+ /** Skills API - Manage routing skills */
2691
+ readonly skills: SkillsAPI;
2692
+ /** Users API - Manage users and agents */
2693
+ readonly users: UsersAPI;
2694
+ /** Agent Groups API - Manage agent groups */
2695
+ readonly agentGroups: AgentGroupsAPI;
2696
+ /** Profiles API - Manage permission profiles */
2697
+ readonly profiles: ProfilesAPI;
2698
+ /** LOBs API - Manage lines of business */
2699
+ readonly lobs: LOBsAPI;
2700
+ /** Campaigns API - Manage campaigns */
2701
+ readonly campaigns: CampaignsAPI;
2702
+ /** Engagements API - Manage campaign engagements */
2703
+ readonly engagements: EngagementsAPI;
2704
+ /** Predefined Content API - Manage canned responses */
2705
+ readonly predefinedContent: PredefinedContentAPI;
2706
+ /** Automatic Messages API - Manage automatic messages */
2707
+ readonly automaticMessages: AutomaticMessagesAPI;
2708
+ /** Working Hours API - Manage working hours schedules */
2709
+ readonly workingHours: WorkingHoursAPI;
2710
+ /** Special Occasions API - Manage special occasions */
2711
+ readonly specialOccasions: SpecialOccasionsAPI;
2712
+ /** AI Studio API - Access AI Studio features */
2713
+ readonly aiStudio: AIStudioAPI;
2714
+ /** Messaging API - History, metrics, operations */
2715
+ readonly messaging: MessagingAPI;
2716
+ /** Sentinel API - Authentication, login, token management */
2717
+ readonly sentinel: SentinelAPI;
2718
+ /** LP Prompts API - Manage prompts from LivePerson Prompt Library */
2719
+ readonly prompts: LPPromptsAPI;
2720
+ /** Scopes granted by app registration */
2721
+ readonly grantedScopes: string[];
2722
+ /** App name from registration */
2723
+ readonly appName: string;
2724
+ private readonly http;
2725
+ private readonly debug;
2726
+ /**
2727
+ * Create SDK instance (use initializeSDK() instead for async init)
2728
+ */
2729
+ constructor(config: LPExtendSDKConfig, initResult: SDKInitResult);
2730
+ /**
2731
+ * Get the current account ID
2732
+ */
2733
+ get accountId(): string;
2734
+ /**
2735
+ * Get the app ID
2736
+ */
2737
+ get appId(): string;
2738
+ /**
2739
+ * Check if a scope was granted
2740
+ */
2741
+ hasScope(scope: string): boolean;
2742
+ /**
2743
+ * Check if multiple scopes were granted
2744
+ */
2745
+ hasScopes(scopes: string[]): boolean;
2746
+ /**
2747
+ * Check if any of the specified scopes were granted
2748
+ */
2749
+ hasAnyScope(scopes: string[]): boolean;
2750
+ /**
2751
+ * Debug logging
2752
+ */
2753
+ private log;
2754
+ }
2755
+ /**
2756
+ * Initialize the SDK with async init call
2757
+ *
2758
+ * This calls the shell backend to verify app registration and get granted scopes,
2759
+ * then creates an SDK that calls LP APIs directly.
2760
+ *
2761
+ * Supports three authentication modes (in order of preference):
2762
+ * 1. ExtendJWT token (NEW): Provide `extendToken` - SDK verifies with shell and gets LP token
2763
+ * 2. Direct access token: Provide `accessToken` directly
2764
+ * 3. Shell token (LEGACY): Provide `shellToken` to fetch the LP token from the shell
2765
+ */
2766
+ declare function createSDK(config: LPExtendSDKConfig): Promise<LPExtendSDK>;
2767
+
2768
+ /**
2769
+ * LP Extend Node SDK
2770
+ *
2771
+ * A TypeScript SDK for building Node.js/backend applications on the LivePerson Extend platform.
2772
+ * Provides typed access to LivePerson APIs through the shell backend proxy.
2773
+ * The shell handles authentication and scope enforcement.
2774
+ *
2775
+ * For browser/frontend authentication, use @lpextend/client-sdk instead.
2776
+ *
2777
+ * @packageDocumentation
2778
+ *
2779
+ * @example Basic Usage
2780
+ * ```typescript
2781
+ * import { initializeSDK, Scopes } from '@lpextend/node-sdk';
2782
+ *
2783
+ * // Initialize the SDK (async - verifies app registration)
2784
+ * const sdk = await initializeSDK({
2785
+ * appId: 'my-app',
2786
+ * accountId: '12345678',
2787
+ * accessToken: 'user-lp-bearer-token',
2788
+ * scopes: [Scopes.SKILLS, Scopes.USERS, Scopes.AI_STUDIO],
2789
+ * });
2790
+ *
2791
+ * // Check granted scopes
2792
+ * if (sdk.hasScope(Scopes.SKILLS)) {
2793
+ * const { data: skills, revision } = await sdk.skills.getAll();
2794
+ * console.log('Skills:', skills);
2795
+ *
2796
+ * // Update with revision for optimistic locking
2797
+ * await sdk.skills.update(skills[0].id, { name: 'Updated' }, revision);
2798
+ * }
2799
+ *
2800
+ * // AI Studio APIs (automatically uses CC-Bearer auth)
2801
+ * if (sdk.hasScope(Scopes.AI_STUDIO)) {
2802
+ * const { data: flows } = await sdk.aiStudio.flows.getAll();
2803
+ * const result = await sdk.aiStudio.flows.invoke(flows[0].id, { input: { query: 'Hello' } });
2804
+ * }
2805
+ *
2806
+ * // Messaging History
2807
+ * if (sdk.hasScope(Scopes.MESSAGING_HISTORY)) {
2808
+ * const { data: history } = await sdk.messaging.history.query({
2809
+ * start: { from: Date.now() - 86400000, to: Date.now() },
2810
+ * status: ['CLOSE'],
2811
+ * });
2812
+ * }
2813
+ * ```
2814
+ *
2815
+ * @example Error Handling
2816
+ * ```typescript
2817
+ * import { initializeSDK, ErrorCodes, LPExtendSDKError } from '@lpextend/client-sdk';
2818
+ *
2819
+ * try {
2820
+ * const sdk = await initializeSDK(config);
2821
+ * const { data, revision } = await sdk.skills.getAll();
2822
+ *
2823
+ * // Try to update
2824
+ * await sdk.skills.update(data[0].id, { name: 'New' }, revision);
2825
+ * } catch (error) {
2826
+ * if (error instanceof LPExtendSDKError) {
2827
+ * switch (error.code) {
2828
+ * case ErrorCodes.SCOPE_DENIED:
2829
+ * console.error('App does not have access. Update app registration.');
2830
+ * break;
2831
+ * case ErrorCodes.APP_NOT_REGISTERED:
2832
+ * console.error('App is not installed for this account.');
2833
+ * break;
2834
+ * case ErrorCodes.REVISION_CONFLICT:
2835
+ * console.error('Resource was modified. Refresh and try again.');
2836
+ * break;
2837
+ * default:
2838
+ * console.error('API Error:', error.message);
2839
+ * }
2840
+ * }
2841
+ * }
2842
+ * ```
2843
+ */
2844
+
2845
+ /**
2846
+ * Initialize the LP Extend SDK
2847
+ *
2848
+ * Creates and returns an SDK instance after verifying app registration with the shell.
2849
+ * This is an async function that validates the app is registered and gets granted scopes.
2850
+ *
2851
+ * @param config - SDK configuration options
2852
+ * @returns Promise resolving to initialized SDK instance
2853
+ *
2854
+ * @example
2855
+ * ```typescript
2856
+ * import { initializeSDK, Scopes } from '@lpextend/node-sdk';
2857
+ *
2858
+ * const sdk = await initializeSDK({
2859
+ * appId: 'my-analytics-app',
2860
+ * accountId: '12345678',
2861
+ * accessToken: lpAccessToken, // From shell auth
2862
+ * scopes: [Scopes.SKILLS, Scopes.USERS, Scopes.AI_STUDIO],
2863
+ * debug: true,
2864
+ * });
2865
+ *
2866
+ * // Check what scopes were granted
2867
+ * console.log('Granted:', sdk.grantedScopes);
2868
+ *
2869
+ * // Access Account Config APIs (Bearer auth)
2870
+ * if (sdk.hasScope(Scopes.SKILLS)) {
2871
+ * const { data: skills, revision } = await sdk.skills.getAll();
2872
+ * // Update with revision
2873
+ * await sdk.skills.update(skills[0].id, { name: 'New Name' }, revision);
2874
+ * }
2875
+ *
2876
+ * // Access AI Studio APIs (CC-Bearer auth - handled automatically)
2877
+ * if (sdk.hasScope(Scopes.AI_STUDIO)) {
2878
+ * const { data: flows } = await sdk.aiStudio.flows.getAll();
2879
+ * const result = await sdk.aiStudio.flows.invoke(flows[0].id, {
2880
+ * input: { query: 'What is your return policy?' },
2881
+ * });
2882
+ * }
2883
+ *
2884
+ * // Access Messaging APIs
2885
+ * if (sdk.hasScope(Scopes.MESSAGING_HISTORY)) {
2886
+ * const { data: history } = await sdk.messaging.history.query({
2887
+ * start: { from: Date.now() - 86400000, to: Date.now() },
2888
+ * status: ['CLOSE'],
2889
+ * contentToRetrieve: ['messageRecords', 'summary'],
2890
+ * });
2891
+ * }
2892
+ * ```
2893
+ */
2894
+ declare function initializeSDK(config: LPExtendSDKConfig): Promise<LPExtendSDK>;
2895
+ /**
2896
+ * SDK Version
2897
+ */
2898
+ declare const VERSION = "1.0.0";
2899
+ /**
2900
+ * Available API Scopes
2901
+ *
2902
+ * These map to lpApiAccess fields in app registration.
2903
+ * Request these scopes when initializing the SDK.
2904
+ *
2905
+ * @example
2906
+ * ```typescript
2907
+ * import { initializeSDK, Scopes } from '@lpextend/node-sdk';
2908
+ *
2909
+ * const sdk = await initializeSDK({
2910
+ * appId: 'my-app',
2911
+ * accountId: '12345678',
2912
+ * accessToken: token,
2913
+ * scopes: [
2914
+ * Scopes.SKILLS,
2915
+ * Scopes.USERS,
2916
+ * Scopes.AGENT_GROUPS,
2917
+ * Scopes.AI_STUDIO,
2918
+ * Scopes.MESSAGING_HISTORY,
2919
+ * ],
2920
+ * });
2921
+ * ```
2922
+ */
2923
+ declare const Scopes: {
2924
+ readonly SKILLS: "skills";
2925
+ readonly USERS: "users";
2926
+ readonly AGENT_GROUPS: "agentGroups";
2927
+ readonly PROFILES: "profiles";
2928
+ readonly LOBS: "lobs";
2929
+ readonly PREDEFINED_CONTENT: "predefinedContent";
2930
+ readonly AUTOMATIC_MESSAGES: "automaticMessages";
2931
+ readonly WORKING_HOURS: "workingHours";
2932
+ readonly SPECIAL_OCCASIONS: "specialOccasions";
2933
+ readonly CAMPAIGNS: "campaigns";
2934
+ readonly ENGAGEMENTS: "engagements";
2935
+ readonly MESSAGING_HISTORY: "messagingHistory";
2936
+ readonly MESSAGING_OPERATIONS: "messagingOperations";
2937
+ readonly CONNECT_TO_MESSAGING: "connectToMessaging";
2938
+ readonly AGENT_METRICS: "agentMetrics";
2939
+ readonly AGENT_ACTIVITY: "agentActivity";
2940
+ readonly OUTBOUND_REPORTING: "outboundReporting";
2941
+ readonly AI_STUDIO: "aiStudio";
2942
+ readonly CONVERSATION_BUILDER: "conversationBuilder";
2943
+ readonly CONVERSATION_ORCHESTRATOR: "conversationOrchestrator";
2944
+ /** AI Studio Prompt Library (different from LP Prompts) */
2945
+ readonly PROMPT_LIBRARY: "promptLibrary";
2946
+ /** LP Prompts API (Prompt Library) */
2947
+ readonly LP_PROMPTS: "prompts";
2948
+ readonly FAAS: "faas";
2949
+ readonly PROACTIVE_MESSAGING: "proactiveMessaging";
2950
+ };
2951
+ type Scope = (typeof Scopes)[keyof typeof Scopes];
2952
+
2953
+ /**
2954
+ * Retrieve LP Bearer token from the shell
2955
+ *
2956
+ * Child apps call this function to get the LP access token for making
2957
+ * direct LP API calls. The shell stores tokens on user login and provides
2958
+ * them to authenticated child apps.
2959
+ *
2960
+ * @param config - Shell token configuration
2961
+ * @returns Promise resolving to LP token data
2962
+ * @throws LPExtendSDKError if retrieval fails
2963
+ *
2964
+ * @example
2965
+ * ```typescript
2966
+ * import { getShellToken } from '@lpextend/client-sdk';
2967
+ *
2968
+ * // Get shell token from URL params or postMessage
2969
+ * const shellToken = new URLSearchParams(window.location.search).get('shellToken');
2970
+ *
2971
+ * const lpToken = await getShellToken({
2972
+ * shellBaseUrl: 'https://lp-extend.example.com',
2973
+ * accountId: '12345678',
2974
+ * shellToken: shellToken,
2975
+ * appId: 'my-app',
2976
+ * });
2977
+ *
2978
+ * // Now use the LP token to initialize the SDK
2979
+ * const sdk = await initializeSDK({
2980
+ * appId: 'my-app',
2981
+ * accountId: lpToken.accountId,
2982
+ * accessToken: lpToken.accessToken,
2983
+ * scopes: [Scopes.SKILLS, Scopes.USERS],
2984
+ * });
2985
+ * ```
2986
+ */
2987
+ declare function getShellToken(config: ShellTokenConfig): Promise<ShellTokenResponse>;
2988
+
2989
+ export { type CreateConversationRequest$1 as AICreateConversationRequest, AIStudioAPI, type AIStudioCategory, type AIStudioConversation, type AIStudioFlow, type AIStudioMessage, type AIStudioSimulation, type AIStudioSummary, type AIStudioUser, AIStudioUsersAPI, type UpdateConversationRequest as AIUpdateConversationRequest, type APIResponse, type ActivityRecord, type AgentActivity, AgentActivityAPI, type AgentActivityQuery, AgentGroupsAPI, type AgentMetrics, AgentMetricsAPI, type AgentMetricsQuery, type AgentParticipant, type AgentStatus, AutomaticMessagesAPI, type BatchSummaryRequest, type CBAuthInfo, type CBChatBotPlatformUser, type CBSuccessResult, CampaignsAPI, CategoriesAPI, type CloseConversationRequest, type CoBrowseSession, ConnectToMessagingAPI, type ConsumerParticipant, type ConsumerProfile, type ContentToRetrieve, type ConversationContext, type ConversationInteraction, type ConversationParticipant, type ConversationQueryParams, type ConversationSummary, type ConversationTransfer, ConversationsAPI, type CreateAIStudioUserRequest, type CreateAgentGroupRequest, type CreateAutomaticMessageRequest, type CreateCampaignRequest, type CreateCategoryRequest, type CreateConversationResponse, type CreateEngagementRequest, type CreateLOBRequest, type CreateLPPromptRequest, type CreatePredefinedContentRequest, type CreateProfileRequest, type CreatePromptRequest, type CreateSimulationRequest, type CreateSkillRequest, type CreateSpecialOccasionRequest, type CreateTranscriptAnalysisRequest, type CreateUserRequest, type CreateWorkingHoursRequest, EngagementsAPI, type ErrorCode, ErrorCodes, EvaluatorsAPI, type FileMessage, FlowsAPI, type GeneratedQuestion, type GeneratedRoute, GeneratorsAPI, type GuidedRoute, type GuidedRoutingEvaluationRequest, type GuidedRoutingEvaluationResponse, type InvokeFlowRequest, type InvokeFlowResponse, type KAIRouteGenerationStatus, type KAIRouteGeneratorRequest, type KAIRouteGeneratorResponse, type Knowledgebase, type KnowledgebaseHealth, type KnowledgebaseItem, type KnowledgebaseSearchRequest, type KnowledgebaseSearchResult, type KnowledgebaseTextItem, KnowledgebasesAPI, type LLMModel, type LLMProvider, LOBsAPI, type LPAgentGroup, type LPAutomaticMessage, type LPAutomaticMessageData, type LPCampaign, type LPEngagement, LPExtendSDK, type LPExtendSDKConfig, LPExtendSDKError, type LPLLMProviderModels, type LPLLMProviderSubscription, type LPLLMType, type LPLOB, type LPPermission, type LPPredefinedContent, type LPPredefinedContentData, type LPProfile, type LPPrompt, type LPPromptClientConfig, type LPPromptClientType, type LPPromptConfiguration, type LPPromptGenericConfig, type LPPromptStatus, type LPPromptVariable, type LPPromptVariableSourceType, type LPPromptVersionDetail, LPPromptsAPI, type LPPromptsQueryParams, type LPShift, type LPSkill, type LPSkillRoutingConfig, type LPSpecialOccasion, type LPSpecialOccasionEvent, type LPUser, type LPWorkingDay, type LPWorkingHours, type MemberOf, type MessageData, type MessageRecord, MessagingAPI, type MessagingConversation, type CreateConversationRequest as MessagingCreateConversationRequest, MessagingHistoryAPI, type MessagingHistoryQuery, type MessagingHistoryResponse, type MessagingInteraction, MessagingOperationsAPI, type OutboundCampaignReport, type OutboundReportQuery, OutboundReportingAPI, type PaginatedResponse, PredefinedContentAPI, ProfilesAPI, type Prompt, PromptLibraryAPI, type PromptVariable, QueryAPI, type QueryGenerateRequest, type QueryGenerateResponse, type QuestionGeneratorRequest, type QuestionGeneratorResponse, type ResolutionEvaluationRequest, type ResolutionEvaluationResponse, type RichContentMessage, type SDEEvent, type SDERecord, type SDKInitResult, type Scope, Scopes, type SendMessageRequest, SentinelAPI, type SentinelAppSetting, type SentinelAppSettings, type SentinelAppUser, type SentinelAuthRequest, type SentinelCCUser, type SentinelDomainsResponse, type SentinelLoginUrlResponse, type SentinelLpToken, type SentinelLpUser, type SentinelManagerOf, type SentinelMemberOf, type SentinelProfile, type SentinelToken, type SentinelTokenExchange, type SentinelUserData, type SentinelUserSkill, type ShellTokenConfig, type ShellTokenResponse, type ShellTokenUser, type SimilarityEvaluationRequest, type SimilarityEvaluationResponse, type SimulationConfig, type SimulationJobResult, type SimulationQueryParams, type SimulationResults, type SimulationTestCase, SimulationsAPI, SkillsAPI, SpecialOccasionsAPI, SummaryAPI, type SummaryRequest, type SurveyRecord, type TextMessage, type TranscriptAnalysis, TranscriptAnalysisAPI, type TranscriptConversation, type TranscriptQuestion, type TransferConversationRequest, type UpdateAIStudioUserModelsRequest, type UpdateAIStudioUserRequest, type UpdateAgentGroupRequest, type UpdateAutomaticMessageRequest, type UpdateCampaignRequest, type UpdateCategoryRequest, type UpdateConversationAttributesRequest, type UpdateEngagementRequest, type UpdateLOBRequest, type UpdateLPPromptRequest, type UpdatePredefinedContentRequest, type UpdateProfileRequest, type UpdatePromptRequest, type UpdateSimulationRequest, type UpdateSkillRequest, type UpdateSpecialOccasionRequest, type UpdateTranscriptAnalysisRequest, type UpdateUserRequest, type UpdateWorkingHoursRequest, UsersAPI, VERSION, WorkingHoursAPI, createSDK, getShellToken, initializeSDK };