Jump to: navigation, search
(Created target blank page For Version: PSAAS:Public)
 
(Update with the copy of version: draft)
Line 1: Line 1:
<!-- Creation of the target page -->
+
= 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.
 +
 
 +
{{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('CallbackService.schedule', {
 +
 
 +
userData: {},
 +
firstname: 'Bob',
 +
lastname: 'Jones',
 +
email: 'b.jones@mail.com',
 +
subject: 'product questions',
 +
desiredTime: '2017-04-04T00:24:17.804Z',
 +
email: 'b.jones@mail.com',
 +
phonenumber: '4151110000'
 +
});</source>
 +
 
 +
== 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('CallbackService.configure', {
 +
 
 +
apikey: '123456',
 +
dataURL: 'http://localhost:8080/foo/bar',
 +
ajaxTimeout: 10000,
 +
userData: {}
 +
 
 +
}).done(function(e){
 +
 
 +
// CallbackService configured successfully
 +
 
 +
}).fail(function(e){
 +
 
 +
// CallbackService failed to configure properly
 +
});
 +
</source>
 +
 
 +
<br />
 +
=== Options ===
 +
{|
 +
|-
 +
! Option
 +
! Type
 +
! Description
 +
|-
 +
| apikey
 +
| string
 +
| Apigee Proxy secure token
 +
|-
 +
| dataURL
 +
| URL String
 +
| URL of GMS callback server
 +
|-
 +
| callDirection
 +
| string
 +
| Holds the GMS callback server call direction parameter
 +
|-
 +
| userData
 +
| object
 +
| Arbitrary JSON attached data to include when scheduling a callback
 +
|-
 +
| ajaxTimeout
 +
| number
 +
| Number of milliseconds to wait before AJAX timeout
 +
|-
 +
|}
 +
<br />
 +
=== Resolutions ===
 +
{|
 +
|-
 +
! Status
 +
! When
 +
! Returns
 +
|-
 +
| resolved
 +
| When configuration options are provided and set
 +
| n/a
 +
|-
 +
| rejected
 +
| When no configuration options are provided
 +
| 'Invalid configuration'
 +
|-
 +
|}
 +
== schedule ==
 +
Schedule a callback service with the GMS callback schedule API.
 +
<br /><br />
 +
=== Example ===
 +
<source lang='javascript'>
 +
oMyPlugin.command('CallbackService.schedule', {
 +
 
 +
userData: {},
 +
firstname: 'Bob',
 +
lastname: 'Jones',
 +
email: 'b.jones@mail.com',
 +
subject: 'product questions',
 +
desiredTime: '2017-03-03T00:24:17.804Z',
 +
email: 'b.jones@mail.com',
 +
phonenumber: '4151110000'
 +
 
 +
}).done(function(e){
 +
 
 +
// CallbackService scheduled successfully
 +
 
 +
}).fail(function(e){
 +
 
 +
// CallbackService failed to schedule
 +
});
 +
</source>
 +
 
 +
<br />
 +
=== Options ===
 +
{|
 +
|-
 +
! Option
 +
! Type
 +
! Description
 +
|-
 +
| firstname
 +
| string
 +
| Receive a Call entry Form Data: 'firstname'.
 +
|-
 +
| lastname
 +
| string
 +
| Receive a Call entry Form Data: 'lastname'.
 +
|-
 +
| phonenumber
 +
| string
 +
| Receive a Call entry Form Data: 'phonenumber'.
 +
|-
 +
| subject
 +
| string
 +
| Receive a Call entry Form Data: 'notes'.
 +
|-
 +
| email
 +
| string
 +
| Receive a Call entry Form Data: 'email'.
 +
|-
 +
| desiredtime
 +
| string
 +
| The preferred desired time user would like to get the callback scheduled. Time should be in UTC format.
 +
|-
 +
| userData
 +
| object
 +
| Arbitrary data that is to be attached with callback schedule. Properties defined here will be merged with default userData set in the configuration object.
 +
|-
 +
|}
 +
<br />
 +
=== Resolutions ===
 +
{|
 +
|-
 +
! Status
 +
! When
 +
! Returns
 +
|-
 +
| resolved
 +
| When server confirms callback is scheduled.
 +
| (AJAX Response Object)
 +
|-
 +
| rejected
 +
| When selected timeslot is not available.
 +
| (AJAX Response Object)
 +
|-
 +
| rejected
 +
| When AJAX exception occurs.
 +
| (AJAX Response Object)
 +
|-
 +
| rejected
 +
| When server exception occurs.
 +
| (AJAX Response Object)
 +
|-
 +
| rejected
 +
| When no form data is found to schedule callback.
 +
| 'No data found to schedule callback'
 +
|-
 +
|}
 +
== availability ==
 +
Get the list of available callback timeslots via GMS callback service.
 +
<br /><br />
 +
=== Example ===
 +
<source lang='javascript'>
 +
oMyPlugin.command('CallbackService.availability', {
 +
 
 +
startDate: '2017-04-03T00:24:17.804Z',
 +
numberOfDays: '5',
 +
maxTimeSlots: 20
 +
 
 +
}).done(function(e){
 +
 
 +
// CallbackService successfully showing availability
 +
 
 +
}).fail(function(e){
 +
 
 +
// CallbackService failed to show availability
 +
});
 +
</source>
 +
 
 +
<br />
 +
=== Options ===
 +
{|
 +
|-
 +
! Option
 +
! Type
 +
! Description
 +
|-
 +
| startDate
 +
| string
 +
| The start date is specified in ISO 8601 format, using UTC as the timezone (yyyy-MM-ddTHH:mm:ss.SSSZ).
 +
|-
 +
| endDate
 +
| string
 +
| The end date is specified in ISO 8601 format, using UTC as timezone (yyyy-MM-ddTHH:mm:ss.SSSZ). If neither endDate nor numberOfDays is specified, the end date is assumed to be the same as the start date.
 +
|-
 +
| numberOfDays
 +
| string
 +
| Used as an alternative to the end date. If neither endDate nor numberOfDays is specified, the end date is assumed to be the same as the start date.
 +
|-
 +
| maxTimeSlots
 +
| number
 +
| The maximum number of time slots to be included in the response.
 +
|-
 +
|}
 +
<br />
 +
=== Resolutions ===
 +
{|
 +
|-
 +
! Status
 +
! When
 +
! Returns
 +
|-
 +
| resolved
 +
| When server confirms the list of available callback timeslots.
 +
| (AJAX Response Object)
 +
|-
 +
| rejected
 +
| When timeslots are available for selected period.
 +
| (AJAX Response Object)
 +
|-
 +
| rejected
 +
| When AJAX exception occurs.
 +
| (AJAX Response Object)
 +
|-
 +
| rejected
 +
| When server exception occurs.
 +
| (AJAX Response Object)
 +
|-
 +
| rejected
 +
| When no query data is found.
 +
| 'No query parameters passed for callback availability service'
 +
|-
 +
|}
 +
 
 +
[[Category:V:PSAAS:Public]]

Revision as of 14:51, August 25, 2017

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('CallbackService.schedule', {

	userData: {},
	firstname: 'Bob',
	lastname: 'Jones',
	email: 'b.jones@mail.com',
	subject: 'product questions',
	desiredTime: '2017-04-04T00:24:17.804Z',
	email: 'b.jones@mail.com',
	phonenumber: '4151110000'
});

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

	apikey: '123456',
	dataURL: 'http://localhost:8080/foo/bar',
	ajaxTimeout: 10000,
	userData: {}

}).done(function(e){

	// CallbackService configured successfully

}).fail(function(e){

	// CallbackService failed to configure properly
});


Options

Option Type Description
apikey string Apigee Proxy secure token
dataURL URL String URL of GMS callback server
callDirection string Holds the GMS callback server call direction parameter
userData object Arbitrary JSON attached data to include when scheduling a callback
ajaxTimeout number Number of milliseconds to wait before AJAX timeout


Resolutions

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

schedule

Schedule a callback service with the GMS callback schedule API.

Example

oMyPlugin.command('CallbackService.schedule', {

	userData: {},
	firstname: 'Bob',
	lastname: 'Jones',
	email: 'b.jones@mail.com',
	subject: 'product questions',
	desiredTime: '2017-03-03T00:24:17.804Z',
	email: 'b.jones@mail.com',
	phonenumber: '4151110000'

}).done(function(e){

	// CallbackService scheduled successfully

}).fail(function(e){

	// CallbackService failed to schedule
});


Options

Option Type Description
firstname string Receive a Call entry Form Data: 'firstname'.
lastname string Receive a Call entry Form Data: 'lastname'.
phonenumber string Receive a Call entry Form Data: 'phonenumber'.
subject string Receive a Call entry Form Data: 'notes'.
email string Receive a Call entry Form Data: 'email'.
desiredtime string The preferred desired time user would like to get the callback scheduled. Time should be in UTC format.
userData object Arbitrary data that is to be attached with callback schedule. Properties defined here will be merged with default userData set in the configuration object.


Resolutions

Status When Returns
resolved When server confirms callback is scheduled. (AJAX Response Object)
rejected When selected timeslot is not available. (AJAX Response Object)
rejected When AJAX exception occurs. (AJAX Response Object)
rejected When server exception occurs. (AJAX Response Object)
rejected When no form data is found to schedule callback. 'No data found to schedule callback'

availability

Get the list of available callback timeslots via GMS callback service.

Example

oMyPlugin.command('CallbackService.availability', {

	startDate: '2017-04-03T00:24:17.804Z',
	numberOfDays: '5',
	maxTimeSlots: 20

}).done(function(e){

	// CallbackService successfully showing availability

}).fail(function(e){

	// CallbackService failed to show availability
});


Options

Option Type Description
startDate string The start date is specified in ISO 8601 format, using UTC as the timezone (yyyy-MM-ddTHH:mm:ss.SSSZ).
endDate string The end date is specified in ISO 8601 format, using UTC as timezone (yyyy-MM-ddTHH:mm:ss.SSSZ). If neither endDate nor numberOfDays is specified, the end date is assumed to be the same as the start date.
numberOfDays string Used as an alternative to the end date. If neither endDate nor numberOfDays is specified, the end date is assumed to be the same as the start date.
maxTimeSlots number The maximum number of time slots to be included in the response.


Resolutions

Status When Returns
resolved When server confirms the list of available callback timeslots. (AJAX Response Object)
rejected When timeslots are available for selected period. (AJAX Response Object)
rejected When AJAX exception occurs. (AJAX Response Object)
rejected When server exception occurs. (AJAX Response Object)
rejected When no query data is found. 'No query parameters passed for callback availability service'
Comments or questions about this documentation? Contact us for support!