Jump to: navigation, search
(Created target blank page For Version: PSAAS:Julie)
 
(Automated save: adding PEC_Migrated template.)
 
Line 1: Line 1:
<!-- Creation of the target page -->
+
= API Commands =
 +
 
 +
{{Template:PEC_Migrated}}
 +
 
 +
 
 +
 
 +
Once you've registered your own plugin on the bus, you can call commands on other registered plugins. Below we'll quickly register a new plugin on the bus using the global bus object.
 +
 
 +
{{NoteFormat|The global bus object is a debug tool. When implementing Widgets on your own site, do not use the global bus object to register your custom plugins. Instead, see [[GWCBusExtensions|Widgets Extensions]] for more information about extending Genesys Widgets.|1}}
 +
 
 +
 
 +
<source lang='javascript'>var oMyPlugin = window._genesys.widgets.bus.registerPlugin('MyPlugin');
 +
 
 +
oMyPlugin.command('CoBrowse.start');</source>
 +
 
 +
== start ==
 +
Start a Co-browse session
 +
<br /><br />
 +
=== Example ===
 +
<source lang='javascript'>
 +
oMyPlugin.command('CoBrowse.start').done(function(e){
 +
 
 +
// Co-browse started a session successfully
 +
 
 +
}).fail(function(e){
 +
 
 +
// Co-browse failed to start a session
 +
});
 +
</source>
 +
 
 +
<br />
 +
=== Resolutions ===
 +
{|
 +
|-
 +
! Status
 +
! When
 +
! Returns
 +
|-
 +
| resolved
 +
| Co-browse API is available and used to start session
 +
| n/a
 +
|-
 +
| rejected
 +
| Co-browser API is not available
 +
| n/a
 +
|-
 +
|}
 +
== stop ==
 +
Stop the currently active Co-browse session
 +
<br /><br />
 +
=== Example ===
 +
<source lang='javascript'>
 +
oMyPlugin.command('CoBrowse.stop').done(function(e){
 +
 
 +
// Co-browse stopped a session successfully
 +
 
 +
}).fail(function(e){
 +
 
 +
// Co-browse failed to stop a session
 +
});
 +
</source>
 +
 
 +
<br />
 +
=== Resolutions ===
 +
{|
 +
|-
 +
! Status
 +
! When
 +
! Returns
 +
|-
 +
| resolved
 +
| Co-browse API is available and used to end the active session
 +
| n/a
 +
|-
 +
| rejected
 +
| Co-browser API is not available
 +
| n/a
 +
|-
 +
|}
 +
== configure ==
 +
Internal use only. The main App plugin shares configuration settings to widgets using each widget’s configure command. The configure command can only be called once at startup. Calling configure again after startup may result in unpredictable behavior.
 +
<br /><br />
 +
=== Example ===
 +
<source lang='javascript'>
 +
oMyPlugin.command('CoBrowse.configure', {
 +
 
 +
src: 'http://localhost:8080/foo/sample',
 +
url: 'http://localhost:8080/foo/bar'
 +
 
 +
}).done(function(e){
 +
 
 +
// Co-browse configured successfully
 +
 
 +
}).fail(function(e){
 +
 
 +
// Co-browse wasn't configured properly
 +
});
 +
</source>
 +
 
 +
<br />
 +
=== Options ===
 +
{|
 +
|-
 +
! Option
 +
! Type
 +
! Description
 +
|-
 +
| src
 +
| string
 +
| URL/Path to the Co-browse JavaScript package. Usually resides on the Co-browse server.
 +
|-
 +
| url
 +
| string
 +
| URL/Path to the Co-browse server endpoint
 +
|-
 +
|}
 +
<br />
 +
=== Resolutions ===
 +
{|
 +
|-
 +
! Status
 +
! When
 +
! Returns
 +
|-
 +
| resolved
 +
| When configuration options are provided and set
 +
| n/a
 +
|-
 +
| rejected
 +
| When no configuration options are provided
 +
| 'Invalid configuration'
 +
|-
 +
|}
 +
== open ==
 +
Opens the Co-browse UI.
 +
<br /><br />
 +
=== Example ===
 +
<source lang='javascript'>
 +
oMyPlugin.command('CoBrowse.open').done(function(e){
 +
 
 +
// Co-browse opened successfully
 +
 
 +
}).fail(function(e){
 +
 
 +
// Co-browse failed to open
 +
});
 +
</source>
 +
 
 +
<br />
 +
=== Resolutions ===
 +
{|
 +
|-
 +
! Status
 +
! When
 +
! Returns
 +
|-
 +
| resolved
 +
| When Co-browse is successfully opened
 +
| n/a
 +
|-
 +
| rejected
 +
| When Co-browse is already open
 +
| 'Already opened'
 +
|-
 +
|}
 +
== close ==
 +
Closes the Co-browse UI.
 +
<br /><br />
 +
=== Example ===
 +
<source lang='javascript'>
 +
oMyPlugin.command('CoBrowse.close').done(function(e){
 +
 
 +
// Co-browse closed successfully
 +
 
 +
}).fail(function(e){
 +
 
 +
// Co-browse failed to close
 +
});
 +
</source>
 +
 
 +
<br />
 +
=== Resolutions ===
 +
{|
 +
|-
 +
! Status
 +
! When
 +
! Returns
 +
|-
 +
| resolved
 +
| When Co-browse successfully closed
 +
| n/a
 +
|-
 +
| rejected
 +
| When Co-browse is already closed
 +
| 'Already closed'
 +
|-
 +
|}
 +
 
 +
[[Category:V:PSAAS:Julie]]

Latest revision as of 22:40, June 21, 2020

API Commands

Important
This content may not be the latest Genesys Engage cloud content. To find the latest content, go to Genesys Engage cloud for Administrators.



Once you've registered your own plugin on the bus, you can call commands on other registered plugins. Below we'll quickly register a new plugin on the bus using the global bus object.

Important
The global bus object is a debug tool. When implementing Widgets on your own site, do not use the global bus object to register your custom plugins. Instead, see Widgets Extensions for more information about extending Genesys Widgets.


var oMyPlugin = window._genesys.widgets.bus.registerPlugin('MyPlugin');

oMyPlugin.command('CoBrowse.start');

start

Start a Co-browse session

Example

oMyPlugin.command('CoBrowse.start').done(function(e){

	// Co-browse started a session successfully

}).fail(function(e){

	// Co-browse failed to start a session
});


Resolutions

Status When Returns
resolved Co-browse API is available and used to start session n/a
rejected Co-browser API is not available n/a

stop

Stop the currently active Co-browse session

Example

oMyPlugin.command('CoBrowse.stop').done(function(e){

	// Co-browse stopped a session successfully

}).fail(function(e){

	// Co-browse failed to stop a session
});


Resolutions

Status When Returns
resolved Co-browse API is available and used to end the active session n/a
rejected Co-browser API is not available n/a

configure

Internal use only. The main App plugin shares configuration settings to widgets using each widget’s configure command. The configure command can only be called once at startup. Calling configure again after startup may result in unpredictable behavior.

Example

oMyPlugin.command('CoBrowse.configure', {

	src: 'http://localhost:8080/foo/sample',
	url: 'http://localhost:8080/foo/bar'

}).done(function(e){

	// Co-browse configured successfully

}).fail(function(e){

	// Co-browse wasn't configured properly
});


Options

Option Type Description
src string URL/Path to the Co-browse JavaScript package. Usually resides on the Co-browse server.
url string URL/Path to the Co-browse server endpoint


Resolutions

Status When Returns
resolved When configuration options are provided and set n/a
rejected When no configuration options are provided 'Invalid configuration'

open

Opens the Co-browse UI.

Example

oMyPlugin.command('CoBrowse.open').done(function(e){

	// Co-browse opened successfully

}).fail(function(e){

	// Co-browse failed to open
});


Resolutions

Status When Returns
resolved When Co-browse is successfully opened n/a
rejected When Co-browse is already open 'Already opened'

close

Closes the Co-browse UI.

Example

oMyPlugin.command('CoBrowse.close').done(function(e){

	// Co-browse closed successfully

}).fail(function(e){

	// Co-browse failed to close
});


Resolutions

Status When Returns
resolved When Co-browse successfully closed n/a
rejected When Co-browse is already closed 'Already closed'
This page was last edited on June 21, 2020, at 22:40.
Comments or questions about this documentation? Contact us for support!