Skip to main content

Uniphore Customer Portal

Agent App Widget Events

While the widget runs, it triggers some events that the hosting page can listen to using the postmessage plugin. Each event also includes data relevant to the event.

Method

Return Value

Description

Example

registerEvent (eventName:string, callback ([event params]));

None

Registers an event with the callback that is invoked when the event is triggered.

agentApp.registerEvent('started', function(e) 
 {
  intid.value = e.objectInstanceId;
  instanceid = e.objectInstanceId;
});

getCurrentInstanceId()

string

Returns the instanceId of the currently selected tab.

function

getCurrentInstanceId()

{str = agentApp.

getCurrentInstanceId();

getActiveInteractionIds()

string

Returns an array of the InstanceIds of all the currently active Interactions (in all tabs of the widget).

function getCurrentInstanceId()
{
  str = agentApp.getCurrentInstanceId();
}

loadHistory (uniqueId:string, [tipText:string], [closeDelay:integer milliseconds],[loadHistory:boolean])

None

Opens a new History Flow tab. The string is a unique ID number of an Interaction instance. The following optional parameters are available:

  • tipText: This text is displayed in a tooltip over the new tab.

  • closeDelay: Closes the tooltip after the specified number of milliseconds passes.

  • loadHistory: This flag defines whether or not to switch to the History Flow tab after it is opened.

agentapp.loadHistory(0812002, "myTooltipDescription", 50);
Listening for Events

The table below lists and describes the events for which you can invoke a callback function. These events are used in conjunction with the registerEvent API.

Event Name

Arguments

Description

started

LoadedArgs

Fired when a new Interaction is started (either manually by the user, or by calling the Start Interaction API.

ended
instanceId:string

Fired when an Interaction is finished.

saved
instanceId:string

Fired when an Interaction is saved.

loaded

LoadedArgs

Fired just after a new page is loaded into the content area.

Note

This event is not supported in the Agent (History Only) Application.

onError

ResponseError

Fired whenever an error is about to be displayed. To suppress display of the error message box, return false from this handler.

LoadedArgs and ErrorArgs Object Specification

The LoadedArgs object can contain the following properties:

Property

Type

Description

objectId
string

Identifier of the Interaction.

objectInstanceId
string

Instance of the running Interaction.

navigationType
string

The navigation option that caused the page to appear:

  • Current
  • Next
  • Previous
page
PageObject

The entire page structure, as received from the X‑Platform Server.

designerId
string

ID of the Interaction (as defined in the X-Designer).

variableSet
Dictionary

Variables of the page.

lang
string

Language of the page.

userId
string

User ID of the page.

The ErrorArgs object can contain the following properties:

Property

Type

Description/Notes

error
ErrorObject

The error object parsed from the response text received from the X‑Platform Server.

objectInstanceId
string

Instance of the running Interaction.