Skip to main content

Introduction

The Widget API enables third-party developers to write custom widgets and deploy them in Avaya Workspaces. To write a custom widget, you need access to the Widget API Developer Documentation and code examples. The Widget API is designed to make it easier for anyone with a basic understanding of HTML, CSS, and JavaScript to write a custom widget and deploy it in Avaya Workspaces.

The following section provides descriptions and examples of each method in the Widget API. The examples are provided to give a deeper understanding on how each method behaves. You can use alternative JavaScript patterns at your discretion.

note

When using the Widget API, please be aware that not all of the methods and events listed are available in both AXP and AXP Connect. We have denoted each method and event with either AXP or AXP Connect or both to show if the method is supported or not. Please refer to these when selecting which methods and events to use.

note

Ensure that events marked as Requires Interaction have an interaction context. Any widget leveraging these events must be placed on an Interaction related tab.

Constructor#

You can use the constructor method to initialize the Widget API (see examples in the sample widget library).

note

The following code blocks show you how to create an instance of the widget API. If no interaction ID is provided, the API will only work for events and methods that do not require an interaction context. There will be no interaction ID attribute on the widget if the widget is placed in the Home layout.

The constructor returns a reference to the Widget API object which can then be used to make API calls. The params object must be passed automatically during the initialization stage of the widgetContainer (see code examples provided in the sample widget library):

const api = (<any>window).WS.widgetAPI();

An optional interactionId can be passed to the constructor to associate the instance with a particular interaction:

const api = (<any>window).WS.widgetAPI(interactionId);
note

The interaction ID attribute as shown in the example below is all lowercase - interactionid, whereas Workspaces 3.x provided attributes in snake case. Please ensure this is updated if you are porting over widgets from Workspaces 3.x as otherwise the events and methods will not work as expected.

A widget can get access to the interaction ID by using the following code block:

const interactionId = this.getAttribute('interactionid')