Use events method

Front-end events are actions on the product UI, such as button clicks and changes/updates to the UI field values. Events method is an interface that the developer platform provides, to enable your app to react to front-end events.

To enable your app to react to front-end events, in the app.js file,

  1. Subscribe to the app.initialized event, through an event listener. When the app is initialized, the parent application passes a client reference to the app.
  2. After app initialization,
    1. Use the client reference, subscribe to <Event name> and register a callback method to be executed when the event occurs.
    2. Define the callback method.

When the event occurs, a payload is passed to the callback method. Let us call this payload event. event.type returns the name of the event. The event.helper.getData() helper method returns a JSON object that contains information pertaining to the event. Your app logic can process this data into meaningful results.

Front-end events are of the following types: Click events, Change events, Intercept events.

Currently, for this module, only one click event is supported.

Common event

If your app is built to be deployed on the left_nav_cti placeholder, the app can react to the calling event when the corresponding event trigger occurs.

Event nameEvent trigger
callingWhen a user clicks the call icon or phone number link that is displayed on any of the following pages of the product UI:
  • Contact list page > Contact hover card > Make call widget
  • Contact list page > Work phone field
  • Contact details page > Work phone and Mobile fields
  • Contact details page > Make call widget

calling

Use the sample code shown on the right pane > Sample code tab, to enable your app to react to user clicks such as the click on a call icon or phone number, on the UI.