Options
All
  • Public
  • Public/Protected
  • All
Menu

Module DaVinci_API

Index

References

Enumerations

Classes

Interfaces

Functions

References

ERROR_CODE

Re-exports ERROR_CODE

LOG_LEVEL

Re-exports LOG_LEVEL

LOG_SOURCE

Re-exports LOG_SOURCE

Functions

addContextualContacts

clearContextualContacts

  • clearContextualContacts(): Promise<void>

clickToDial

  • Call this when an agent preforms a click-to-dial. It will tell any Channel Apps to call this number.

    Example: if a phone number is displayed in the CRM then, when it is clicked by the agent, this event should be called to initiate a call.

    Parameters

    • phoneNumber: string

      Number to be dialed

    • Optional records: SearchRecords

      Records/entities associated to the number(e.g. lead, contact, etc..)

    • Optional channelType: CHANNEL_TYPES

    Returns Promise<void>

contextualOperation

dialPadNumberClicked

  • dialPadNumberClicked(number: any): Promise<void>
  • Parameters

    • number: any

    Returns Promise<void>

enableClickToDial

  • enableClickToDial(enabled: boolean): Promise<void>
  • Use this to enable or disable click-to-dial

    Parameters

    • enabled: boolean

      This set whether or not agents should be allowed to preform click-to-dial

    Returns Promise<void>

getAppName

  • getAppName(): Promise<string>
  • This is to get the app name as it is listed in davinci. CRM apps using a bridge might need this to know which iframe to post messages to.

    Returns Promise<string>

getConfig

  • This is needed to get configuration of the app from Creators Studio.

    Returns Promise<IAppConfiguration>

    The configuration of the app provided in DaVinci Creators Studio

getPageInfo

  • Gets any records or entities on the page the agent is currently viewing.

    See registerGetPageInfo

    Alternatively use registerOnFocus to get the records every time the page changes.

    Returns Promise<SearchRecords>

    Records on the currents page

getPresence

  • All DaVinci apps can have a presence(ready, not ready, etc..). Which will then be synced across all apps.

    Use this to get the current presence and reason of the user

    Note that normally the app the manages the presence will have a list of valid presences. If you are integrating with something with it's own presence then you should have a map in your apps config in DaVinci Creators Studio that maps between that presence and the valid presences.

    See:

    Returns Promise<IGetPresenceResult>

getSearchLayout

getSequenceID

  • getSequenceID(): string
  • Gets a sequential id. This can be used for scenarioIds and interactionIds in IInteractions.

    Returns string

getUserDetails

  • Get details about the current user.

    Returns Promise<IUserDetails>

initializeComplete

  • This should be called after the app has registered for any events it wants to handle. The app will not receive any events until after this is called.

    This is also needed to get configuration of the app from Creators Studio. Deprecated to get configuration using initializeComplete, instead use getConfig API

    Parameters

    • Optional logger: Logger

      The logger that the DaVinci API will use if any error occurs

    Returns Promise<IAppConfiguration>

    The configuration of the app provided in DaVinci Creators Studio

isPluginVisible

  • isPluginVisible(): Promise<boolean>
  • Checks if this app is currently visible.

    Returns Promise<boolean>

isToolbarVisible

  • isToolbarVisible(): Promise<boolean>
  • This checks if the toolbar(agnet.contactcanvas.com) is visible.

    See registerIsToolbarVisible

    Returns Promise<boolean>

    true if the toolbar(agent.contactcanvas.com) is visible(maximized), or false otherwise(minimized)

loadBridgeScripts

  • loadBridgeScripts(javascriptUrls: string[]): Promise<void>
  • An app can use this to load javascript files on the CCC iframe. This is useful if the app needs access to the parent iframe to interact with the CRM.

    Parameters

    • javascriptUrls: string[]

      Urls of js files to load

    Returns Promise<void>

logout

  • logout(reason?: string): Promise<void>

onFocus

  • An app that integrates with a CRM should call this when the user navigates to a new page, record, or entity.

    See registerOnFocus

    Parameters

    • records: SearchRecords

      Any records or entities that are visible on the new page.

    Returns Promise<void>

onPresenceChanged

  • onPresenceChanged(presence: string, reason?: string, presenceColor?: string, initiatingApp?: string): Promise<any>
  • All DaVinci apps can have a presence(ready, not ready, etc..). Which will then be synced across all apps.

    One app has to be in charge of managing how one app's presence will effect the other apps. That app should use this to inform other apps that the presence of the agent has changed. It should be called each time the presence or reason is changed.

    See:

    Parameters

    • presence: string
    • Optional reason: string
    • Optional presenceColor: string

      the color of the presence(green for ready, red for not ready, etc..). Any valid css color is fine(rgb, hex, etc..)

    • Optional initiatingApp: string

      the name of the app that caused this presence change

    Returns Promise<any>

openMyCallsToday

  • openMyCallsToday(url: string, openInNewWindow: boolean): Promise<void>
  • Opens a new tab in the browser. This is originally used to open 'My Calls Today' a list of calls the agent had taken today.

    Parameters

    • url: string

      The url to open.

    • openInNewWindow: boolean

    Returns Promise<void>

registerClickToDial

  • registerClickToDial(callback: (phoneNumber: string, records?: SearchRecords, channelType?: CHANNEL_TYPES) => Promise<void>): Promise<void>

registerContextualControls

registerEnableClickToDial

  • registerEnableClickToDial(callback: (clickToDialEnabled: boolean) => Promise<void>): Promise<void>
  • Use this to be informed if click-to-dial becomes enabled or disabled

    Parameters

    • callback: (clickToDialEnabled: boolean) => Promise<void>

      Called when click to dial is enabled or disabled. If clickToDialEnabled is false then the application should not allow users to preform click-to-dial requests.

        • (clickToDialEnabled: boolean): Promise<void>
        • Parameters

          • clickToDialEnabled: boolean

          Returns Promise<void>

    Returns Promise<void>

registerForFrameworkNotifications

  • registerForFrameworkNotifications(callback: (newChannel: any) => Promise<any>): Promise<void>
  • Parameters

    • callback: (newChannel: any) => Promise<any>
        • (newChannel: any): Promise<any>
        • Parameters

          • newChannel: any

          Returns Promise<any>

    Returns Promise<void>

registerGetPageInfo

  • registerGetPageInfo(callback: () => Promise<SearchRecords>): Promise<void>
  • Apps that integrate with a CRM should use this to allow other apps to get any CRM entities on the page the agent is actively viewing.

    See getPageInfo

    Parameters

    • callback: () => Promise<SearchRecords>

      This function should return(via a promise) any records/entities that are currently displayed on the CRM.

    Returns Promise<void>

registerGetPresence

  • registerGetPresence(callback: () => Promise<{ presence: string; reason?: string }>): Promise<void>
  • All DaVinci apps can have a presence(ready, not ready, etc..). Which will then be synced across all apps.

    One app has to be in charge of managing how one app's presence will effect the other apps. That app should use this to register to handler other apps asking what the current presence is.

    See:

    Parameters

    • callback: () => Promise<{ presence: string; reason?: string }>

      This is called whenever another app wants to know the current presence of the user.

        • (): Promise<{ presence: string; reason?: string }>
        • Returns Promise<{ presence: string; reason?: string }>

    Returns Promise<void>

registerGetSearchLayout

  • registerGetSearchLayout(callback: () => Promise<SearchLayouts>): Promise<void>
  • Apps that integrate with CRM should register for this event to tell other apps which fields are important in a record. The SearchLayouts should be configured either in the CRM or in the app's config in Creator Studio.

    See getSearchLayout

    Parameters

    Returns Promise<void>

registerIsToolbarVisible

  • registerIsToolbarVisible(callback: () => Promise<boolean>): Promise<void>
  • Used by apps that embed agent.contactcanvas.com into a CRM. This registers the app to handle events to check if agent.contactcanvas.com is currently visible.

    Parameters

    • callback: () => Promise<boolean>

      This function when called should return(vis a promise) whether or not agent.contactcanvas.com is currently visible to the user. e.g. if agent.contactcanvas.com is minimized this should return false and if it is maximized it should return true

      See isToolbarVisible

        • (): Promise<boolean>
        • Returns Promise<boolean>

    Returns Promise<void>

registerOnFocus

  • registerOnFocus(callback: (records: SearchRecords) => Promise<void>): Promise<void>
  • Apps should use this if they want to know what page, record, or entity the agent navigates too.

    See onFocus

    Alternatively use getPageInfo to get the records on the current page.

    Parameters

    • callback: (records: SearchRecords) => Promise<void>

      Called when the user navigates to a new page, record, or entity. 'records' contains any records on the new page.

    Returns Promise<void>

registerOnInteraction

  • This registers the app the handle interaction events, which is triggered each time an interaction changes.

    Parameters

    Returns Promise<void>

registerOnLogout

  • registerOnLogout(callback: (reason?: string) => Promise<void>): Promise<void>
  • Use this to receive an event when the agent logs out. This is useful if you have some other service that needs to be logged out at that time.

    See:

    Parameters

    • callback: (reason?: string) => Promise<void>

      Called when the user logs out. The registered app should logout of any services when it receives this event.

        • (reason?: string): Promise<void>
        • Parameters

          • Optional reason: string

          Returns Promise<void>

    Returns Promise<void>

registerOnPresenceChanged

  • registerOnPresenceChanged(callback: (presence: string, reason?: string, initiatingApp?: string) => Promise<void>): Promise<void>
  • All DaVinci apps can have a presence(ready, not ready, etc..). Which will then be synced across all apps.

    Use this to receive an event each time the presence changes.

    Note that normally the app the manages the presence will have a list of valid presences. If you are integrating with something with it's own presence then you should have a map in your apps config in DaVinci Creators Studio that maps between that presence and the valid presences.

    See:

    Parameters

    • callback: (presence: string, reason?: string, initiatingApp?: string) => Promise<void>

      Called whenever the presence or reason of the agent changes.

        • (presence: string, reason?: string, initiatingApp?: string): Promise<void>
        • Parameters

          • presence: string
          • Optional reason: string
          • Optional initiatingApp: string

          Returns Promise<void>

    Returns Promise<void>

registerOpenMyCallsToday

  • registerOpenMyCallsToday(callback: (url: string, openInNewWindow: boolean) => Promise<void>): Promise<void>
  • Apps that integrate with an application/CRM should register for this

    See openMyCallsToday

    Parameters

    • callback: (url: string, openInNewWindow: boolean) => Promise<void>

      This function should try to open the mycalls today link inside the crm. Ideally in a new CRM tab(not browser tab)

        • (url: string, openInNewWindow: boolean): Promise<void>
        • Parameters

          • url: string
          • openInNewWindow: boolean

          Returns Promise<void>

    Returns Promise<void>

registerOperationInterceptor

  • registerOperationInterceptor(operationsToIntercept: OPERATIONS[], callback: (payload: { didTimeout?: boolean; message: IRequest | IResponse; pluginName: string }) => Promise<{ message: IRequest | IResponse; pluginName: string }>, timeoutInMilliseconds?: number, timeoutAction?: INTERCEPTOR_TIMEOUT_ACTION): Promise<void>
  • This can be used to intercept any DaVinci operation. Intercepted operations will have the operation's payload passed to your callback. The callback can then either:

    • resolve
      • returning a modified payload.
      • This modified payload will then passed to the regular operation handles instead of the original payload.
    • reject
      • if a IRequest then this will stop the operation from propagating to the normal operation handlers
      • if a IResponse then this will send a rejection to the originating app

    Example

     registerOperationInterceptor([
       OPERATIONS.CLICK_TO_DIAL,
       OPERATIONS.CONTEXTUAL_OPERATION,
       OPERATIONS.CONTEXTUAL_EVENT],
       async (payload: {
         pluginName: string;
         message: IRequest | IResponse;
     }) => {
       console.info('INTERCEPTED!! ', payload);
       let operation;
       if (isResponse(payload.message)) {
         operation = payload.message.request.operation;
       } else {
         operation = payload.message.operation;
       }
       console.info('operation: ', OPERATIONS[operation]);
    
       if (operation === OPERATIONS.CLICK_TO_DIAL) {
         if (!isResponse(payload.message)) {
           // force click to dial number to be 555-555-5555
           payload.message.data[0] = "555-555-5555";
         }
       } else if (operation === OPERATIONS.CONTEXTUAL_EVENT) {
         // this is an outbound typed in from the dial pad
         if (!isResponse(payload.message)) {
           // cancel the outbound
           throw new Error('A reasonable reason to cancel');
         }
       } else if (operation === OPERATIONS.CONTEXTUAL_OPERATION) {
         // this is intercepting transfer and the like
         if (isResponse(payload.message)) {
           // force transfer number to be 555-555-5555
           payload.message.resolve.displayName = "555-555-5555";
           payload.message.resolve.uniqueId = "555-555-5555";
         }
       }
    
       return payload;
     });
    

    Parameters

    • operationsToIntercept: OPERATIONS[]
    • callback: (payload: { didTimeout?: boolean; message: IRequest | IResponse; pluginName: string }) => Promise<{ message: IRequest | IResponse; pluginName: string }>

      This function takes the original operation and then returns it (with modifications as desired) Note that another event will be sent with 'didTimeout' set if a timeout occurred because the interceptor did not reply fast enough

        • (payload: { didTimeout?: boolean; message: IRequest | IResponse; pluginName: string }): Promise<{ message: IRequest | IResponse; pluginName: string }>
        • Parameters

          • payload: { didTimeout?: boolean; message: IRequest | IResponse; pluginName: string }
            • Optional didTimeout?: boolean
            • message: IRequest | IResponse
            • pluginName: string

          Returns Promise<{ message: IRequest | IResponse; pluginName: string }>

    • Optional timeoutInMilliseconds: number

      How long the interceptor has to respond to a request before it times out

    • Optional timeoutAction: INTERCEPTOR_TIMEOUT_ACTION

      What should happen to the original request if a timeout occurs

    Returns Promise<void>

registerSaveActivity

  • registerSaveActivity(callback: (activity: IActivity) => Promise<string>): Promise<void>
  • Apps that integrate with an application should register for this to create an activity/notes when the event is received.

    See saveActivity

    Parameters

    • callback: (activity: IActivity) => Promise<string>

      This function should create or update an activity in the application. If the id of the given activity is defined then this function should update the existing activity, else this should create a new activity.

        • Parameters

          Returns Promise<string>

    Returns Promise<void>

registerScreenpop

registerScreenpopControlChanged

  • registerScreenpopControlChanged(callback: (screenPopEnabled: boolean) => Promise<void>): Promise<void>
  • Use this to revive an event whenever screenpops are disabled or enabled.

    When disabled screen pops should not be preformed either when screenpop or setInteraction is called.

    Parameters

    • callback: (screenPopEnabled: boolean) => Promise<void>

      Called when the status of the screenpop control changes. The application should not preform screenpops when screenPopEnabled is false.

        • (screenPopEnabled: boolean): Promise<void>
        • Parameters

          • screenPopEnabled: boolean

          Returns Promise<void>

    Returns Promise<void>

registerSetPresence

  • registerSetPresence(callback: (presence: string, reason?: string, initiatingApp?: string) => Promise<void>): Promise<void>
  • All DaVinci apps can have a presence(ready, not ready, etc..). Which will then be synced across all apps.

    One app has to be in charge of managing how one app's presence will effect the other apps. That app should use this to receive events when other app's change their presence.

    See:

    Parameters

    • callback: (presence: string, reason?: string, initiatingApp?: string) => Promise<void>

      This is called when ever an app request a change in the user's presence. If the given presence/reason is not valid this function should reject. If it is valid then this function should inform the other apps using onPresenceChanged.

        • (presence: string, reason?: string, initiatingApp?: string): Promise<void>
        • Parameters

          • presence: string
          • Optional reason: string
          • Optional initiatingApp: string

          Returns Promise<void>

    Returns Promise<void>

registerSetSoftphoneHeight

  • registerSetSoftphoneHeight(callback: (height: number) => Promise<void>): Promise<void>
  • Used by apps that embed agent.contactcanvas.com into a CRM. This registers the app to handle events to change the iframe's height.

    Parameters

    • callback: (height: number) => Promise<void>

      Called when the height of agent.contactcanvas.com changes. The application should set the height of the iframe containing agent.contactcanvas.com to the given height(in px).

        • (height: number): Promise<void>
        • Parameters

          • height: number

          Returns Promise<void>

    Returns Promise<void>

registerSetSoftphoneWidth

  • registerSetSoftphoneWidth(callback: (width: number) => Promise<void>): Promise<void>
  • Used by apps that embed agent.contactcanvas.com into a CRM. This registers the app to handle events to change the iframe's height.

    Parameters

    • callback: (width: number) => Promise<void>

      Called when the width of agent.contactcanvas.com changes. The application should set the width of the iframe containing agent.contactcanvas.com to the given width(in px).

        • (width: number): Promise<void>
        • Parameters

          • width: number

          Returns Promise<void>

    Returns Promise<void>

registerSetSupportedChannels

  • registerSetSupportedChannels(callback: (originatingAppName: string, channels: ISupportedChannel[]) => Promise<void>): Promise<void>
  • Register to receive events where apps inform you what channels they support

    Parameters

    Returns Promise<void>

saveActivity

  • saveActivity(activity: IActivity): Promise<string>
  • Apps that create interactions should use this to save, or update, information about the interaction (notes, disposition, etc...) on the application/crm.

    If the id of the activity is defined then the existing activity will be updated, otherwise a new activity will be created.

    See registerSaveActivity

    Parameters

    Returns Promise<string>

    Id of the created or updated activity

screenpop

  • This causes a screenpop on the application of given record. This is useful if you want to open a record you received from registerOnFocus or the like.

    See registerScreenpop for more.

    Parameters

    • channel: CHANNEL_TYPES

      Type of channel that caused the screenpop

    • direction: INTERACTION_DIRECTION_TYPES

      Direction of the interaction that caused the screenpop

    • objectId: string

      Id of the object to pop

    • objectType: string

      Type of the object to pop

    Returns Promise<void>

sendNotification

  • sendNotification(message: string, notificationType?: NOTIFICATION_TYPE): Promise<void>
  • This sends notification to framework which will be displayed in toolbar. To Do : Different notifications based on type.

    Parameters

    • message: string

      Message to be displayed on toolbar.

    • Optional notificationType: NOTIFICATION_TYPE

      Type of notification.

    Returns Promise<void>

setAppHeight

  • setAppHeight(height: number, grayOutLowerLayers?: boolean): Promise<void>
  • Set the height of this app. Whenever the height needed by your app changes you should recalculate it and call this method.

    Parameters

    • height: number

      Height in px

    • Default value grayOutLowerLayers: boolean = false

      If true then DaVinci will gray out all apps in lower layers then this app. Only applies if 'Layer' config in studio is greater than 0 and height is greater than 0.

    Returns Promise<void>

setAppWidth

  • setAppWidth(width: number): Promise<void>
  • Set the width of this app Whenever the width needed by your app changes you should recalculate it and call this method.

    Note: this is can only be used if the location of you app as defined in Creates Studio is Top Left, Top Right, Bottom Left, or Bottom Right.

    Parameters

    • width: number

      Width in px

    Returns Promise<void>

setInteraction

  • Apps with interactions(phone calls, chats, etc..) should call this every time an interactions is added, removed, or modified.

    This is important as it allows for screenpops, activities to be saved in CRM, and statistics.

    Screenpops should not be performed if they are disabled: registerScreenpopControlChanged

    Parameters

    Returns Promise<SearchRecords>

setPluginVisible

  • setPluginVisible(isVisible: boolean): Promise<void>
  • Sets if or not the app should be visible.

    Parameters

    • isVisible: boolean

    Returns Promise<void>

setPresence

  • setPresence(presence: string, reason?: string, presenceColor?: string): Promise<void>
  • All DaVinci apps can have a presence(ready, not ready, etc..). Which will then be synced across all apps.

    Use this to set the presence(and reason) of the agent. The app that manages presence will then sync this across all the apps.

    Note that normally the app the manages the presence will have a list of valid presences. If you are integrating with something with it's own presence then you should have a map in your apps config in DaVinci Creators Studio that maps between that presence and the valid presences.

    See:

    Parameters

    • presence: string

      A valid presence

    • Optional reason: string

      A string explaining why the presence was changed(ex: Break, Lunch, end of shift)

    • Optional presenceColor: string

    Returns Promise<void>

setScreenpopControl

  • setScreenpopControl(enabled: boolean): Promise<void>
  • Sets whether or not screenpop is enabled.

    See registerScreenpopControlChanged for more.

    Parameters

    • enabled: boolean

    Returns Promise<void>

setSupportedChannels

setToolbarEnabled

  • setToolbarEnabled(isEnabled: boolean): Promise<void>
  • This is used to enabled and disable the toolbar. If disabled then only global apps will load.

    Parameters

    • isEnabled: boolean

    Returns Promise<void>

speedDialNumberClicked

  • speedDialNumberClicked(number: any): Promise<void>
  • Parameters

    • number: any

    Returns Promise<void>

Generated using TypeDoc