From Bright Pattern Documentation
onInteractionRemoved
This handler is invoked after the end of an agent's interaction. This event includes all data about the completed interaction. Only applicable to Communicator Widget 2.0.
Request
Syntax
| on('ON_INTERACTION_REMOVED', handler: OnInteractionRemovedHandler): void
type OnInteractionRemovedHandler = (removedInteraction: InteractionData) => void 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
| Parameter | Parameter Values | Data Type | Optional/Required | Description |
| interaction | ||||
| type | String | Required | Indicates the interaction type; recognized types are as follows:
| |
| 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:
| |
| chatParties | ChatParty[] | Required | Provides a list of chat parties. Note that this applies to interactions where type is "chat". Where:
| |
| 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:
Note that this applies to interactions where type is "voice". | |
| internal | Boolean | Required | Indicates is interaction 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. |
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