|
|
Line 1: |
Line 1: |
| = API Commands = | | = 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|Documentation for this software has moved to a new home. Please update links and bookmarks to content hosted at https://all.docs.genesys.com/WID/Current/SDK/Engagement-combined#API_Commands.}} |
− | | |
− | {{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 [[Documentation:PSAAS:Administrator:GWCBusExtensions|Widgets Extensions]] for more information about extending Genesys Widgets.|1}} | |
− | | |
− | | |
− | <source lang='javascript'>var oMyPlugin = window._genesys.widgets.bus.registerPlugin('MyPlugin');
| |
− | | |
− | oMyPlugin.command('Engage.invite');</source>
| |
− | | |
− | == invite ==
| |
− | Opens the Engage Widget and renders the text based on the options provided. If no options are provided, it will not open.
| |
− | <br /><br />
| |
− | === Example ===
| |
− | <source lang='javascript'>
| |
− | 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;
| |
− | }
| |
− | | |
− | });
| |
− | </source>
| |
− | | |
− | <br />
| |
− | === 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.
| |
− | |-
| |
− | |}
| |
− | <br />
| |
− | === 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
| |
− | |-
| |
− | |}
| |
− | | |
| [[Category:V:PSAAS:Public]] | | [[Category:V:PSAAS:Public]] |