From Bright Pattern Documentation
Jump to: navigation, search
This page contains changes which are not marked for translation.
• 5.19


This handler will be invoked when it’s time to save the activity record for completed interaction. This event includes all data about the interaction (identical to the interaction data from the onInteractionEnd callback).



on('ON_SAVE_ACTIVITY_RECORD', handler: OnSaveActivityRecordHandler): void

type OnSaveActivityRecordHandler = (activity: 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" |


type InteractionOrigination =

    "dialpad" |

    "dialpad-search" |

    "directory" |

    "recent" |

    "favorites" |

    "workitem" |

    "interaction" |

    "contact-profile" |

    "help" |

    "conference" |

    "auto" |


type CallDirection = "inbound" | "outbound"

type CallParty = {

  id: string

  name: string

  phone: string

  userId?: string



Parameter Parameter Values Data Type Optional/Required Description
interactioninteractionId String Required The ID of the interaction that ended
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

function saveActivityRecordCallback(activity: InteractionData) {



adApi.on("ON_SAVE_ACTIVITY_RECORD", saveActivityRecordCallback);

Return Value


< Previous | Next >