Contents
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');configure
Configure the widget.
Example
oMyPlugin.command('SendMessageService.configure', {
apikey: '123456',
dataURL: 'http://localhost:8080/foo/mygms',
ajaxTimeout: 10000,
userData: {}
}).done(function(e){
// SendMessageService configured successfully
}).fail(function(e){
// SendMessageService failed to configure
});
Options
| Option | Type | Description |
|---|---|---|
| apikey | string | Apigee Proxy secure token |
| dataURL | URL String | URL of GMS server |
| ajaxTimeout | number | Number of milliseconds to wait before AJAX timeout |
| userData | object | Arbitrary JSON data to attach to the message. |
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', {
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'. |
| 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!
