@deepdesk/deepdesk-sdk 16.0.2-beta.2 → 16.0.2-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -344,13 +344,14 @@ type Profile = CamelCaseKeys<Server.Profile>;
344
344
 
345
345
  type CreateConversation = {
346
346
  platform: string;
347
- sessionId: string;
347
+ externalId: string;
348
348
  profileCode?: string;
349
349
  agentId: string;
350
350
  agentName?: string;
351
351
  agentNickname?: string;
352
352
  agentEmail?: string;
353
- tags?: Record<string, string> | null;
353
+ metadata?: Server.Metadata;
354
+ chatStartTime?: string;
354
355
  };
355
356
  type TranslationRequest = {
356
357
  targetLanguage: string;
@@ -441,18 +442,23 @@ declare class HTTPClient {
441
442
  }
442
443
 
443
444
  declare namespace Server {
445
+ /**
446
+ * Metadata
447
+ */
448
+ type Metadata = Record<string, string>;
444
449
  /**
445
450
  * API create conversation payload
446
451
  */
447
452
  type CreateConversationPayload = {
448
453
  platform: string;
449
- session_id: string;
454
+ external_id: string;
450
455
  agent_id: string;
451
456
  profile_code?: string;
452
- tags?: Record<string, string> | null;
457
+ metadata: Metadata;
453
458
  agent_name?: string;
454
459
  agent_nickname?: string;
455
460
  agent_email?: string;
461
+ chat_start_time?: string;
456
462
  };
457
463
  /**
458
464
  * API message object
@@ -465,7 +471,7 @@ declare namespace Server {
465
471
  author_name?: string;
466
472
  author_email?: string;
467
473
  text: string;
468
- tags: Record<string, string> | null;
474
+ metadata: Metadata;
469
475
  };
470
476
  /**
471
477
  * API conversation object
@@ -473,7 +479,6 @@ declare namespace Server {
473
479
  type Conversation = {
474
480
  id: string;
475
481
  profile_code: string | null;
476
- channel: string | null;
477
482
  platform: string;
478
483
  agent_id: string;
479
484
  agent_name: string | null;
@@ -484,30 +489,12 @@ declare namespace Server {
484
489
  engagement_id: string | null;
485
490
  engagement_name: string | null;
486
491
  engagement_skill: string | null;
487
- agent_note: string | null;
488
- survey_email: string | null;
489
- survey_name: string | null;
490
- survey_phone: string | null;
491
492
  visitor_id: string | null;
492
493
  visitor_name: string | null;
493
- visitor_device: string | null;
494
- visitor_browser: string | null;
495
- visitor_os: string | null;
496
- visitor_country: string | null;
497
- visitor_state: string | null;
498
- visitor_city: string | null;
499
- visitor_isp: string | null;
500
- visitor_organization: string | null;
501
- visitor_ip_address: string | null;
502
- chat_start_time: number | null;
503
- session_start_time: number | null;
504
- visit_start_time: string | null;
505
- session_id: string;
494
+ chat_start_time: string | null;
495
+ external_id: string;
506
496
  messages: ConversationMessage[];
507
- tags: Record<string, string> | null;
508
- has_active_profile: boolean;
509
- created: string;
510
- updated: string;
497
+ metadata: Metadata;
511
498
  };
512
499
  /**
513
500
  * API object for url suggestion
@@ -882,11 +869,11 @@ declare namespace Server {
882
869
  };
883
870
  };
884
871
  }
885
- type ConversationMessage = CamelCaseKeys<Omit<Server.ConversationMessage, 'tags'>> & {
886
- tags: Record<string, string> | null;
872
+ type ConversationMessage = CamelCaseKeys<Omit<Server.ConversationMessage, 'metadata'>> & {
873
+ metadata: Server.Metadata;
887
874
  };
888
- type Conversation = CamelCaseKeys<Omit<Server.Conversation, 'tags' | 'messages'>> & {
889
- tags: Record<string, string> | null;
875
+ type Conversation = CamelCaseKeys<Omit<Server.Conversation, 'metadata' | 'messages'>> & {
876
+ metadata: Server.Metadata;
890
877
  } & {
891
878
  messages: ConversationMessage[];
892
879
  };
@@ -894,10 +881,14 @@ type Conversation = CamelCaseKeys<Omit<Server.Conversation, 'tags' | 'messages'>
894
881
  * Create Conversation Options
895
882
  */
896
883
  type CreateConversationOptions = {
884
+ /**
885
+ * Chat start time
886
+ */
887
+ chatStartTime?: string;
897
888
  /**
898
889
  * The platform's conversation ID.
899
890
  */
900
- sessionId: string;
891
+ externalId: string;
901
892
  /**
902
893
  * The agent ID
903
894
  */
@@ -910,7 +901,7 @@ type CreateConversationOptions = {
910
901
  * The client profile code, e.g. 'b2b' or 'b2c'
911
902
  */
912
903
  profileCode?: string;
913
- tags?: Record<string, string> | null;
904
+ metadata: Server.Metadata;
914
905
  agentName?: string;
915
906
  agentNickname?: string;
916
907
  agentEmail?: string;
@@ -1082,12 +1073,12 @@ declare class DeepdeskAPI {
1082
1073
  */
1083
1074
  getPlatformConfig(platformConfigId?: number): Promise<CamelCaseKeys<Server.PlatformConfig['config']>>;
1084
1075
  checkUserExists(externalId: string): Promise<boolean>;
1085
- getConversationBySessionId(sessionId: string, options?: RetryOptions): Promise<CamelCaseKeys<Server.Conversation>>;
1086
- isConversationSupported(sessionId: string, options?: RetryOptions): Promise<boolean>;
1076
+ getConversationByExternalId(externalId: string, options?: RetryOptions): Promise<CamelCaseKeys<Server.Conversation>>;
1077
+ isConversationSupported(externalId: string, options?: RetryOptions): Promise<boolean>;
1087
1078
  /**
1088
1079
  * Update converstation meta data
1089
1080
  */
1090
- updateConversation(conversationId: string, data: Partial<Conversation>): Promise<Conversation>;
1081
+ updateConversation(conversationId: string, data: Partial<Omit<Conversation, 'messages'>>): Promise<Conversation>;
1091
1082
  /**
1092
1083
  * Post converstation messages
1093
1084
  */
@@ -1100,7 +1091,7 @@ declare class DeepdeskAPI {
1100
1091
  authorName?: string | undefined;
1101
1092
  authorEmail?: string | undefined;
1102
1093
  } & {
1103
- tags: Record<string, string> | null;
1094
+ metadata: Server.Metadata;
1104
1095
  })[]>;
1105
1096
  /**
1106
1097
  * Send event with meta data for analytics
@@ -1138,7 +1129,7 @@ declare class DeepdeskAPI {
1138
1129
  /**
1139
1130
  * Request pinned messages
1140
1131
  */
1141
- getPinnedMessages(conversationId: string): Promise<CamelCaseKeys<Server.PinnedMessage[]>>;
1132
+ getPinnedMessages(profileCode: string): Promise<TextSuggestion[]>;
1142
1133
  /**
1143
1134
  * Request style suggestions
1144
1135
  */
@@ -2184,17 +2175,17 @@ declare class DeepdeskSDK {
2184
2175
  get selectedTextSuggestion(): TextSuggestion;
2185
2176
  hasConversation(): boolean;
2186
2177
  conversationId(): string;
2187
- private sessionId;
2178
+ private externalId;
2188
2179
  private shouldAbort;
2189
2180
  login(): Promise<void>;
2190
2181
  isLoggedIn(): Promise<boolean>;
2191
2182
  /**
2192
2183
  * Check if conversation is supported by Deepdesk
2193
- * @param sessionId - A string with the conversation session ID.
2194
- * A session ID is local to the customer service platform, and identifies a
2184
+ * @param externalId - A string with the conversation external ID.
2185
+ * A external ID is local to the customer service platform, and identifies a
2195
2186
  * conversation that takes place within a certain time frame.
2196
2187
  */
2197
- isConversationSupported(sessionId: string, options?: Parameters<typeof DeepdeskAPI.prototype.isConversationSupported>[1]): Promise<boolean>;
2188
+ isConversationSupported(externalId: string, options?: Parameters<typeof DeepdeskAPI.prototype.isConversationSupported>[1]): Promise<boolean>;
2198
2189
  /**
2199
2190
  * Create a conversation
2200
2191
  * This should only be used when backend ingestion (via webhooks) is not possible.
@@ -2203,11 +2194,11 @@ declare class DeepdeskSDK {
2203
2194
  createConversation(data: CreateConversation): Promise<Conversation>;
2204
2195
  /**
2205
2196
  * Get a conversation by session ID
2206
- * @param sessionId - A string with the conversation session ID.
2197
+ * @param externalId - A string with the conversation session ID.
2207
2198
  * A session ID is local to the customer service platform, and identifies a
2208
2199
  * conversation that takes place within a certain time frame.
2209
2200
  */
2210
- getConversationBySessionId(sessionId: string, options?: Parameters<typeof DeepdeskAPI.prototype.getConversationBySessionId>[1]): Promise<Conversation>;
2201
+ getConversationByExternalId(externalId: string, options?: Parameters<typeof DeepdeskAPI.prototype.getConversationByExternalId>[1]): Promise<Conversation>;
2211
2202
  /**
2212
2203
  * Upsert a conversation: Get and update conversation or create it if it does not exist yet.
2213
2204
  */
@@ -2268,18 +2259,18 @@ declare class DeepdeskSDK {
2268
2259
  expectFormat?: T;
2269
2260
  input?: Record<string, any>;
2270
2261
  transcript?: TranscriptOption;
2271
- includeTags?: boolean;
2262
+ includeMetadata?: boolean;
2272
2263
  showCuesInWidget?: boolean;
2273
2264
  }): Promise<EvaluationOutput<T> | string>;
2274
2265
  /**
2275
2266
  * Evaluate conversation lifecycle assistant
2276
2267
  * Convenient wrapper around `evaluateAssistant`.
2277
- * By default includes 'stored-transcript' and 'tags'.
2268
+ * By default includes 'stored-transcript' and 'metadata'.
2278
2269
  */
2279
2270
  evaluateConversationAssistant(event: 'accepted' | 'new-message' | 'ended', options?: {
2280
2271
  input?: Record<string, any>;
2281
2272
  transcript?: TranscriptOption;
2282
- includeTags?: boolean;
2273
+ includeMetadata?: boolean;
2283
2274
  showCuesInWidget?: boolean;
2284
2275
  }): Promise<void>;
2285
2276
  /**
package/dist/index.d.ts CHANGED
@@ -344,13 +344,14 @@ type Profile = CamelCaseKeys<Server.Profile>;
344
344
 
345
345
  type CreateConversation = {
346
346
  platform: string;
347
- sessionId: string;
347
+ externalId: string;
348
348
  profileCode?: string;
349
349
  agentId: string;
350
350
  agentName?: string;
351
351
  agentNickname?: string;
352
352
  agentEmail?: string;
353
- tags?: Record<string, string> | null;
353
+ metadata?: Server.Metadata;
354
+ chatStartTime?: string;
354
355
  };
355
356
  type TranslationRequest = {
356
357
  targetLanguage: string;
@@ -441,18 +442,23 @@ declare class HTTPClient {
441
442
  }
442
443
 
443
444
  declare namespace Server {
445
+ /**
446
+ * Metadata
447
+ */
448
+ type Metadata = Record<string, string>;
444
449
  /**
445
450
  * API create conversation payload
446
451
  */
447
452
  type CreateConversationPayload = {
448
453
  platform: string;
449
- session_id: string;
454
+ external_id: string;
450
455
  agent_id: string;
451
456
  profile_code?: string;
452
- tags?: Record<string, string> | null;
457
+ metadata: Metadata;
453
458
  agent_name?: string;
454
459
  agent_nickname?: string;
455
460
  agent_email?: string;
461
+ chat_start_time?: string;
456
462
  };
457
463
  /**
458
464
  * API message object
@@ -465,7 +471,7 @@ declare namespace Server {
465
471
  author_name?: string;
466
472
  author_email?: string;
467
473
  text: string;
468
- tags: Record<string, string> | null;
474
+ metadata: Metadata;
469
475
  };
470
476
  /**
471
477
  * API conversation object
@@ -473,7 +479,6 @@ declare namespace Server {
473
479
  type Conversation = {
474
480
  id: string;
475
481
  profile_code: string | null;
476
- channel: string | null;
477
482
  platform: string;
478
483
  agent_id: string;
479
484
  agent_name: string | null;
@@ -484,30 +489,12 @@ declare namespace Server {
484
489
  engagement_id: string | null;
485
490
  engagement_name: string | null;
486
491
  engagement_skill: string | null;
487
- agent_note: string | null;
488
- survey_email: string | null;
489
- survey_name: string | null;
490
- survey_phone: string | null;
491
492
  visitor_id: string | null;
492
493
  visitor_name: string | null;
493
- visitor_device: string | null;
494
- visitor_browser: string | null;
495
- visitor_os: string | null;
496
- visitor_country: string | null;
497
- visitor_state: string | null;
498
- visitor_city: string | null;
499
- visitor_isp: string | null;
500
- visitor_organization: string | null;
501
- visitor_ip_address: string | null;
502
- chat_start_time: number | null;
503
- session_start_time: number | null;
504
- visit_start_time: string | null;
505
- session_id: string;
494
+ chat_start_time: string | null;
495
+ external_id: string;
506
496
  messages: ConversationMessage[];
507
- tags: Record<string, string> | null;
508
- has_active_profile: boolean;
509
- created: string;
510
- updated: string;
497
+ metadata: Metadata;
511
498
  };
512
499
  /**
513
500
  * API object for url suggestion
@@ -882,11 +869,11 @@ declare namespace Server {
882
869
  };
883
870
  };
884
871
  }
885
- type ConversationMessage = CamelCaseKeys<Omit<Server.ConversationMessage, 'tags'>> & {
886
- tags: Record<string, string> | null;
872
+ type ConversationMessage = CamelCaseKeys<Omit<Server.ConversationMessage, 'metadata'>> & {
873
+ metadata: Server.Metadata;
887
874
  };
888
- type Conversation = CamelCaseKeys<Omit<Server.Conversation, 'tags' | 'messages'>> & {
889
- tags: Record<string, string> | null;
875
+ type Conversation = CamelCaseKeys<Omit<Server.Conversation, 'metadata' | 'messages'>> & {
876
+ metadata: Server.Metadata;
890
877
  } & {
891
878
  messages: ConversationMessage[];
892
879
  };
@@ -894,10 +881,14 @@ type Conversation = CamelCaseKeys<Omit<Server.Conversation, 'tags' | 'messages'>
894
881
  * Create Conversation Options
895
882
  */
896
883
  type CreateConversationOptions = {
884
+ /**
885
+ * Chat start time
886
+ */
887
+ chatStartTime?: string;
897
888
  /**
898
889
  * The platform's conversation ID.
899
890
  */
900
- sessionId: string;
891
+ externalId: string;
901
892
  /**
902
893
  * The agent ID
903
894
  */
@@ -910,7 +901,7 @@ type CreateConversationOptions = {
910
901
  * The client profile code, e.g. 'b2b' or 'b2c'
911
902
  */
912
903
  profileCode?: string;
913
- tags?: Record<string, string> | null;
904
+ metadata: Server.Metadata;
914
905
  agentName?: string;
915
906
  agentNickname?: string;
916
907
  agentEmail?: string;
@@ -1082,12 +1073,12 @@ declare class DeepdeskAPI {
1082
1073
  */
1083
1074
  getPlatformConfig(platformConfigId?: number): Promise<CamelCaseKeys<Server.PlatformConfig['config']>>;
1084
1075
  checkUserExists(externalId: string): Promise<boolean>;
1085
- getConversationBySessionId(sessionId: string, options?: RetryOptions): Promise<CamelCaseKeys<Server.Conversation>>;
1086
- isConversationSupported(sessionId: string, options?: RetryOptions): Promise<boolean>;
1076
+ getConversationByExternalId(externalId: string, options?: RetryOptions): Promise<CamelCaseKeys<Server.Conversation>>;
1077
+ isConversationSupported(externalId: string, options?: RetryOptions): Promise<boolean>;
1087
1078
  /**
1088
1079
  * Update converstation meta data
1089
1080
  */
1090
- updateConversation(conversationId: string, data: Partial<Conversation>): Promise<Conversation>;
1081
+ updateConversation(conversationId: string, data: Partial<Omit<Conversation, 'messages'>>): Promise<Conversation>;
1091
1082
  /**
1092
1083
  * Post converstation messages
1093
1084
  */
@@ -1100,7 +1091,7 @@ declare class DeepdeskAPI {
1100
1091
  authorName?: string | undefined;
1101
1092
  authorEmail?: string | undefined;
1102
1093
  } & {
1103
- tags: Record<string, string> | null;
1094
+ metadata: Server.Metadata;
1104
1095
  })[]>;
1105
1096
  /**
1106
1097
  * Send event with meta data for analytics
@@ -1138,7 +1129,7 @@ declare class DeepdeskAPI {
1138
1129
  /**
1139
1130
  * Request pinned messages
1140
1131
  */
1141
- getPinnedMessages(conversationId: string): Promise<CamelCaseKeys<Server.PinnedMessage[]>>;
1132
+ getPinnedMessages(profileCode: string): Promise<TextSuggestion[]>;
1142
1133
  /**
1143
1134
  * Request style suggestions
1144
1135
  */
@@ -2184,17 +2175,17 @@ declare class DeepdeskSDK {
2184
2175
  get selectedTextSuggestion(): TextSuggestion;
2185
2176
  hasConversation(): boolean;
2186
2177
  conversationId(): string;
2187
- private sessionId;
2178
+ private externalId;
2188
2179
  private shouldAbort;
2189
2180
  login(): Promise<void>;
2190
2181
  isLoggedIn(): Promise<boolean>;
2191
2182
  /**
2192
2183
  * Check if conversation is supported by Deepdesk
2193
- * @param sessionId - A string with the conversation session ID.
2194
- * A session ID is local to the customer service platform, and identifies a
2184
+ * @param externalId - A string with the conversation external ID.
2185
+ * A external ID is local to the customer service platform, and identifies a
2195
2186
  * conversation that takes place within a certain time frame.
2196
2187
  */
2197
- isConversationSupported(sessionId: string, options?: Parameters<typeof DeepdeskAPI.prototype.isConversationSupported>[1]): Promise<boolean>;
2188
+ isConversationSupported(externalId: string, options?: Parameters<typeof DeepdeskAPI.prototype.isConversationSupported>[1]): Promise<boolean>;
2198
2189
  /**
2199
2190
  * Create a conversation
2200
2191
  * This should only be used when backend ingestion (via webhooks) is not possible.
@@ -2203,11 +2194,11 @@ declare class DeepdeskSDK {
2203
2194
  createConversation(data: CreateConversation): Promise<Conversation>;
2204
2195
  /**
2205
2196
  * Get a conversation by session ID
2206
- * @param sessionId - A string with the conversation session ID.
2197
+ * @param externalId - A string with the conversation session ID.
2207
2198
  * A session ID is local to the customer service platform, and identifies a
2208
2199
  * conversation that takes place within a certain time frame.
2209
2200
  */
2210
- getConversationBySessionId(sessionId: string, options?: Parameters<typeof DeepdeskAPI.prototype.getConversationBySessionId>[1]): Promise<Conversation>;
2201
+ getConversationByExternalId(externalId: string, options?: Parameters<typeof DeepdeskAPI.prototype.getConversationByExternalId>[1]): Promise<Conversation>;
2211
2202
  /**
2212
2203
  * Upsert a conversation: Get and update conversation or create it if it does not exist yet.
2213
2204
  */
@@ -2268,18 +2259,18 @@ declare class DeepdeskSDK {
2268
2259
  expectFormat?: T;
2269
2260
  input?: Record<string, any>;
2270
2261
  transcript?: TranscriptOption;
2271
- includeTags?: boolean;
2262
+ includeMetadata?: boolean;
2272
2263
  showCuesInWidget?: boolean;
2273
2264
  }): Promise<EvaluationOutput<T> | string>;
2274
2265
  /**
2275
2266
  * Evaluate conversation lifecycle assistant
2276
2267
  * Convenient wrapper around `evaluateAssistant`.
2277
- * By default includes 'stored-transcript' and 'tags'.
2268
+ * By default includes 'stored-transcript' and 'metadata'.
2278
2269
  */
2279
2270
  evaluateConversationAssistant(event: 'accepted' | 'new-message' | 'ended', options?: {
2280
2271
  input?: Record<string, any>;
2281
2272
  transcript?: TranscriptOption;
2282
- includeTags?: boolean;
2273
+ includeMetadata?: boolean;
2283
2274
  showCuesInWidget?: boolean;
2284
2275
  }): Promise<void>;
2285
2276
  /**