From Bright Pattern Documentation
Jump to: navigation, search

getInteractionsState

Request to get the current state of interactions in the Communicator Widget. Usually you would like to request that data once when you connect to the API or after page refresh. It helps you to restore the current initial state.

Request

Syntax

getInteractionsState(): Promise<OperationResult<InteractionsState>>

Where:

type InteractionsState = {
   activeInteractionId: string | null
   interactions: InteractionData[]

}


type InteractionData = {

   interactionId: string
   state: InteractionState
   type: InteractionType
   callParties: CallParty[]
   chatParties: ChatParty[]
   callMuted: boolean
   callRecording: boolean
   attachedData: AttachedData
   internal: boolean
   phoneNumber?: string
   email?: string
   callDirection?: CallDirection
   startTime?: number
   endTime?: number
   duration?: number
   description?: string
   disposition?: string
   globalInteractionId?: string
   service?: string
   playbackUrl?: string
   recordingUrl?: string
   DNIS?: string
   ANI?: string
   origination?: InteractionOrigination

}

type InteractionType = "voice" | "chat" | "email"

type InteractionState =

   "unknown" |
   "queued" |
   "ivr" |
   "wrap_up" |
   "wrap_up_hold" |
   "delivered" |
   "delivery_pending" |
   "hold" |
   "completed"

type InteractionOrigination =

   "dialpad" |
   "dialpad-search" |
   "directory" |
   "recent" |
   "favorites" |
   "workitem" |
   "interaction" |
   "contact-profile" |
   "help" |
   "conference" |
   "auto" |
   "integration-api"

type CallDirection = "inbound" | "outbound"

type CallParty = {

   id: string
   name: string
   phone: string
   userId?: string

}

type ChatPartyType = "internal" | "external"

type ChatParty = {

   id: string
   type: ChatPartyType
   name: string
   userId?: string
   contactId?: string
   email?: string
   phone?: string

}

Parameters

None

Example Request

    let activeInteractionId = null

    let initialInteractionDataLoaded = false

    const adApi = new AgentDesktopClientAPIImpl()

    adApi.getInteractionsState().then(data => {

        if (data.status === 'success') {

            console.info('Initial interactions state:', data.data)

            activeInteractionId = data.data.activeInteractionId

            initialInteractionDataLoaded = true

        } else {

            if (data.error.name === 'not_logged_in') {

                activeInteractionId = null

                initialInteractionDataLoaded = true

            }

            console.warn('Unable to get interactions state:', data.error)

        }

    })

Return Value

Object Object Values Data Type Optional?

(Y/N)

Value Description
InteractionsState Data encapsulating current state of interactions
activeInteractionId string or null N ID of active interaction, or null if there is no active one
interactions InteractionData[] N List of all agent interactions at this moment with all their data
InteractionData Data representing one interaction
type String Required Indicates the interaction type; recognized types are as follows:
  • "voice"
  • "chat"
  • "email"
interactionId String Required The interaction's ID
globalInteractionId String Optional The interaction's global interaction ID (GIID)
service String Optional The name of the service to which the interaction relates
callParties CallParty[] Required Provides a list of call parties. Note that this applies to interactions where type is "voice". Where:
  • id
    • The unique party ID
  • name
    • The party's display name
  • phone
    • The used phone number
  • userId
    • (Optional) The unique agent ID. It is ID from the TeamMember list entry from the getTeamMembers method. If the party is not an internal user, the userId will be undefined
chatParties ChatParty[] Required Provides a list of chat parties. Note that this applies to interactions where type is "chat". Where:
  • id
    • The unique party ID
  • type
    • Party type. Can be either "internal", which means it is another agent, or "external", which means it is a customer
  • name
    • Party's display name
  • userId
    • (Optional) The unique agent ID. It is ID from the TeamMember list entry from the getTeamMembers API method. If the party is not internal, the userId will be undefined
  • contactId
    • (Optional) The unique customer ID. It is available only when party is external, otherwise it's "undefined"
  • email
    • Party's email address, if any
  • phone
    • Party's phone number, if any
callMuted Boolean Required If set to true, the call is muted; if set to false, the call is not muted. Note that non-call interactions are always false.
callRecording Boolean Required If set to true, call recording active; if set to false, call recording is not active. Note that non-call interactions are always set to false.
disposition String Optional The name of the disposition category for this passed interaction
description string Optional Notes added by the agent for that interaction
recordingUrl String Optional The URL of the call recording. Note that this applies to interactions where type is "voice".
playbackUrl string Optional URL for the call recording playback. Note that this applies to interactions where type is "voice".
callDirection String Optional The type of call; recognized directions are as follows:
  • "inbound"
  • "outbound"

Note that this applies to interactions where type is "voice".

internal Boolean Required Indicates whether interaction is internal (with another agent) or with external customer
DNIS String Optional The Dialed Number Identification Service (DNIS). Note that this applies to interactions where type is "voice".
ANI string Optional The automatic number identification (ANI) for a transfer. Note that this applies to interactions where type is "voice".
phoneNumber String Optional The callee's phone number. Note that this applies to interactions where type is "voice".
startTime Number Optional The interaction's start date and time
endTime Number Optional The interaction's end date and time
duration Number Optional The interaction's duration in seconds
attachedData object Required Key-value pairs attached to the interaction from a scenario
origination String Optional Indicates how the interaction was initiated. There is a list of predefined values.
< Previous | Next >