Revision as of 18:15, April 17, 2019 by Djudge (talk | contribs) (Update with the copy of version: draft)
Jump to: navigation, search

API Commands

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('Engage.invite');

invite

Opens the Engage Widget and renders the text based on the options provided. If no options are provided, it will not open.

Example

oMyPlugin.command('Engage.invite', {
	'type':'toast',
	'timeout':3000,
	'title':'Engagement Title',
	'body':'Engagement invite body content',
	'accept':'Yes',
	'decline':'No, thanks',
	'command': 'WebChat.open',
	'options':{'proactive'; true, 'userData': {'category': 'shoes'}}
});

oMyPlugin.command('Engage.invite',{
	'type':'toast',
	'timeout':3000,
	'title':'Engagement Title',
	'body':'Engagement invite body content',
	'accept':'Yes',
	'decline':'No, thanks'
}).done(function(response){

	// Act upon the received response code 

	switch(response){
	case 'accepted':oMyPlugin.command('WebChat.open'); 
			break;
	case 'declined': break;
	case 'closed': break;
	case 'timeout': break;
}

});


Options

Option Type Description
type string Widget display type.
timeout number Timeout integer in milliseconds.
title string String for widget title.
body string String for offer body text.
accept string String for Accept button text.
decline string String for Decline button text.
command string Command to execute.
options object Options related to the command provided.


Resolutions

Status When Returns
resolved When engage invite is accepted by user. accepted
resolved When engage invite is declined by user. declined
resolved When engage invite widget is closed by user. closed
resolved When engage invite widget closes due to timeout. timeout
Comments or questions about this documentation? Contact us for support!