Revision as of 22:30, March 27, 2017 by Byee (talk | contribs) (API Commands)
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',{

	userData: {},
	firstname: 'Bob',
	lastname: 'Jones',
	email: 'b.jones@mail.com',
	subject: 'product questions',
	text: 'Good morning',
	email: 'b.jones@mail.com'

});

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', {

	userData: {},
	firstname: 'Bob',
	lastname: 'Jones',
	email: 'b.jones@mail.com',
	subject: 'product questions',
	text: 'Good morning',
	email: 'b.jones@mail.com'

}).done(function(e){

	// SendMessageService sent the form successfully

}).fail(function(e){

	// SendMessageService failed to send a form
});


Options

Option Type Description
firstName string Send Message Entry Form Data: 'First Name'.
lastName string Send Message Entry Form Data: 'Last Name'.
email string Send Message Entry Form Data: 'Email'.
subject string Send Message Entry Form Data: 'Subject'.
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.


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'
Comments or questions about this documentation? Contact us for support!