Revision as of 19:04, December 15, 2015 by KrisMcG (talk | contribs) (Created page with "= Widget Bus API Overview= __NOTOC__ <!--CX Widget plugins, such as WebChat, use the CXBus Protocol to expose their communication and control API. See [https://intranet.genesy...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Widget Bus API Overview

The WebChat API comprises two components:

The API events and commands are analogous to standard events and methods with one main difference: events and commands are executed asynchronously utilizing deferred methods.

For the following examples, let's use the CXConsole. The CXConsole is an exposed CXBus interface that allows you to invoke commands and subscribe to events. The CXConsole is accessible globally at this location:

window._genesys.cxwidget.console

Let's assume the console is saved to the var CXConsole = window._genesys.cxwidget.console; local variable.

Example 1: Subscribing to an Event

Format: CXBusInterface.subscribe("event name and path", function(){})

Example:

CXConsole.subscribe("cx.plugin.WebChat.ready", function(){});

Example 2: Invoking a Command

Format: CXBusInterface.command("command name and path", options).done(function).fail(function)

Example:

CXConsole.command("cx.plugin.WebChat.open", {}).done(function(e){

	// success scenario

}).fail(function(e){

	// failure scenario: error, exception, improper arguments
})

Comments or questions about this documentation? Contact us for support!