From Bright Pattern Documentation
Jump to: navigation, search
• 5.19


onInteractionEnd

This handler will be invoked after the end of an agent's interaction. This event includes all data about the completed interaction.

Request

Syntax

on('ON_INTERACTION_REMOVED', handler: OnInteractionEndHandler): void


type OnInteractionEndHandler = (removedInteraction: InteractionData) => void


type InteractionData = {

    interactionId: string

    state: InteractionState

    type: InteractionType

    subject: string

    associatedObjects: InteractionAssociatedObjectsData

    callParties: CallParty[]

    callMuted: boolean

    callRecording: boolean

    attachedData: AttachedData

    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

}

Parameters

Parameter Parameter Values Data Type Optional/Required Description
interaction
type String Required Indicates the interaction type; recognized types are as follows:
  • "voice"
  • "chat"
  • "email"
agentId String Required The agent’s ID
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 String 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 user ID. That is, it is an ID from the TeamMember list entry from the getTeamMembers method. If the party is not an internal user, the userId will be undefined
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
recordingUrl String Optional The URL of the call recording. 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".

DNIS String Optional The Dialed Number Identification Service (DNIS). Note that this applies to interactions where type is "voice".
transferANI ? 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
origination String Optional Indicates how the interaction was initiated. There is a list of predefined values.

Example Request

const interactionsList: InteractionData[] = [];

function interactionRemovedCallback(data: InteractionData) {

const delIndex = interactionsList.findIndex(item => item.interactionId === data.interactionId);

if (delIndex !== -1) {

interactionsList.splice(delIndex, 1);

}

}

adApi.on("ON_INTERACTION_REMOVED", interactionRemovedCallback);

Return Value

null
< Previous | Next >