Options
All
  • Public
  • Public/Protected
  • All
Menu

Class for copilot base service

Hierarchy

  • CopilotService

Index

Constructors

Properties

Methods

Constructors

Properties

AGENT_COPILOT_AGENTIC_WS_URL: string = ...
AGENT_COPILOT_AGENT_ASSIST_HUB_CONFIG: string = ...
AGENT_COPILOT_BASE_URI: string = '/agent-copilot/v1/'
AGENT_COPILOT_BASE_URI_V2: string = '/agent-copilot/v2/'
AGENT_COPILOT_CHECKLIST_APIS: { CANCEL: string; SUBMIT: string; UPDATE: string } = ...

Type declaration

  • CANCEL: string
  • SUBMIT: string
  • UPDATE: string
AGENT_COPILOT_DECISION_TREE_APIS: { CANCEL: string; LOAD: string; SKIP: string; SUBMIT: string; UPDATE: string } = ...

Type declaration

  • CANCEL: string
  • LOAD: string
  • SKIP: string
  • SUBMIT: string
  • UPDATE: string
AGENT_COPILOT_EMAIL_APIS: { EMAIL_ACTION: string; GENERATE_EMAIL: string; GET_DRAFT_EMAIL: string; GET_LAST_GENERATED_TOPICS: string } = ...

Type declaration

  • EMAIL_ACTION: string
  • GENERATE_EMAIL: string
  • GET_DRAFT_EMAIL: string
  • GET_LAST_GENERATED_TOPICS: string
AGENT_COPILOT_FINAL_SUMMARY: string = ...
AGENT_COPILOT_GET_ADAPTIVE_CARD_SCHEMAS: string = '/agent-copilot/v2/adaptive-cards?cardType={cardType}&cxaClientVersion={cxaClientVersion}'
AGENT_COPILOT_GET_ALL_ADAPTIVE_CARDS_SCHEMAS: string = ...
AGENT_COPILOT_GET_TASK_ASSIST_ACTIVE_FILL_DATA: string = '/agent-copilot/v1/contacts/{contactId}/taskassist/update-slots'
AGENT_COPILOT_GET_TASK_ASSIST_FORM_PREFILLED_DATA: string = '/agent-copilot/v1/contacts/{contactId}/taskassist/form-data'
AGENT_COPILOT_HEALTH_CHECK: string = ...
AGENT_COPILOT_SEARCH: string = ...
CANCEL_WORKFLOW: "/agent-copilot/v1/contacts/{contactId}/taskassist/cancel" = '/agent-copilot/v1/contacts/{contactId}/taskassist/cancel'
CHECKLIST_BASE: string = ...
DECISION_TREE_BASE: string = ...
DEFAULT_BOT_NAME: "cognigyWorkflows" = 'cognigyWorkflows'
EDITED_SUMMARY: string = '/agent-copilot/v1/contacts/{contactId}/edited-autosummary'
FINAL_SUMMARY: string = '/agent-copilot/v1/final-summary?contactId={contactId}'
JOURNEY_SUMMARY: string = '/agent-copilot/v1/journey-summary'
PATH_CONTACT_FEEDBACK: string = '/agent-copilot/v1/interaction-feedback/interaction'
PATH_GUIDANCE_FEEDBACK: string = '/agent-copilot/v1/interaction-feedback/kbAnswers'
PATH_KB_FILTER_UPDATE: string = '/agent-copilot/v1/kb-filter/update'
REFRESH_TOKENS: string = '/agent-copilot/v1/agent-idtoken'
TASK_ASSIST: string = '/agent-copilot/v1/contacts/{contactId}/task-assist'
TASK_ASSIST_FORM_ADAPTIVE_CARD_SCHEMAS_URL: string = '/agent-copilot/v2/adaptive-cards/taskassist/profiles/{agentAssistId}/bots/{botName}/intents/{intentName}/cards'
aahConfigStore: {} = {}

Type declaration

auth: CXoneAuth
logger: Logger = ...
utilService: HttpUtilService = ...
validationUtilService: ValidationUtils = ...

Methods

  • addAdaptiveCardSchemaToIndexDB(copilotReduxSlice: CcfCopilotData): Promise<void>
  • basePayload(): { contactId: any; idToken: string }
  • cancelDecisionTree(taskSessionUid: string, contactId: string, decisionTreeId: string): Promise<string>
  • Cancels the Decision Tree session for a given contact.

    This is typically called when the agent decides to exit the Decision Tree without submitting it.

    example
    await copilotService.cancelDecisionTree(
    "taskSessionUid",
    "203444780887",
    "a75bf9bb-203c-4850-b743-35e31f2f4421"
    );

    Parameters

    • taskSessionUid: string

      The task session unique ID.

    • contactId: string

      Contact/Interaction ID.

    • decisionTreeId: string

      ID of the Decision Tree to be closed.

    Returns Promise<string>

    Promise resolving server confirmation payload.

  • cancelWorkflow(contactId: string, taskSessionUid: string): Promise<void>
  • Cancels an active workflow session.

    example
    await copilotService.cancelWorkflow('contact-123', 'task-session-456');
    

    Parameters

    • contactId: string

      The contact/case ID associated with the active interaction.

    • taskSessionUid: string

      The task session UID of the workflow being cancelled.

    Returns Promise<void>

    Promise that resolves when the cancellation is acknowledged.

  • closeChecklist(sessionId: string, contactId: string, checklistId: string): Promise<string>
  • Closes the checklist without submitting.

    This is called when the agent decides to close/cancel the checklist.

    example
    await copilotService.closeChecklist(
    'session-001',
    '203444780887',
    'checklist-uuid'
    );

    Parameters

    • sessionId: string

      Checklist session ID.

    • contactId: string

      Contact/Interaction ID.

    • checklistId: string

      Checklist definition ID.

    Returns Promise<string>

    Promise resolving to the cancellation confirmation.

  • completeChecklist(sessionId: string, contactId: string, checklistId: string): Promise<string>
  • Completes and submits the checklist.

    This is called when the agent clicks the complete/submit button on the checklist.

    example
    await copilotService.completeChecklist(
    'session-001',
    '203444780887',
    'checklist-uuid'
    );

    Parameters

    • sessionId: string

      Checklist session ID.

    • contactId: string

      Contact/Interaction ID.

    • checklistId: string

      Checklist definition ID.

    Returns Promise<string>

    Promise resolving to the completion confirmation.

  • fetchAgenticWebSocketUrl(): Promise<{ agenticWebsocketURL: string }>
  • fetchCopilotAdaptiveCardSchemasFromBucket(cxaVersion: string, cardType?: string): Promise<unknown>
  • Used to get the copilot adaptive card schema by cardType(all by default) and UI version

    Parameters

    • cxaVersion: string

      branch name indicating UI version

    • cardType: string = 'all'

      type of adaptive card

      copilotService.fetchCopilotAdaptiveCardSchemasFromBucket('24.4.2', 'all');
      

    Returns Promise<unknown>

  • fetchCopilotAllAdaptiveCardSchemas(): Promise<unknown>
  • fetchGeneratedFinalSummary(contactId: string): Promise<unknown>
  • generateEmail(contactId: string, emailIdentifier: string, topics: { content: string; topicId: string }[]): Promise<string>
  • Used to get the draft email by contactId and uniqueEmailId

    example
    copilotService.generateEmail('12321', 'uniqueEmailId', [{topicId: '123', content: 'topicName'}]);
    

    Parameters

    • contactId: string

      contact Id

    • emailIdentifier: string

      unique email Id

    • topics: { content: string; topicId: string }[]

      list of topics

    Returns Promise<string>

  • generateFinalSummary(contactId: string, status: string): Promise<unknown>
  • getAgentAssistConfig(contactId: string, isObjectFlag?: boolean): any
  • getAgentFirstName(): any
  • getBaseUrlForAcp(): string
  • getCognigyConfig(): Promise<{ accessTokenSecret: string }>
  • Fetches the Cognigy AI Copilot access token secret from the backend. Used by both standalone and context-based Copilot grid connections.

    example
    const { accessTokenSecret } = await copilotService.getCognigyConfig();
    

    Returns Promise<{ accessTokenSecret: string }>

    Promise resolving to an object containing the accessTokenSecret

  • getCopilotIndexDb(): Promise<CcfCopilotData>
  • getCustomAdaptiveCardSchema(elementUid: string): Promise<object>
  • Fetches custom adaptive card schema with caching support. Checks localStorage cache first, then fetches from Profile Hub API if needed. Automatically parses and caches the schema.

    example
    const schema = await copilotService.getCustomAdaptiveCardSchema("7065ea9f-737f-4411-a857-112fe0b62aec");
    

    Parameters

    • elementUid: string

      Unique identifier of the custom adaptive card element

    Returns Promise<object>

    Promise resolving to parsed schema object

  • getDraftEmail(contactId: string, uniqueEmailId: string): Promise<unknown>
  • Fetches an element configuration (Decision Tree or Custom Adaptive Card) for a given element ID.

    example
    const element = await copilotService.getElement("dt-001");
    if (element.type === 'decisionTree') {
    const sections = element.config.sections;
    // Process decision tree sections
    } else if (element.type === 'customAdaptiveCard') {
    const schema = element.config.adaptiveCardSchema;
    // Render adaptive card with schema
    }

    Parameters

    • elementId: string

      Unique ID of the element (Decision Tree or Custom Adaptive Card).

    Returns Promise<DecisionTreeElement | CustomAdaptiveCardElement>

    Promise resolving to either a DecisionTreeElement or CustomAdaptiveCardElement.

  • Use to get journey summary data

    example
    copilotService.getJourneySummary([{contactNumber: '1234', channelType: 'Voice', contactDate: '2021-09-01', skill: 'skill', status: 'status'}],'1234','1234',{},'user');
    

    Parameters

    • contactHistory: ContactHistoryData[]

      contact history of the contact

    • contactId: string

      contactId/caseId

    • customerUid: string
    • aahConfiguration: CopilotProfileConfig

      agent assist configuration

    • customerName: string

      customer name

    Returns Promise<string>

  • getLastGeneratedTopics(contactId: string): Promise<unknown>
  • getLsDataByAgentId(): any
  • getTaskAssistActiveFilledData(inputs: Record<string, string>, contactId: string, objectId: string): Promise<string>
  • Fetches active pre-filled slot data for Task Assist based on the provided input slot.

    This API sends the slot name and value to the backend and retrieves the corresponding pre-filled data for the active Task Assist form.

    example
    copilotService.getTaskAssistActiveFilledData(
    { accountNumber: "12345" },
    "contact-123",
    "task-session-456"
    );

    Parameters

    • inputs: Record<string, string>

      Key/value pair representing the slot to be resolved. Example: { accountNumber: "12345" }

    • contactId: string

      Unique contact identifier associated with the active interaction.

    • objectId: string

      Task Assist session identifier (taskSessionUid).

    Returns Promise<string>

    Promise resolving to the pre-filled data returned by the backend.

  • getTaskAssistFormPreFilledData(intentConfig: IntentConfig, contactId: string, objectId: string): Promise<string>
  • getTaskAssistFormSchema(intentName: string, contactId: string): Promise<string>
  • getTaskResponse(contactId: string, intentConfig: IntentConfig, formCapturedata?: Record<string, unknown>, taskSessionUid?: string, query?: string): Promise<string>
  • Used to get task response based on the intentName for a given contactId

    example
    copilotService.getTaskResponse('Task intent name here', '12321');
    

    Parameters

    • contactId: string

      contact Id

    • intentConfig: IntentConfig

      intent config

    • Optional formCapturedata: Record<string, unknown>

      form capture data captured from adaptive card slots

    • Optional taskSessionUid: string

      task session unique id, preserved across follow-up calls in the same workflow session

    • Optional query: string

      optional free-text query forwarded to task-assist (e.g. search-bar input for an ongoing workflow); included in the request body whenever it is defined, including the empty string

    Returns Promise<string>

  • Searches for workflow suggestions using semantic search. Called when no local workflow matches the agent's '/' query.

    example
    const suggestions = await copilotService.getWorkflowSuggestions('refund process', '12345');
    

    Parameters

    • agentQuery: string

      The search query from agent (text after '/')

    • contactId: string

      The active contact ID

    Returns Promise<WorkflowSuggestionResponse>

    Promise with suggested workflows

  • healthCheck(contactId: string): Promise<unknown>
  • postDecisionTreeSectionChange(taskSessionUid: string, contactId: string, decisionTreeId: string, sectionId: string): Promise<DecisionTreeData>
  • Posts a Decision Tree section-change event to the backend.

    This is triggered when the agent switches to another section in the UI. Used for analytics, tracking, and server-side decision logic.

    example
    await copilotService.postDecisionTreeSectionChange(
    "task-session-001",
    "203444780887",
    "a75bf9bb-203c-4850-b743-35e31f2f4421",
    "22414-4141-4141-4242"
    );

    Parameters

    • taskSessionUid: string

      Unique ID for the task session.

    • contactId: string

      Contact/Interaction ID associated with the tree.

    • decisionTreeId: string

      Decision Tree session/element ID.

    • sectionId: string

      The newly selected active section ID.

    Returns Promise<DecisionTreeData>

    Promise resolving the raw API response.

  • processEditorCommand(action: string, context: string, selectedText: string, contactId: string): Promise<string>
  • Use to process an editor command to get the Simplified/Rephrased/Expanded text in reponse

    example
    copilotService.processEditorCommand("Simplify",'this is test','test','1234');
    

    Parameters

    • action: string

      email action

    • context: string

      editor text

    • selectedText: string

      selected text from editor

    • contactId: string

      contactId/caseId

    Returns Promise<string>

  • refreshTokens(idToken: string, accessToken: string): Promise<{ accessToken: string; idToken: string }>
  • Refreshes authentication tokens for the current agent session.

    example
    const tokens = await copilotService.refreshTokens('newIdToken', 'newAccessToken');
    

    Parameters

    • idToken: string

      The current ID token to refresh.

    • accessToken: string

      The current access token to refresh.

    Returns Promise<{ accessToken: string; idToken: string }>

    A promise that resolves with the refreshed idToken and accessToken.

  • removeCaseIdFromCopilotIndexDb(caseId: string): Promise<void>
  • Ensures the Agent Assist configuration for the given contactId is available in memory. If the configuration is not already cached (in the in-memory store or localStorage), it will be retrieved from the backend API and then returned.

    Unlike storeAgentAssistConfig, this method only attempts a backend retrieval when no cached configuration exists; it does not validate agentAssistId/mediaType changes.

    example
    const aahConfig = copilotService.resolveAgentAssistConfig('12321');
    if (aahConfig?.Params?.emailChannel) {
    // proceed with email specific logic
    }

    Parameters

    • contactId: string

      The contact (case) identifier whose Agent Assist configuration is required.

    Returns Promise<CopilotProfileConfig>

    The loaded CopilotProfileConfig if available after cache check / retrieval; otherwise undefined if retrieval failed silently.

  • retriveAgentAssistConfig(contactId: string, mediaType?: string, agentAssistId?: string): Promise<CopilotProfileConfig>
  • saveEditedSummary(channel: string, contactNumber: number, summary: string): Promise<string>
  • Saves the edited summary for a given channel and contact number.

    example
    copilotService.saveEditedSummary('Voice', 123456789, 'This is the edited summary text.');
    

    Parameters

    • channel: string

      The communication channel.

    • contactNumber: number

      The contact number.

    • summary: string

      The edited summary text.

    Returns Promise<string>

    A promise that resolves with the response data.

  • setAgentAssistConfig(contactId: string, aahConfig: string): void
  • Used to set AAH config of contactId in localStorage

    example
    copilotService.setAgentAssistConfig('123123', {ContactId : '123123',});
    

    Parameters

    • contactId: string

      contact Id for which AAH config needs to be stored

    • aahConfig: string

      AAH config for contactId

    Returns void

  • setCopilotIndexDb(updatedReduxSlice: CcfCopilotData): Promise<void>
  • skipDecisionTreeQuestion(taskSessionUid: string, contactId: string, decisionTreeId: string, questionId: string, sectionId: string): Promise<string>
  • Skips a decision tree question for a given contact and question.

    example
    copilotService.skipDecisionTreeQuestion('taskSessionUid', 'contactId', 'decisionTreeId', 'questionId', 'sectionId');
    

    Parameters

    • taskSessionUid: string

      The task session unique ID.

    • contactId: string

      The contact ID.

    • decisionTreeId: string

      The decision tree ID.

    • questionId: string

      The question ID to be skipped.

    • sectionId: string

      The section ID containing the question.

    Returns Promise<string>

    A promise that resolves with the response data.

  • storeAgentAssistConfig(contactId: string, mediaType?: string, agentAssistId?: string): Promise<any>
  • Used to store AAH config for the contactId in browser memory by pulling from redis cache, if not already available

    example
    copilotService.storeAgentAssistConfig('12321');
    

    Parameters

    • contactId: string

      contact Id

    • Optional mediaType: string

      media type for the contact

    • Optional agentAssistId: string

      agent assist ID

    Returns Promise<any>

  • submitDecisionTree(taskSessionUid: string, contactId: string, decisionTreeId: string): Promise<string>
  • Submits the fully completed Decision Tree to the backend.

    After submission, the backend may trigger follow-up workflows, notifications, or task-assist events.

    example
    await copilotService.submitDecisionTree(
    "taskSessionUid",
    "203444780887",
    "a75bf9bb-203c-4850-b743-35e31f2f4421"
    );

    Parameters

    • taskSessionUid: string
    • contactId: string

      Contact/Interaction ID.

    • decisionTreeId: string

      ID of the Decision Tree being submitted.

    Returns Promise<string>

    Promise resolving server confirmation payload.

  • updateChecklistItem(params: { checklistId: string; completionType: ChecklistCompletionType; contactId: string; isCompleted: boolean; itemId: string; sessionId: string }): Promise<string>
  • Updates a checklist item's completion status.

    This is called when checklist item gets checked or unchecked.

    example
    await copilotService.updateChecklistItem({
    sessionId: 'session-001',
    contactId: '203444780887',
    checklistId: 'checklist-uuid',
    itemId: 'item-1',
    isCompleted: true,
    completionType: 'MANUAL'
    });

    Parameters

    • params: { checklistId: string; completionType: ChecklistCompletionType; contactId: string; isCompleted: boolean; itemId: string; sessionId: string }

      Object containing sessionId, contactId, checklistId, itemId, isCompleted, and completionType.

      • checklistId: string
      • completionType: ChecklistCompletionType
      • contactId: string
      • isCompleted: boolean
      • itemId: string
      • sessionId: string

    Returns Promise<string>

    Promise resolving to the updated checklist data.

  • updateDecisionTreeResponse(updateDecisionTreeResponsePayload: { contactId: string; decisionTreeId: string; newResponse: string | number | boolean; questionId: string; sectionId: string; taskSessionUid: string }): Promise<DecisionTreeData>
  • Updates the answer for a single Decision Tree question.

    This is called when the user edits a field and clicks the ✓ save icon.

    example
    await copilotService.updateDecisionTreeResponse(
    "task-session-001",
    "203444780887",
    "a75bf9bb-203c-4850-b743-35e31f2f4421",
    "12414-4141-4141-4141",
    "213123-3131-13131-3132",
    "New Answer"
    );

    Parameters

    • updateDecisionTreeResponsePayload: { contactId: string; decisionTreeId: string; newResponse: string | number | boolean; questionId: string; sectionId: string; taskSessionUid: string }
      • contactId: string
      • decisionTreeId: string
      • newResponse: string | number | boolean
      • questionId: string
      • sectionId: string
      • taskSessionUid: string

    Returns Promise<DecisionTreeData>

    Promise resolving API response containing update summary.

Generated using TypeDoc