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('SendMessageService.sendForm',{

	formData: {
		firstName: 'Bob',
		lastName: 'Jones',
		email: 'b.jones@mail.com',
		subject: 'product questions',
		text: 'Good morning',
		email: 'b.jones@mail.com'
	},
	userData: {},
	files: []

});

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('SendMessage.configure', {

	formValidation: true,
	SendMessageButton:{

		enabled: false,
		openDelay: 1000,
		template: '<span>Done</span>',
		effect: 'fade',
		effectDuration: 1000
	}

}).done(function(e){

	// SendMessage configured successfully

}).fail(function(e){

	// Invalid configuration
});


Options

Option Type Description
formValidation boolean Enable/disable browser form validations.
SendMessageButton.enabled boolean Enable/disable Send Message button on screen.
SendMessageButton.template string Custom HTML string template for Send Message button.
SendMessageButton.effect string Type of animation effect when revealing Send Message button ('slide' or 'fade').
SendMessageButton.openDelay number Number of milliseconds before displaying send message button on screen.
SendMessageButton.effectDuration number Length of animation effect in milliseconds.


Resolutions

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

sendForm

Sends a Message with the Email server via GMS. Intended to be used by Send Message widgets only. Should not be invoked manually.

Example

oMyPlugin.command('SendMessageService.sendForm', {

	formData: {
		firstName: 'Bob',
		lastName: 'Jones',
		email: 'b.jones@mail.com',
		subject: 'product questions',
		text: 'Good morning'
	},
	userData: {},
	files: []

}).done(function(e){

	// SendMessageService sent the form successfully

}).fail(function(e){

	// SendMessageService failed to send a form
});


Options

Option Type Description
formData.firstName string Send Message Entry Form Data: 'First Name'.
formData.lastName string Send Message Entry Form Data: 'Last Name'.
formData.email string Send Message Entry Form Data: 'Email'.
formData.subject string Send Message Entry Form Data: 'Subject'.
formData.text string Send Message Entry Form Data for message body content.
files array Array of file objects containing the attached files.Intended to be used by Send Message widgets only.
userData object Arbitrary data to attach to the message (AKA attachedData). Properties defined here will be merged with default userData set in the configuration object. If Genesys Web Engagement (GWE) is enabled, this userData also includes visitID, globalVisitID and pageID.


Resolutions

Status When Returns
resolved When server confirms message sent (AJAX Response Object)
rejected When a browser does not support HTML5 form attachments 'No HTMl5 formData support on your browser'
rejected When no form data passed 'No formData found'
This page was last edited on February 5, 2018, at 13:11.
Comments or questions about this documentation? Contact us for support!