Widget API Events
The Widget API exposes the onDataEvent method to allow widgets to subscribe to various data events delivered by Workspaces.
note
Events marked as Requires Interaction require an interaction context. Any Widget leveraging these events must be placed on an Interaction related tab (for example, Customer Details).
#
onAgentStateEventThis event is triggered whenever the agent state changes. This event provides information to widgets on the current state and reason codes as well as the agent's current capabilities.
Payload
#
onAnyInteractionEndedEventThis event is triggered when any work card (interaction) has been ended.
Payload
#
onAnyInteractionEventThis event is triggered when any new work card (interaction) appears in Workspaces. It is also triggered each time any interaction is updated.
This event is designed to be used by widgets that wish to listen out for all interaction events.
note
If multiple interactions are updated or created at the same time then this event will fire multiple times.
Payload
#
onCapabilitiesEventThis event is triggered when the agent or interaction capabilities have been updated.
note
You can also use the getCapabilities API method to retrieve the latest capabilities at any time.
Payload
#
onCardFocusedEventThis event is triggered when the interaction is focused.
See the hello-world sample widget for further demonstration.
#
onChannelStatusUpdateEventThis event is triggered when the status of a channel on a Custom State Panel gets updated.
Payload
#
onContextDataEventThis event is triggered when customer and context data is available in Chat, SMS, Messaging, Email and Social work cards. You can use this event to obtain customer details and customer history data from Chat, SMS, Messaging, Email and Social interactions.
note
Here you can retrieve max allowed characters limitations (which is best to manage in your widget) using clientValidation
array passed within common data object. Depending on your interaction channel (Chat, SMS or Social) you are going to get different validation entries with data.type field equal to WEBCHAT_MAX_CHAR
, SMS_MAX_CHAR
or SOCIAL_MAX_CHAR
respectively.
note
Requires Interaction
Payload
#
onCustomCardEndedEventThis event is triggered when a custom interaction has been ended.
Payload
#
onEmailAttachmentUploadEventThis event is triggered after an email attachment upload to the server has been completed.
note
Requires Interaction
Payload
#
onInteractionEndedEventThis event is triggered when a work card (interaction) has been ended. This occurs for all interaction types.
note
Requires Interaction
note
This event is only useful when ACW is enabled so that the widget can be used to trigger some custom logic when an interaction has ended. Otherwise, as per usual, the widget is destroyed once the interaction has ended. If this is seen as a limitation to your widget development, you can try using the onAnyInteractionEndedEvent which fires when any interaction has ended.
note
This client side only event is quite limited as the backend does not support an ENDED interaction state, only ALERTING, ACTIVE, and HELD. Therefore, you will see that the event is triggered in the following scenarios for Voice:
- Agent ends the call.
- Customer ends the call.
- Call is blind transferred (single step transfer).
- Agent A consults Agent B, then Agent A completes as conference (in this case the interactionType can be used to check for a value of 'CONSULTING').
- Agent A consults Agent B, then Agent A completes as transfer (same as above, the interactionType can be used if required).
Payload
#
onInteractionEventThis event is triggered when a new work card (interaction) appears in Workspaces. It is also triggered each time the interaction is updated.
The state
property can be used to determine what state the interaction is currently in (for example, ALERTING, ACTIVE, HELD).
note
Requires Interaction
Payload
#
onInteractionTabChangeThis event is triggered whenever the agent/supervisor switches the tab between customer and mentor so that we can put control over the templates and messages.
Payload
#
onMediaEventThis event is triggered when an incoming Chat, SMS, Messaging, Email or Social interaction is accepted by the user (Agent/Supervisor). You can use this event to obtain Chat, SMS, Messaging, Email or Social related data such as participants or previously sent media messages.
note
Requires Interaction
Payload
#
onMediaMessageEventThis event is triggered when incoming Chat, SMS, Messaging, Social or Email messages are sent to the user (Agent/Supervisor). You can use this event to obtain Chat, SMS, Messaging or Social messages and pass them to the widget. In the case of Email, data is received as a single Email message and it can contain data formatted as text or HTML.
note
Requires Interaction
Payload
#
onMessageEventThis event is triggered when other widgets broadcast a data message by using the sendMessage or sendMessageToAnyWidget API methods. This event is used primarily for inter-widget communication.
This event returns anything that is sent via the sendMessage or sendMessageToAnyWidget API methods
#
onNavigationEventThis event is triggered whenever an icon in the sidebar is clicked. This event can inform widgets whenever the user navigates or selects a sidebar icon.
Payload
#
onParticipantsAddedThis event is triggered when a participant is added to an interaction.
note
Requires Interaction
Payload
#
onRequestServicesEventThis event is triggered whenever there is a call to get latest services.
Payload
#
onResourceAcquiredEventThis event is triggered when resource is acquired. The object that is returned from this event is the acquired resource object.
Payload
#
onResourceReleasedEventThis event is triggered when resource is released. The object that is returned from this event is the released resource object.
Payload
#
onSSOTokenRefreshEventThis event is triggered when the SSO token is refreshed.
#
onTeamMemberEventThis event is triggered when a Team member event occurs. A Team member event consists of the following instances:
- An agent activates.
- A supervisor group is changed/updated by adding a new user into that supervisor group.
- An agent's state changes.
- In the case of a supervisor monitoring an agent, an event is also triggered when the state of an interaction is changed.
The object that is returned from this event is the agent object.
Payload
#
onUserTypingEventThis event is triggered when a user starts typing into the messenger input.
Payload