Difference between revisions of "PEC-Developer/Current/SCAPI/ServiceClientAPI"

From Genesys Documentation
Jump to: navigation, search
(Published)
(Published)
Line 1: Line 1:
{{Article  
+
{{Article
|Standalone=No
+
|Standalone=No
|ComingSoon=No  
+
|DisplayName=Service Client API
|DisplayName=Service Client API  
+
|TocName=Service Client API
|Platform=GenesysEngage-cloud
 
|TocName=Service Client API  
 
 
|Context=Learn how to use the Service Client API to customize the way your web application integrates with Agent Desktop.
 
|Context=Learn how to use the Service Client API to customize the way your web application integrates with Agent Desktop.
 +
|ComingSoon=No
 +
|Platform=GenesysEngage-cloud
 
|Section={{Section
 
|Section={{Section
|Status=No
 
|sectionHeading=
 
|anchor=
 
|alignment=Vertical
 
|structuredtext={{NoteFormat|You must contact your Genesys representative to configure Agent Desktop to use the Service Client API.|1}}
 
|Media=No
 
|structuredtextwide=
 
}}
 
{{Section
 
|sectionHeading=API overview
 
|Media=No
 
|anchor=APIoverview
 
 
|alignment=Vertical
 
|alignment=Vertical
|structuredtext=
+
|structuredtext={{NoteFormat|You must contact your Genesys representative to configure Agent Desktop to use the Service Client API.|1}}Use the Service Client API to customize how your web application or website integrates with Agent Desktop. This JavaScript API is based on window.postMessage and provides methods your application can use to communicate cross domain with Agent Desktop while maintaining secured isolation.
You can use the Service Client API to customize how your web application or website integrates with Agent Desktop. This JavaScript API is based on window.postMessage and provides methods your application can use to communicate cross domain with Agent Desktop while maintaining secured isolation.
 
 
 
You can use the Service Client API to perform the following actions:
 
 
 
*{{Link-SomewhereInThisManual|topic=ServiceClientAPI|anchor=Controlling_Call_Recording_from_a_Third-Party_Application|display text=Controlling call recording from a third-party application}}
 
*{{Link-SomewhereInThisManual|topic=ServiceClientAPI|anchor=Embedding_Multiple_Third-Party_Applications_in_Agent_Desktop|display text=Embedding multiple third-party applications in Agent Desktop}}
 
*{{Link-SomewhereInThisManual|topic=ServiceClientAPI|anchor=Updating_Attached_Data_from_a_Third-Party_Application|display text=Updating attached data from a third-party application}}
 
*{{Link-SomewhereInThisManual|topic=ServiceClientAPI|anchor=Enabling_Click-to-Dial_from_a_Third-Party_Application|display text=Enabling click-to-dial from a third-party application}}
 
*{{Link-SomewhereInThisManual|topic=ServiceClientAPI|anchor=Enabling_Service_Client_API_to_invoke_toast_in_Agent_Desktop|display text=Enabling Service Client API to invoke toast in Agent Desktop}}
 
*{{Link-SomewhereInThisManual|topic=ServiceClientAPI|anchor=Controlling_Case_Selection_from_a_Third_Party_Application|display text=Controlling Case Selection from a Third Party Application}}
 
 
 
===Controlling call recording from a third-party application===
 
Review the following methods for details about call recording control:
 
* {{Link-SomewhereInThisManual|topic=VoiceNamespace|anchor=pauseCallRecording|display text=pauseCallRecording}}
 
* {{Link-SomewhereInThisManual|topic=VoiceNamespace|anchor=resumeCallRecording|display text=resumeCallRecording}}
 
* {{Link-SomewhereInThisManual|topic=VoiceNamespace|anchor=startCallRecording|display text=startCallRecording}}
 
* {{Link-SomewhereInThisManual|topic=VoiceNamespace|anchor=stopCallRecording|display text=stopCallRecording}}
 
 
 
The call recording state is stored in the <tt>recordingState</tt> attribute on the {{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=Interaction|display text=interaction.Interaction}} object.
 
 
 
===Embedding multiple third-party applications in Agent Desktop===
 
You can now set the interaction.web-content option to a list of option section names that correspond to web extension views. This means that you can configure Agent Desktop to include more than one third-party web application, displayed as either a tab, a popup window, in the background at the interaction level, or hidden.
 
 
 
You should also make sure that the service-client-api.accepted-web-content-origins option references all the websites that should use the Service Client API.
 
 
 
Contact your Genesys representative to enable embedding multiple third-party applications in Agent Desktop.
 
 
 
===Updating attached data from a third-party application===
 
Review the following methods for details about updating attached data:
 
* {{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=deleteUserData|display text=deleteUserData}}
 
* {{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=getByInteractionId|display text=getByInteractionId}}
 
* {{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=getInteractions|display text=getInteractions}}
 
* {{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=setUserData|display text=setUserData}}
 
 
 
The user data is stored in the <tt>userData</tt> attribute on the {{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=Interaction|display text=interaction.Interaction}} object.
 
 
 
You should also be sure to configure the options related to user data in the {{Link-AnywhereElse|product=PEC-AS|version=Current|manual=ManageCC|topic=Service_Client_options|display text=Service Client section of Agent Setup}} to enable read and write access to user data.
 
 
 
===Enabling click-to-dial from a third-party application===
 
If you configure Agent Desktop to display your web application in a new tab in the Agent Desktop user interface, then the service API only gives access to the {{Link-SomewhereInThisManual|topic=VoiceNamespace|anchor=dial|display text=dial}} operation.
 
 
 
===Enabling Service Client API to invoke toast in Agent Desktop===
 
 
 
Review the following methods for details about enabling and updating toast:
 
 
 
*{{Link-SomewhereInThisManual|topic=SystemNamespace|anchor=top|display text=system.popupToast}}
 
*{{Link-SomewhereInThisManual|topic=SystemNamespace|anchor=top|display text=system.updateToast}}
 
*{{Link-SomewhereInThisManual|topic=SystemNamespace|anchor=top|display text=system.closeToast}}
 
 
 
===Controlling case selection from a  third-party application===
 
 
 
Review the following method for details about case selecting control:
 
 
 
*{{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=top|display text=selectCaseByCaseId}}
 
 
 
The case selection state is stored in the ''isCaseSelected'' attribute and the ''isCaseExpanded'' attribute on the '''interaction.Interaction''' object.
 
 
 
{{AnchorDiv|GettingStarted}}
 
 
 
|fullwidth=No
 
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
 
|sectionHeading=Getting started
 
|sectionHeading=Getting started
|Media=No
+
|anchor=GettingStarted
|anchor=Gettingstarted
 
 
|alignment=Vertical
 
|alignment=Vertical
|structuredtext=
+
|structuredtext=Here's an overview of the steps to access the API:
Here's an overview of the steps you should to follow to access the API:
+
 
 
#You have a web application that you've integrated in Agent Desktop&mdash;contact your Genesys representative to enable integration of web applications in Agent Desktop.
 
#You have a web application that you've integrated in Agent Desktop&mdash;contact your Genesys representative to enable integration of web applications in Agent Desktop.
 
#Download the sample application [https://github.com/GenesysPureEngage/workspace-development-kit/tree/master/wwe-service-client-api/api-overview from GitHub].
 
#Download the sample application [https://github.com/GenesysPureEngage/workspace-development-kit/tree/master/wwe-service-client-api/api-overview from GitHub].
Line 104: Line 31:
 
#*{{Link-SomewhereInThisManual|topic=OutboundNamespace|anchor=top|display text=Outbound Namespace}}
 
#*{{Link-SomewhereInThisManual|topic=OutboundNamespace|anchor=top|display text=Outbound Namespace}}
 
#*{{Link-SomewhereInThisVersion|manual=SCAPI|topic=AuthNamespace}}
 
#*{{Link-SomewhereInThisVersion|manual=SCAPI|topic=AuthNamespace}}
 
+
#See {{Link-SomewhereInThisVersion|manual=SCAPI|topic=ServiceClientAPI|anchor=common|display text=Common actions with Service Client API}} for ideas about how to use the API.
|fullwidth=No
 
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
 
|sectionHeading=Working with the API
 
|sectionHeading=Working with the API
|Media=No
 
 
|anchor=WorkingwiththeAPI
 
|anchor=WorkingwiththeAPI
 
|alignment=Vertical
 
|alignment=Vertical
|structuredtext=
+
|structuredtext=After you've completed the setup and security steps, you're ready to start working with the Service Client API. The first thing you need to do is add a <code><nowiki><script></nowiki></code> tag to your web application that points to the '''wwe-service-client-api.js''' file (remember, you stored it somewhere accessible in Step 3 above).
After you've completed the setup and security steps, you're ready to start working with the Service Client API. The first thing you need to do is add a <tt><nowiki><script></nowiki></tt> tag to your web application that points to the '''wwe-service-client-api.js''' file (remember, you stored it somewhere accessible in Step 3 above).
 
  
Now you can access the API through the '''genesys.wwe.service''' namespace. For example:
+
Now you can access the API through the '''genesys.wwe.service''' namespace. For example:<source lang="html4strict">
<source lang="html4strict">
 
 
<html>
 
<html>
 
<head>
 
<head>
Line 145: Line 68:
 
</body>
 
</body>
 
</html>
 
</html>
</source>
+
</source>Here's an example of how you could modify attached data:<source lang="javascript">
 
 
Here's an example of how you could modify attached data:
 
<source lang="javascript">
 
 
genesys.wwe.service.interaction.setUserData("1",
 
genesys.wwe.service.interaction.setUserData("1",
 
{
 
{
Line 154: Line 74:
 
MyKEY2: "MyValue2"
 
MyKEY2: "MyValue2"
 
})
 
})
</source>
+
</source>In the above example, the request is {{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=setUserData|display text=interaction.setUserData}} and the parameters are the <code>interactionId</code> of <code>1</code> and the <code>keyValues</code> of <code>MyKEY1</code> and <code>MyKEY2</code>.
 
+
All methods provided in the Service Client API are asynchronous, so to get the successful or failed result, just add the matching callback:<source lang="javascript">
In the above example, the request is {{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=setUserData|display text=interaction.setUserData}} and the parameters are the <tt>interactionId</tt> of <tt>1</tt> and the <tt>keyValues</tt> of <tt>MyKEY1</tt> and <tt>MyKEY2</tt>.
 
 
 
All methods provided in the Service Client API are asynchronous, so to get the successful or failed result, just add the matching callback:
 
<source lang="javascript">
 
 
genesys.wwe.service.interaction.setUserData("1",
 
genesys.wwe.service.interaction.setUserData("1",
 
{
 
{
Line 169: Line 85:
 
console.debug("FAILED, result: " + JSON.stringify(result, null, '\t'));
 
console.debug("FAILED, result: " + JSON.stringify(result, null, '\t'));
 
})
 
})
</source>
+
</source>The global template for a service call is:<source lang="javascript">
 
 
The global template for a service call is:
 
<source lang="javascript">
 
 
genesys.wwe.service.<Service name>.<Service function>(<... function parameters ...>, [<optional done() callback>, [<optional fail() callback>]]);
 
genesys.wwe.service.<Service name>.<Service function>(<... function parameters ...>, [<optional done() callback>, [<optional fail() callback>]]);
</source>
+
</source>The <code>done()</code> callback is called when a request is successfully sent without an error.
 
 
The <tt>done()</tt> callback is called when a request is successfully sent without an error.
 
  
The <tt>fail()</tt> callback is called when a request generates an error or an exception.
+
The <code>fail()</code> callback is called when a request generates an error or an exception.
  
 
The result of these functions is provided in a JSON object as a unique parameter.
 
The result of these functions is provided in a JSON object as a unique parameter.
 
 
===Notifications===
 
===Notifications===
You can use the following code to subscribe to '''agent''' and '''interaction''' notifications:
+
You can use the following code to subscribe to '''agent''' and '''interaction''' notifications:<source lang="javascript">
<source lang="javascript">
 
 
function eventHandler(message)
 
function eventHandler(message)
 
{
 
{
Line 191: Line 100:
  
 
genesys.wwe.service.subscribe([ "agent", "interaction" ], eventHandler, context);
 
genesys.wwe.service.subscribe([ "agent", "interaction" ], eventHandler, context);
</source>
+
</source>In the above example, <code>eventHandler</code> is the event handler function and <code>context</code> is an optional contextual object.
 
+
Here's an example with an agent <code>STATE_CHANGED</code> to Ready:<source lang="javascript">
In the above example, <tt>eventHandler</tt> is the event handler function and <tt>context</tt> is an optional contextual object.
 
 
 
Here's an example with an agent <tt>STATE_CHANGED</tt> to Ready:
 
<source lang="javascript">
 
 
{
 
{
 
"event": "agent",
 
"event": "agent",
Line 204: Line 109:
 
}
 
}
 
}
 
}
</source>
+
</source>Here's an example with an agent <code>STATE_CHANGED</code> to Not Ready with a reason:<source lang="javascript">
 
 
Here's an example with an agent <tt>STATE_CHANGED</tt> to Not Ready with a reason:
 
<source lang="javascript">
 
 
{
 
{
 
"event": "agent",
 
"event": "agent",
Line 217: Line 119:
 
}
 
}
 
}
 
}
</source>
+
</source>Finally, here's an example with an <code>ATTACHED_DATA_CHANGED</code> event on a voice interaction:<source lang="javascript">
 
 
Finally, here's an example with an <tt>ATTACHED_DATA_CHANGED</tt> event on a voice interaction:
 
<source lang="javascript">
 
 
{
 
{
 
"event": "interaction",
 
"event": "interaction",
Line 257: Line 156:
 
}
 
}
 
</source>
 
</source>
 
+
|Status=No
{{AnchorDiv|EventTypeRef}}
+
}}{{Section
===Event Type references===
+
|sectionHeading=Event Type references
 
+
|anchor=EventTypeRef
The system eventType field can be one of the following:
+
|alignment=Vertical
 
+
|structuredtext=The system eventType field can be one of the following:
 
 
 
 
 
{{{!}}
 
{{{!}}
 
{{!}}-
 
{{!}}-
! eventType
+
!eventType
! Description
+
!Description
 
{{!}}-
 
{{!}}-
{{!}} CUSTOM_TOAST_BUTTON_CLICK
+
{{!}}CUSTOM_TOAST_BUTTON_CLICK
{{!}} Uses the following parameters:
+
{{!}}Uses the following parameters:
 +
 
 
*'''customToastId''': The identifier of the toast where the button has been clicked. The identifier is returned by the {{Link-SomewhereInThisManual|topic=SystemNamespace|anchor=popupToast|display text=popupToast}} method.
 
*'''customToastId''': The identifier of the toast where the button has been clicked. The identifier is returned by the {{Link-SomewhereInThisManual|topic=SystemNamespace|anchor=popupToast|display text=popupToast}} method.
 
*'''buttonIndex''': The index of the clicked button. The index starts by 0.
 
*'''buttonIndex''': The index of the clicked button. The index starts by 0.
{{!}}}
+
{{!}}}The interaction eventType field can be one of the following:
 
 
The interaction eventType field can be one of the following:
 
 
{{{!}}
 
{{{!}}
 
{{!}}-
 
{{!}}-
! eventType
+
!eventType
! Description
+
!Description
 
{{!}}-
 
{{!}}-
{{!}} colspan="2" style="background: whitesmoke;" {{!}} Common events to all interaction types
+
{{!}} colspan="2" style="background: whitesmoke;"{{!}}Common events to all interaction types
 
{{!}}-
 
{{!}}-
{{!}} UNKNOWN
+
{{!}}UNKNOWN
{{!}} An unknown event occurs.
+
{{!}}An unknown event occurs.
 
{{!}}-
 
{{!}}-
{{!}} ADDED
+
{{!}}ADDED
{{!}} The interaction has been added in the list of interactions.
+
{{!}}The interaction has been added in the list of interactions.
 
{{!}}-
 
{{!}}-
{{!}} REMOVED
+
{{!}}REMOVED
{{!}} The interaction has been removed from the list of interactions.
+
{{!}}The interaction has been removed from the list of interactions.
 
{{!}}-
 
{{!}}-
{{!}} ATTACHED_DATA_CHANGED
+
{{!}}ATTACHED_DATA_CHANGED
{{!}} The attached data have changed in the interaction.
+
{{!}}The attached data have changed in the interaction.
 
{{!}}-
 
{{!}}-
{{!}} CASE_OR_BUNDLE_ID_CHANGED
+
{{!}}CASE_OR_BUNDLE_ID_CHANGED
{{!}} The case or the bundle identifier of this interaction has changed.
+
{{!}}The case or the bundle identifier of this interaction has changed.
 
{{!}}-
 
{{!}}-
{{!}} NEW_MESSAGE
+
{{!}}CASE_ID_CHANGED
{{!}} This event represents a new message.
+
{{!}}The case identifier of this interaction has changed.
 
{{!}}-
 
{{!}}-
{{!}} ERROR
+
{{!}}NEW_MESSAGE
{{!}} An error occurs in the interaction.
+
{{!}}This event represents a new message.
 
{{!}}-
 
{{!}}-
{{!}} colspan="2" style="background: whitesmoke;" {{!}} Voice events
+
{{!}}ERROR
 +
{{!}}An error occurs in the interaction.
 
{{!}}-
 
{{!}}-
{{!}} CALL_RECORDING_STATE_CHANGED
+
{{!}} colspan="2" style="background: whitesmoke;"{{!}}Voice events
{{!}} The call recording state changed.
 
 
{{!}}-
 
{{!}}-
{{!}} DIALING
+
{{!}}CALL_RECORDING_STATE_CHANGED
{{!}} The outbound call starts ringing.
+
{{!}}The call recording state changed.
 
{{!}}-
 
{{!}}-
{{!}} ESTABLISHED
+
{{!}}DIALING
{{!}} The call has been established.
+
{{!}}The outbound call starts ringing.
 
{{!}}-
 
{{!}}-
{{!}} HELD
+
{{!}}ESTABLISHED
{{!}} The call has been held.
+
{{!}}The call has been established.
 
{{!}}-
 
{{!}}-
{{!}} PARTY_CHANGED
+
{{!}}HELD
{{!}} The list of party has been changed in the interaction.
+
{{!}}The call has been held.
 
{{!}}-
 
{{!}}-
{{!}} RELEASED
+
{{!}}PARTY_CHANGED
{{!}} The call has been released.
+
{{!}}The list of party has been changed in the interaction.
 
{{!}}-
 
{{!}}-
{{!}} RINGING
+
{{!}}RELEASED
{{!}} The inbound call starts ringing.
+
{{!}}The call has been released.
 
{{!}}-
 
{{!}}-
{{!}} colspan="2" style="background: whitesmoke;" {{!}} OpenMedia events
+
{{!}}RINGING
 +
{{!}}The inbound call starts ringing.
 
{{!}}-
 
{{!}}-
{{!}} ACCEPTED
+
{{!}} colspan="2" style="background: whitesmoke;"{{!}}OpenMedia events
{{!}} The open media interaction is accepted.
 
 
{{!}}-
 
{{!}}-
{{!}} COMPLETED
+
{{!}}ACCEPTED
{{!}} The open media interaction has been completed (Mark as done).
+
{{!}}The open media interaction is accepted.
 
{{!}}-
 
{{!}}-
{{!}} COMPOSING
+
{{!}}COMPLETED
{{!}} The open media interaction is in composing mode.
+
{{!}}The open media interaction has been completed (Mark as done).
 
{{!}}-
 
{{!}}-
{{!}} CREATED
+
{{!}}COMPOSING
{{!}} The open media interaction has been created.
+
{{!}}The open media interaction is in composing mode.
 
{{!}}-
 
{{!}}-
{{!}} INSERT_STANDARD_RESPONSE
+
{{!}}CREATED
{{!}} A standard response has been inserted in the interaction.
+
{{!}}The open media interaction has been created.
 
{{!}}-
 
{{!}}-
{{!}} INVITED
+
{{!}}INSERT_STANDARD_RESPONSE
{{!}} The open media interaction is an invitation.
+
{{!}}A standard response has been inserted in the interaction.
 
{{!}}-
 
{{!}}-
{{!}} INVITED_CONFERENCE
+
{{!}}INVITED
{{!}} The open media interaction receive a conference invitation.
+
{{!}}The open media interaction is an invitation.
 
{{!}}-
 
{{!}}-
{{!}} IN_QUEUE_FAILED
+
{{!}}INVITED_CONFERENCE
{{!}} The place in queue has failed.
+
{{!}}The open media interaction receive a conference invitation.
 
{{!}}-
 
{{!}}-
{{!}} IN_WORKBIN
+
{{!}}IN_QUEUE_FAILED
{{!}} The interaction has been placed in the work-bin.
+
{{!}}The place in queue has failed.
 
{{!}}-
 
{{!}}-
{{!}} IN_WORKBIN_FAILED
+
{{!}}IN_WORKBIN
{{!}} The place in work-bin has failed.
+
{{!}}The interaction has been placed in the work-bin.
 
{{!}}-
 
{{!}}-
{{!}} LEFT_CONFERENCE
+
{{!}}IN_WORKBIN_FAILED
{{!}} The open media interaction has left the conference.
+
{{!}}The place in work-bin has failed.
 
{{!}}-
 
{{!}}-
{{!}} PULLED
+
{{!}}LEFT_CONFERENCE
{{!}} The open media interaction has been pulled from a work-bin.
+
{{!}}The open media interaction has left the conference.
 
{{!}}-
 
{{!}}-
{{!}} PULL_FAILED
+
{{!}}PULLED
{{!}} The pull from the queue has failed.
+
{{!}}The open media interaction has been pulled from a work-bin.
 
{{!}}-
 
{{!}}-
{{!}} PULL_WORKBIN_FAILED
+
{{!}}PULL_FAILED
{{!}} The pull from the work-bin has failed.
+
{{!}}The pull from the queue has failed.
 
{{!}}-
 
{{!}}-
{{!}} REVOKED
+
{{!}}PULL_WORKBIN_FAILED
{{!}} The open media interaction has been revoked.
+
{{!}}The pull from the work-bin has failed.
 
{{!}}-
 
{{!}}-
{{!}} TRANSFER_COMPLETED
+
{{!}}REVOKED
{{!}} The open media interaction has been transferred and the transfer has been completed.
+
{{!}}The open media interaction has been revoked.
 
{{!}}-
 
{{!}}-
{{!}} colspan="2" style="background: whitesmoke;" {{!}} Chat events (inherit from OpenMedia events)
+
{{!}}TRANSFER_COMPLETED
 +
{{!}}The open media interaction has been transferred and the transfer has been completed.
 
{{!}}-
 
{{!}}-
{{!}} ENDED
+
{{!}} colspan="2" style="background: whitesmoke;"{{!}}Chat events (inherit from OpenMedia events)
{{!}} The chat has been ended.
 
 
{{!}}-
 
{{!}}-
{{!}} JOIN_FAILED
+
{{!}}ENDED
{{!}} The connection with the chat server failed.
+
{{!}}The chat has been ended.
 
{{!}}-
 
{{!}}-
{{!}} JOIN_PENDING
+
{{!}}JOIN_FAILED
{{!}} The interaction is trying to join the chat session.
+
{{!}}The connection with the chat server failed.
 
{{!}}-
 
{{!}}-
{{!}} colspan="2" style="background: whitesmoke;" {{!}} Outbound email events (inherit from OpenMedia events)
+
{{!}}JOIN_PENDING
 +
{{!}}The interaction is trying to join the chat session.
 
{{!}}-
 
{{!}}-
{{!}} CANCELLED
+
{{!}} colspan="2" style="background: whitesmoke;"{{!}}Outbound email events (inherit from OpenMedia events)
{{!}} The outbound email has been cancelled.
 
 
{{!}}-
 
{{!}}-
{{!}} SENT
+
{{!}}CANCELLED
{{!}} The outbound email has been sent.
+
{{!}}The outbound email has been cancelled.
 +
{{!}}-
 +
{{!}}SENT
 +
{{!}}The outbound email has been sent.
 
{{!}}}
 
{{!}}}
 
+
===Events for outbound preview===
==== Events for outbound preview ====
 
 
The following table lists the SCAPI event details for Pull Preview, Push Preview and Direct Push Preview records.
 
The following table lists the SCAPI event details for Pull Preview, Push Preview and Direct Push Preview records.
{{{!}} class="wikitable" resolved=""
+
{{{!}} class="wikitable" resolved
 
{{!}}-
 
{{!}}-
! colspan="1" class="confluenceTh" {{!}}Mode
+
! colspan="1" class="confluenceTh"{{!}}Mode
! colspan="1" class="confluenceTh" {{!}}UI Event
+
! colspan="1" class="confluenceTh"{{!}}UI Event
! class="confluenceTh" {{!}}Event Type
+
! class="confluenceTh"{{!}}Event Type
! class="confluenceTh" {{!}}State
+
! class="confluenceTh"{{!}}State
! class="confluenceTh" {{!}}Call Type
+
! class="confluenceTh"{{!}}Call Type
! class="confluenceTh" {{!}}Capabilities
+
! class="confluenceTh"{{!}}Capabilities
 
{{!}}-
 
{{!}}-
{{!}} rowspan="10" {{!}}Pull Preview
+
{{!}} rowspan="10"{{!}}Pull Preview
{{!}} rowspan="2" {{!}}Preview record received
+
{{!}} rowspan="2"{{!}}Preview record received
{{!}} {{!}}ADDED
+
{{!}}{{!}}ADDED
{{!}} {{!}}PREVIEWING
+
{{!}}{{!}}PREVIEWING
{{!}} {{!}}OUTBOUND_PREVIEW
+
{{!}}{{!}}OUTBOUND_PREVIEW
{{!}} {{!}}CALL, REJECT_RECORD, CANCEL_RECORD
+
{{!}}{{!}}CALL, REJECT_RECORD, CANCEL_RECORD
 
{{!}}-
 
{{!}}-
{{!}} {{!}}PREVIEWING
+
{{!}}{{!}}PREVIEWING
{{!}} {{!}}PREVIEWING
+
{{!}}{{!}}PREVIEWING
{{!}} {{!}}OUTBOUND_PREVIEW
+
{{!}}{{!}}OUTBOUND_PREVIEW
{{!}} {{!}}CALL, REJECT_RECORD, CANCEL_RECORD
+
{{!}}{{!}}CALL, REJECT_RECORD, CANCEL_RECORD
 
{{!}}-
 
{{!}}-
{{!}} rowspan="3" {{!}}Make call from preview
+
{{!}} rowspan="3"{{!}}Make call from preview
{{!}} colspan="1" {{!}}ADDED
+
{{!}} colspan="1"{{!}}ADDED
{{!}} colspan="1" {{!}}DIALING
+
{{!}} colspan="1"{{!}}DIALING
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}}HANGUP
+
{{!}} colspan="1"{{!}}HANGUP
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}DIALING
+
{{!}} colspan="1"{{!}}DIALING
{{!}} colspan="1" {{!}}DIALING
+
{{!}} colspan="1"{{!}}DIALING
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}}HANGUP
+
{{!}} colspan="1"{{!}}HANGUP
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}REMOVED
+
{{!}} colspan="1"{{!}}REMOVED
{{!}} colspan="1" {{!}}IDLE
+
{{!}} colspan="1"{{!}}IDLE
{{!}} colspan="1" {{!}}OUTBOUND_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PREVIEW
{{!}} colspan="1" {{!}}-
+
{{!}} colspan="1"{{!}} -
 
{{!}}-
 
{{!}}-
{{!}} rowspan="3" {{!}}Release and mark done
+
{{!}} rowspan="3"{{!}}Release and mark done
{{!}} colspan="1" {{!}}RELEASED
+
{{!}} colspan="1"{{!}}RELEASED
{{!}} colspan="1" {{!}}IDLE
+
{{!}} colspan="1"{{!}}IDLE
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}}MARK_DONE
+
{{!}} colspan="1"{{!}}MARK_DONE
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}MARKDONE_APPLY
+
{{!}} colspan="1"{{!}}MARKDONE_APPLY
{{!}} colspan="1" {{!}}IDLE
+
{{!}} colspan="1"{{!}}IDLE
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}}MARK_DONE
+
{{!}} colspan="1"{{!}}MARK_DONE
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}REMOVED
+
{{!}} colspan="1"{{!}}REMOVED
{{!}} colspan="1" {{!}}IDLE
+
{{!}} colspan="1"{{!}}IDLE
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}} -
+
{{!}} colspan="1"{{!}} -
 
{{!}}-
 
{{!}}-
{{!}} {{!}}Reject record
+
{{!}}{{!}}Reject record
{{!}} colspan="1" {{!}}STATE_CHANGE
+
{{!}} colspan="1"{{!}}STATE_CHANGE
{{!}} colspan="1" {{!}}REJECTED
+
{{!}} colspan="1"{{!}}REJECTED
{{!}} colspan="1" {{!}}OUTBOUND_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PREVIEW
{{!}} colspan="1" {{!}}MARK_DONE
+
{{!}} colspan="1"{{!}}MARK_DONE
 
{{!}}-
 
{{!}}-
{{!}} {{!}}Cancel record
+
{{!}}{{!}}Cancel record
{{!}} colspan="1" {{!}}STATE_CHANGE
+
{{!}} colspan="1"{{!}}STATE_CHANGE
{{!}} colspan="1" {{!}}CANCELED
+
{{!}} colspan="1"{{!}}CANCELED
{{!}} colspan="1" {{!}}OUTBOUND_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PREVIEW
{{!}} colspan="1" {{!}}MARK_DONE
+
{{!}} colspan="1"{{!}}MARK_DONE
 
{{!}}-
 
{{!}}-
{{!}} rowspan="13" {{!}}Regular Push Preview
+
{{!}} rowspan="13"{{!}}Regular Push Preview
{{!}} rowspan="2" {{!}}Record received
+
{{!}} rowspan="2"{{!}}Record received
{{!}} colspan="1" {{!}}ADDED
+
{{!}} colspan="1"{{!}}ADDED
{{!}} colspan="1" {{!}}INVITED
+
{{!}} colspan="1"{{!}}INVITED
{{!}} colspan="1" {{!}}OUTBOUND_PUSH_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PUSH_PREVIEW
{{!}} colspan="1" {{!}}ACCEPT, REJECT
+
{{!}} colspan="1"{{!}}ACCEPT, REJECT
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}INVITED
+
{{!}} colspan="1"{{!}}INVITED
{{!}} colspan="1" {{!}}INVITED
+
{{!}} colspan="1"{{!}}INVITED
{{!}} colspan="1" {{!}}OUTBOUND_PUSH_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PUSH_PREVIEW
{{!}} colspan="1" {{!}}ACCEPT, REJECT
+
{{!}} colspan="1"{{!}}ACCEPT, REJECT
 
{{!}}-
 
{{!}}-
{{!}} {{!}}Accepted
+
{{!}}{{!}}Accepted
{{!}} colspan="1" {{!}}PREVIEWING
+
{{!}} colspan="1"{{!}}PREVIEWING
{{!}} colspan="1" {{!}}PREVIEWING
+
{{!}} colspan="1"{{!}}PREVIEWING
{{!}} colspan="1" {{!}}OUTBOUND_PUSH_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PUSH_PREVIEW
{{!}} colspan="1" {{!}}CALL, REJECT_RECORD, CANCEL_RECORD
+
{{!}} colspan="1"{{!}}CALL, REJECT_RECORD, CANCEL_RECORD
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}Rejected
+
{{!}} colspan="1"{{!}}Rejected
{{!}} colspan="1" {{!}}REMOVED
+
{{!}} colspan="1"{{!}}REMOVED
{{!}} colspan="1" {{!}}REJECTED
+
{{!}} colspan="1"{{!}}REJECTED
{{!}} colspan="1" {{!}}OUTBOUND_PUSH_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PUSH_PREVIEW
{{!}} colspan="1" {{!}} -
+
{{!}} colspan="1"{{!}} -
 
{{!}}-
 
{{!}}-
{{!}} rowspan="3" {{!}}Make call
+
{{!}} rowspan="3"{{!}}Make call
{{!}} colspan="1" {{!}}ADDED
+
{{!}} colspan="1"{{!}}ADDED
{{!}} colspan="1" {{!}}DIALING
+
{{!}} colspan="1"{{!}}DIALING
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}}HANGUP
+
{{!}} colspan="1"{{!}}HANGUP
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}DIALING
+
{{!}} colspan="1"{{!}}DIALING
{{!}} colspan="1" {{!}}DIALING
+
{{!}} colspan="1"{{!}}DIALING
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}}HANGUP
+
{{!}} colspan="1"{{!}}HANGUP
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}ESTABLISHED
+
{{!}} colspan="1"{{!}}ESTABLISHED
{{!}} colspan="1" {{!}}TALKING
+
{{!}} colspan="1"{{!}}TALKING
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}}HANGUP, HOLD
+
{{!}} colspan="1"{{!}}HANGUP, HOLD
 
{{!}}-
 
{{!}}-
{{!}} rowspan="4" {{!}}Release and mark done
+
{{!}} rowspan="4"{{!}}Release and mark done
{{!}} colspan="1" {{!}}RELEASED
+
{{!}} colspan="1"{{!}}RELEASED
{{!}} colspan="1" {{!}}IDLE
+
{{!}} colspan="1"{{!}}IDLE
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}}MARK_DONE
+
{{!}} colspan="1"{{!}}MARK_DONE
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}MARKDONE_APPLY
+
{{!}} colspan="1"{{!}}MARKDONE_APPLY
{{!}} colspan="1" {{!}}IDLE
+
{{!}} colspan="1"{{!}}IDLE
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}}MARK_DONE
+
{{!}} colspan="1"{{!}}MARK_DONE
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}REMOVED
+
{{!}} colspan="1"{{!}}REMOVED
{{!}} colspan="1" {{!}}IDLE
+
{{!}} colspan="1"{{!}}IDLE
{{!}} colspan="1" {{!}}OUTBOUND_PUSH_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PUSH_PREVIEW
{{!}} colspan="1" {{!}}MARK_DONE
+
{{!}} colspan="1"{{!}}MARK_DONE
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}REMOVED
+
{{!}} colspan="1"{{!}}REMOVED
{{!}} colspan="1" {{!}}IDLE
+
{{!}} colspan="1"{{!}}IDLE
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}} -
+
{{!}} colspan="1"{{!}} -
 
{{!}}-
 
{{!}}-
{{!}} {{!}}Reject record
+
{{!}}{{!}}Reject record
{{!}} colspan="1" {{!}}STATE_CHANGE
+
{{!}} colspan="1"{{!}}STATE_CHANGE
{{!}} colspan="1" {{!}}REJECTED
+
{{!}} colspan="1"{{!}}REJECTED
{{!}} colspan="1" {{!}}OUTBOUND_PUSH_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PUSH_PREVIEW
{{!}} colspan="1" {{!}}MARK_DONE
+
{{!}} colspan="1"{{!}}MARK_DONE
 
{{!}}-
 
{{!}}-
{{!}} {{!}}Cancel record
+
{{!}}{{!}}Cancel record
{{!}} colspan="1" {{!}}STATE_CHANGE
+
{{!}} colspan="1"{{!}}STATE_CHANGE
{{!}} colspan="1" {{!}}CANCELED
+
{{!}} colspan="1"{{!}}CANCELED
{{!}} colspan="1" {{!}}OUTBOUND_PUSH_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PUSH_PREVIEW
{{!}} colspan="1" {{!}}MARK_DONE
+
{{!}} colspan="1"{{!}}MARK_DONE
 
{{!}}-
 
{{!}}-
{{!}} rowspan="13" {{!}}Direct Push Preview
+
{{!}} rowspan="13"{{!}}Direct Push Preview
{{!}} rowspan="2" {{!}}Record received
+
{{!}} rowspan="2"{{!}}Record received
{{!}} colspan="1" {{!}}ADDED
+
{{!}} colspan="1"{{!}}ADDED
{{!}} colspan="1" {{!}}INVITED
+
{{!}} colspan="1"{{!}}INVITED
{{!}} colspan="1" {{!}}OUTBOUND_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PREVIEW
{{!}} colspan="1" {{!}}ACCEPT, REJECT
+
{{!}} colspan="1"{{!}}ACCEPT, REJECT
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}INVITED
+
{{!}} colspan="1"{{!}}INVITED
{{!}} colspan="1" {{!}}INVITED
+
{{!}} colspan="1"{{!}}INVITED
{{!}} colspan="1" {{!}}OUTBOUND_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PREVIEW
{{!}} colspan="1" {{!}}ACCEPT, REJECT
+
{{!}} colspan="1"{{!}}ACCEPT, REJECT
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}Accepted
+
{{!}} colspan="1"{{!}}Accepted
{{!}} colspan="1" {{!}}PREVIEWING
+
{{!}} colspan="1"{{!}}PREVIEWING
{{!}} colspan="1" {{!}}PREVIEWING
+
{{!}} colspan="1"{{!}}PREVIEWING
{{!}} colspan="1" {{!}}OUTBOUND_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PREVIEW
{{!}} colspan="1" {{!}}CALL, REJECT_RECORD, CANCEL_RECORD
+
{{!}} colspan="1"{{!}}CALL, REJECT_RECORD, CANCEL_RECORD
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}Rejected
+
{{!}} colspan="1"{{!}}Rejected
{{!}} colspan="1" {{!}}REMOVED
+
{{!}} colspan="1"{{!}}REMOVED
{{!}} colspan="1" {{!}}REJECTED
+
{{!}} colspan="1"{{!}}REJECTED
{{!}} colspan="1" {{!}}OUTBOUND_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PREVIEW
{{!}} colspan="1" {{!}} -
+
{{!}} colspan="1"{{!}} -
 
{{!}}-
 
{{!}}-
{{!}} rowspan="4" {{!}}Make call
+
{{!}} rowspan="4"{{!}}Make call
{{!}} colspan="1" {{!}}ADDED
+
{{!}} colspan="1"{{!}}ADDED
{{!}} colspan="1" {{!}}DIALING
+
{{!}} colspan="1"{{!}}DIALING
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}}HANGUP
+
{{!}} colspan="1"{{!}}HANGUP
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}DIALING
+
{{!}} colspan="1"{{!}}DIALING
{{!}} colspan="1" {{!}}DIALING
+
{{!}} colspan="1"{{!}}DIALING
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}}HANGUP
+
{{!}} colspan="1"{{!}}HANGUP
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}ESTABLISHED
+
{{!}} colspan="1"{{!}}ESTABLISHED
{{!}} colspan="1" {{!}}TALKING
+
{{!}} colspan="1"{{!}}TALKING
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}}HANGUP
+
{{!}} colspan="1"{{!}}HANGUP
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}REMOVED
+
{{!}} colspan="1"{{!}}REMOVED
{{!}} colspan="1" {{!}}IDLE
+
{{!}} colspan="1"{{!}}IDLE
{{!}} colspan="1" {{!}}OUTBOUND_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PREVIEW
{{!}} colspan="1" {{!}} -
+
{{!}} colspan="1"{{!}} -
 
{{!}}-
 
{{!}}-
{{!}} rowspan="3" {{!}}Release and mark done
+
{{!}} rowspan="3"{{!}}Release and mark done
{{!}} colspan="1" {{!}}RELEASED
+
{{!}} colspan="1"{{!}}RELEASED
{{!}} colspan="1" {{!}}IDLE
+
{{!}} colspan="1"{{!}}IDLE
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}}MARK_DONE
+
{{!}} colspan="1"{{!}}MARK_DONE
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}MARKDONE_APPLY
+
{{!}} colspan="1"{{!}}MARKDONE_APPLY
{{!}} colspan="1" {{!}}IDLE
+
{{!}} colspan="1"{{!}}IDLE
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}}MARK_DONE
+
{{!}} colspan="1"{{!}}MARK_DONE
 
{{!}}-
 
{{!}}-
{{!}} colspan="1" {{!}}REMOVED
+
{{!}} colspan="1"{{!}}REMOVED
{{!}} colspan="1" {{!}}IDLE
+
{{!}} colspan="1"{{!}}IDLE
{{!}} colspan="1" {{!}}OUTBOUND
+
{{!}} colspan="1"{{!}}OUTBOUND
{{!}} colspan="1" {{!}} -
+
{{!}} colspan="1"{{!}} -
 
{{!}}-
 
{{!}}-
{{!}} {{!}}Reject record
+
{{!}}{{!}}Reject record
{{!}} colspan="1" {{!}}STATE_CHANGE
+
{{!}} colspan="1"{{!}}STATE_CHANGE
{{!}} colspan="1" {{!}}REJECTED
+
{{!}} colspan="1"{{!}}REJECTED
{{!}} colspan="1" {{!}}OUTBOUND_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PREVIEW
{{!}} colspan="1" {{!}}MARK_DONE
+
{{!}} colspan="1"{{!}}MARK_DONE
 
{{!}}-
 
{{!}}-
{{!}} {{!}}Cancel record
+
{{!}}{{!}}Cancel record
{{!}} colspan="1" {{!}}STATE_CHANGE
+
{{!}} colspan="1"{{!}}STATE_CHANGE
{{!}} colspan="1" {{!}}CANCELED
+
{{!}} colspan="1"{{!}}CANCELED
{{!}} colspan="1" {{!}}OUTBOUND_PREVIEW
+
{{!}} colspan="1"{{!}}OUTBOUND_PREVIEW
{{!}} colspan="1" {{!}}MARK_DONE
+
{{!}} colspan="1"{{!}}MARK_DONE
 
{{!}}}
 
{{!}}}
 +
|Status=No
 +
}}{{Section
 +
|sectionHeading=Common actions with Service Client API
 +
|anchor=common
 +
|alignment=Vertical
 +
|structuredtext=The following sections show some common actions you can perform with Service Client API:
 +
{{AnchorDiv|controlthirdparty}}
 +
===Controlling call recording from a third-party application===
 +
Review the following methods for details about call recording control:
 +
 +
*{{Link-SomewhereInThisManual|topic=VoiceNamespace|anchor=pauseCallRecording|display text=pauseCallRecording}}
 +
*{{Link-SomewhereInThisManual|topic=VoiceNamespace|anchor=resumeCallRecording|display text=resumeCallRecording}}
 +
*{{Link-SomewhereInThisManual|topic=VoiceNamespace|anchor=startCallRecording|display text=startCallRecording}}
 +
*{{Link-SomewhereInThisManual|topic=VoiceNamespace|anchor=stopCallRecording|display text=stopCallRecording}}
 +
 +
The call recording state is stored in the <code>recordingState</code> attribute on the {{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=Interaction|display text=interaction.Interaction}} object.
 +
 +
{{AnchorDiv|embedthirdparty}}
 +
===Embedding multiple third-party applications in Agent Desktop===
 +
You can now set the interaction.web-content option to a list of option section names that correspond to web extension views. This means that you can configure Agent Desktop to include more than one third-party web application, displayed as either a tab, a popup window, in the background at the interaction level, or hidden.
  
|fullwidth=No
+
You should also make sure that the service-client-api.accepted-web-content-origins option references all the websites that should use the Service Client API.
 +
 
 +
Contact your Genesys representative to enable embedding multiple third-party applications in Agent Desktop.
 +
{{AnchorDiv|updatethirdparty}}
 +
===Updating attached data from a third-party application===
 +
Review the following methods for details about updating attached data:
 +
 
 +
*{{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=deleteUserData|display text=deleteUserData}}
 +
*{{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=getByInteractionId|display text=getByInteractionId}}
 +
*{{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=getInteractions|display text=getInteractions}}
 +
*{{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=setUserData|display text=setUserData}}
 +
 
 +
The user data is stored in the <code>userData</code> attribute on the {{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=Interaction|display text=interaction.Interaction}} object.
 +
 
 +
You should also be sure to configure the options related to user data in the {{Link-AnywhereElse|product=PEC-AS|version=Current|manual=ManageCC|topic=Service_Client_options|display text=Service Client section of Agent Setup}} to enable read and write access to user data.{{AnchorDiv|enablethirdparty}}
 +
===Enabling click-to-dial from a third-party application===
 +
If you configure Agent Desktop to display your web application in a new tab in the Agent Desktop user interface, then the service API only gives access to the {{Link-SomewhereInThisManual|topic=VoiceNamespace|anchor=dial|display text=dial}} operation.
 +
{{AnchorDiv|toast}}
 +
===Enabling Service Client API to invoke toast in Agent Desktop===
 +
Review the following methods for details about enabling and updating toast:
 +
 
 +
*{{Link-SomewhereInThisManual|topic=SystemNamespace|anchor=top|display text=system.popupToast}}
 +
*{{Link-SomewhereInThisManual|topic=SystemNamespace|anchor=top|display text=system.updateToast}}
 +
*{{Link-SomewhereInThisManual|topic=SystemNamespace|anchor=top|display text=system.closeToast}}
 +
{{AnchorDiv|casethirdparty}}
 +
===Controlling case selection from a  third-party application===
 +
Review the following method for details about case selecting control:
 +
 
 +
*{{Link-SomewhereInThisManual|topic=InteractionNamespace|anchor=top|display text=selectCaseByCaseId}}
 +
 
 +
The case selection state is stored in the ''isCaseSelected'' attribute and the ''isCaseExpanded'' attribute on the '''interaction.Interaction''' object.
 +
{{AnchorDiv|tabs}}
 +
===Supporting multiple browser tabs===
 +
Service Client API supports multiple browser tabs in a session. The API uses the concept of a leader tab and following tab or tabs. When multiple tabs are open, certain actions (typically automatic) are performed only by the leader tab, such as auto-answer for chat, email, and voice interactions, and contact management in Universal Contact Server. The API also tracks which tab was the last active because some actions are performed only by this tab, such as sounds, toasts, and supervisor-forced log out.
 +
 
 +
The state of a given browser tab is determined by an internal election process, which can be triggered when an agent closes a leader tab. The state is exposed through the '''data.frameState''' property on system events. The '''frameState''' property has three possible values:
 +
 
 +
*LEADING: The election happened and this tab is the leader.
 +
*FOLLOWING: The election happened and this tab is a follower.
 +
*NEGOTIATING: The election is in progress and no tab is a leader or follower until the election is finished.
 +
 
 +
You can subscribe to system events as follows:<source lang="js">
 +
function eventHandler(message) {
 +
  switch (message.event) {
 +
    case 'system':
 +
      log('Received system event: ', JSON.stringify(message, null, '\t'));
 +
      break;
 +
    default:
 +
      break;
 +
  }
 +
}
 +
 
 +
genesys.wwe.service.subscribe(['system'], eventHandler, this);
 +
</source>When an election is triggered, you should see these types of system events:<source lang="js">
 +
Received system event:
 +
{
 +
    "event": "system",
 +
    "data": {
 +
        "frameState": "LEADING"
 +
    },
 +
    "userAgent": "WWE Server",
 +
    "protocolVersion": 2
 +
}
 +
 +
Received system event:
 +
{
 +
    "event": "system",
 +
    "data": {
 +
        "frameState": "NEGOTIATING"
 +
    },
 +
    "userAgent": "WWE Server",
 +
    "protocolVersion": 2
 +
}
 +
</source>Service Client API provides some helper functions through the {{Link-SomewhereInThisVersion|manual=SCAPI|topic=SystemNamespace}} to determine the state of a tab:
 +
 
 +
*{{Link-SomewhereInThisVersion|manual=SCAPI|topic=SystemNamespace|anchor=isFrameLeading|display text=isFrameLeading}}
 +
*{{Link-SomewhereInThisVersion|manual=SCAPI|topic=SystemNamespace|anchor=isFrameFollowing|display text=isFrameFollowing}}
 +
*{{Link-SomewhereInThisVersion|manual=SCAPI|topic=SystemNamespace|anchor=isFrameNegotiating|display text=isFrameNegotiating}}
 +
*{{Link-SomewhereInThisVersion|manual=SCAPI|topic=SystemNamespace|anchor=isFrameLeadingOrNegotiating|display text=isFrameLeadingOrNegotiating}}
 +
*{{Link-SomewhereInThisVersion|manual=SCAPI|topic=SystemNamespace|anchor=isLastActiveFrame|display text=isLastActiveFrame}}
 +
 
 +
Service Client API updates the attached data for an interaction in the leader tab with a new '''caseId''' on eventType CASE_ID_CHANGED.
 +
<source lang="js">
 +
{
 +
    "event": "interaction",
 +
    "data": {
 +
        "eventType": "CASE_ID_CHANGED",
 +
        "caseId": "e6470563-af78-4942-657d-976a25dd9de3",
 +
        "previousCaseId": "5f7e5f3a-fb6e-43f3-c404-eaee21d64ef1"
 +
    },
 +
    "userAgent": "WWE Server",
 +
    "protocolVersion": 2
 +
}
 +
</source>
 
|Status=No
 
|Status=No
}}  
+
}}
 
}}
 
}}

Revision as of 17:14, July 22, 2021

This topic is part of the manual Service Client API Reference for version Current of Developer.

Learn how to use the Service Client API to customize the way your web application integrates with Agent Desktop.

Important
You must contact your Genesys representative to configure Agent Desktop to use the Service Client API.
Use the Service Client API to customize how your web application or website integrates with Agent Desktop. This JavaScript API is based on window.postMessage and provides methods your application can use to communicate cross domain with Agent Desktop while maintaining secured isolation.

Getting started

Here's an overview of the steps to access the API:

  1. You have a web application that you've integrated in Agent Desktop—contact your Genesys representative to enable integration of web applications in Agent Desktop.
  2. Download the sample application from GitHub.
  3. Copy the wwe-service-client-api.js file in the sample application to a location your web application can access.
  4. Set configuration options related to security—contact your Genesys representative to provision this security configuration.
  5. Review Working with the API for more information about how to use the API.
  6. Review the methods and types available in each namespace:
  7. See Common actions with Service Client API for ideas about how to use the API.

Working with the API

After you've completed the setup and security steps, you're ready to start working with the Service Client API. The first thing you need to do is add a <script> tag to your web application that points to the wwe-service-client-api.js file (remember, you stored it somewhere accessible in Step 3 above).

Now you can access the API through the genesys.wwe.service namespace. For example:
<html>
<head>
<script src="wwe-service-client-api.js"></script>
<script>

function test() {
genesys.wwe.service.sendMessage({
request: "agent.get"
}, function(result) {
console.debug("SUCCEEDED, result: " + JSON.stringify(result, null, '\t'));
}, function(result) {
console.debug("FAILED, result: " + JSON.stringify(result, null, '\t'));
});
}

function eventHandler(message)
{
console.debug("Event: " + JSON.stringify(message, null, '\t'));
}

genesys.wwe.service.subscribe([ "agent", "interaction" ], eventHandler, this);

</script>
</head>
<body>
Hello world
</body>
</html>
Here's an example of how you could modify attached data:
genesys.wwe.service.interaction.setUserData("1",
{
MyKEY1: "MyValue1",
MyKEY2: "MyValue2"
})
In the above example, the request is interaction.setUserData and the parameters are the interactionId of 1 and the keyValues of MyKEY1 and MyKEY2. All methods provided in the Service Client API are asynchronous, so to get the successful or failed result, just add the matching callback:
genesys.wwe.service.interaction.setUserData("1",
{
MyKEY1: "MyValue1",
MyKEY2: "MyValue2"
}, function(result){
console.debug("SUCCEEDED, result: " + JSON.stringify(result, null, '\t'));
}, function(result){
console.debug("FAILED, result: " + JSON.stringify(result, null, '\t'));
})
The global template for a service call is:
genesys.wwe.service.<Service name>.<Service function>(<... function parameters ...>, [<optional done() callback>, [<optional fail() callback>]]);
The done() callback is called when a request is successfully sent without an error.

The fail() callback is called when a request generates an error or an exception.

The result of these functions is provided in a JSON object as a unique parameter.

Notifications

You can use the following code to subscribe to agent and interaction notifications:
function eventHandler(message)
{
console.debug("Event: " + JSON.stringify(message, null, '\t'));
}

genesys.wwe.service.subscribe([ "agent", "interaction" ], eventHandler, context);
In the above example, eventHandler is the event handler function and context is an optional contextual object. Here's an example with an agent STATE_CHANGED to Ready:
{
"event": "agent",
"data": {
"eventType": "STATE_CHANGED",
"mediaState": "READY"
}
}
Here's an example with an agent STATE_CHANGED to Not Ready with a reason:
{
"event": "agent",
"data": {
"eventType": "STATE_CHANGED",
"mediaState": "NOT_READY_ACTION_CODE",
"reason": "Break",
"reasonCode": "1511"
}
}
Finally, here's an example with an ATTACHED_DATA_CHANGED event on a voice interaction:
{
"event": "interaction",
"data": {
"eventType": "ATTACHED_DATA_CHANGED",
"media": "voice",
"interaction": {
"interactionId": "1",
"caseId": "4dda1ab6-aeab-4a33-f5d0-0153c9fdb43b",
"userData": {
"IWAttachedDataInformation": {
"DispositionCode.Label": "DispositionCode",
"Option.interaction.case-data.header-foreground-color": "#FFFFFF",
"CaseDataBusinessAttribute": "CaseData",
"DispositionCode.Key": "ChooseDisposition",
"Option.interaction.case-data.frame-color": "#17849D"
},
"IW_CaseUid": "4dda1ab6-aeab-4a33-f5d0-0153c9fdb43b",
"IW_BundleUid": "dfaca66c-4149-42a1-7244-337e949a12b5"
},
"parties": [
{
"name": "5001"
}
],
"callUuid": "4L6JGNEE9H7DT671FRPTKE6CQ000000G",
"state": "DIALING",
"previousState": "UNKNOWN",
"isConsultation": false,
"direction": "OUT",
"callType": "Internal",
"dnis": "5001",
"isMainCaseInteraction": true
}
}
}

Event Type references

The system eventType field can be one of the following:

eventType Description
CUSTOM_TOAST_BUTTON_CLICK Uses the following parameters:
  • customToastId: The identifier of the toast where the button has been clicked. The identifier is returned by the popupToast method.
  • buttonIndex: The index of the clicked button. The index starts by 0.
The interaction eventType field can be one of the following:
eventType Description
Common events to all interaction types
UNKNOWN An unknown event occurs.
ADDED The interaction has been added in the list of interactions.
REMOVED The interaction has been removed from the list of interactions.
ATTACHED_DATA_CHANGED The attached data have changed in the interaction.
CASE_OR_BUNDLE_ID_CHANGED The case or the bundle identifier of this interaction has changed.
CASE_ID_CHANGED The case identifier of this interaction has changed.
NEW_MESSAGE This event represents a new message.
ERROR An error occurs in the interaction.
Voice events
CALL_RECORDING_STATE_CHANGED The call recording state changed.
DIALING The outbound call starts ringing.
ESTABLISHED The call has been established.
HELD The call has been held.
PARTY_CHANGED The list of party has been changed in the interaction.
RELEASED The call has been released.
RINGING The inbound call starts ringing.
OpenMedia events
ACCEPTED The open media interaction is accepted.
COMPLETED The open media interaction has been completed (Mark as done).
COMPOSING The open media interaction is in composing mode.
CREATED The open media interaction has been created.
INSERT_STANDARD_RESPONSE A standard response has been inserted in the interaction.
INVITED The open media interaction is an invitation.
INVITED_CONFERENCE The open media interaction receive a conference invitation.
IN_QUEUE_FAILED The place in queue has failed.
IN_WORKBIN The interaction has been placed in the work-bin.
IN_WORKBIN_FAILED The place in work-bin has failed.
LEFT_CONFERENCE The open media interaction has left the conference.
PULLED The open media interaction has been pulled from a work-bin.
PULL_FAILED The pull from the queue has failed.
PULL_WORKBIN_FAILED The pull from the work-bin has failed.
REVOKED The open media interaction has been revoked.
TRANSFER_COMPLETED The open media interaction has been transferred and the transfer has been completed.
Chat events (inherit from OpenMedia events)
ENDED The chat has been ended.
JOIN_FAILED The connection with the chat server failed.
JOIN_PENDING The interaction is trying to join the chat session.
Outbound email events (inherit from OpenMedia events)
CANCELLED The outbound email has been cancelled.
SENT The outbound email has been sent.

Events for outbound preview

The following table lists the SCAPI event details for Pull Preview, Push Preview and Direct Push Preview records.

Mode UI Event Event Type State Call Type Capabilities
Pull Preview Preview record received ADDED PREVIEWING OUTBOUND_PREVIEW CALL, REJECT_RECORD, CANCEL_RECORD
PREVIEWING PREVIEWING OUTBOUND_PREVIEW CALL, REJECT_RECORD, CANCEL_RECORD
Make call from preview ADDED DIALING OUTBOUND HANGUP
DIALING DIALING OUTBOUND HANGUP
REMOVED IDLE OUTBOUND_PREVIEW -
Release and mark done RELEASED IDLE OUTBOUND MARK_DONE
MARKDONE_APPLY IDLE OUTBOUND MARK_DONE
REMOVED IDLE OUTBOUND -
Reject record STATE_CHANGE REJECTED OUTBOUND_PREVIEW MARK_DONE
Cancel record STATE_CHANGE CANCELED OUTBOUND_PREVIEW MARK_DONE
Regular Push Preview Record received ADDED INVITED OUTBOUND_PUSH_PREVIEW ACCEPT, REJECT
INVITED INVITED OUTBOUND_PUSH_PREVIEW ACCEPT, REJECT
Accepted PREVIEWING PREVIEWING OUTBOUND_PUSH_PREVIEW CALL, REJECT_RECORD, CANCEL_RECORD
Rejected REMOVED REJECTED OUTBOUND_PUSH_PREVIEW -
Make call ADDED DIALING OUTBOUND HANGUP
DIALING DIALING OUTBOUND HANGUP
ESTABLISHED TALKING OUTBOUND HANGUP, HOLD
Release and mark done RELEASED IDLE OUTBOUND MARK_DONE
MARKDONE_APPLY IDLE OUTBOUND MARK_DONE
REMOVED IDLE OUTBOUND_PUSH_PREVIEW MARK_DONE
REMOVED IDLE OUTBOUND -
Reject record STATE_CHANGE REJECTED OUTBOUND_PUSH_PREVIEW MARK_DONE
Cancel record STATE_CHANGE CANCELED OUTBOUND_PUSH_PREVIEW MARK_DONE
Direct Push Preview Record received ADDED INVITED OUTBOUND_PREVIEW ACCEPT, REJECT
INVITED INVITED OUTBOUND_PREVIEW ACCEPT, REJECT
Accepted PREVIEWING PREVIEWING OUTBOUND_PREVIEW CALL, REJECT_RECORD, CANCEL_RECORD
Rejected REMOVED REJECTED OUTBOUND_PREVIEW -
Make call ADDED DIALING OUTBOUND HANGUP
DIALING DIALING OUTBOUND HANGUP
ESTABLISHED TALKING OUTBOUND HANGUP
REMOVED IDLE OUTBOUND_PREVIEW -
Release and mark done RELEASED IDLE OUTBOUND MARK_DONE
MARKDONE_APPLY IDLE OUTBOUND MARK_DONE
REMOVED IDLE OUTBOUND -
Reject record STATE_CHANGE REJECTED OUTBOUND_PREVIEW MARK_DONE
Cancel record STATE_CHANGE CANCELED OUTBOUND_PREVIEW MARK_DONE

Common actions with Service Client API

The following sections show some common actions you can perform with Service Client API:

Controlling call recording from a third-party application

Review the following methods for details about call recording control:

The call recording state is stored in the recordingState attribute on the interaction.Interaction object.

Embedding multiple third-party applications in Agent Desktop

You can now set the interaction.web-content option to a list of option section names that correspond to web extension views. This means that you can configure Agent Desktop to include more than one third-party web application, displayed as either a tab, a popup window, in the background at the interaction level, or hidden.

You should also make sure that the service-client-api.accepted-web-content-origins option references all the websites that should use the Service Client API.

Contact your Genesys representative to enable embedding multiple third-party applications in Agent Desktop.

Updating attached data from a third-party application

Review the following methods for details about updating attached data:

The user data is stored in the userData attribute on the interaction.Interaction object.

You should also be sure to configure the options related to user data in the Service Client section of Agent Setup to enable read and write access to user data.

Enabling click-to-dial from a third-party application

If you configure Agent Desktop to display your web application in a new tab in the Agent Desktop user interface, then the service API only gives access to the dial operation.

Enabling Service Client API to invoke toast in Agent Desktop

Review the following methods for details about enabling and updating toast:

Controlling case selection from a third-party application

Review the following method for details about case selecting control:

The case selection state is stored in the isCaseSelected attribute and the isCaseExpanded attribute on the interaction.Interaction object.

Supporting multiple browser tabs

Service Client API supports multiple browser tabs in a session. The API uses the concept of a leader tab and following tab or tabs. When multiple tabs are open, certain actions (typically automatic) are performed only by the leader tab, such as auto-answer for chat, email, and voice interactions, and contact management in Universal Contact Server. The API also tracks which tab was the last active because some actions are performed only by this tab, such as sounds, toasts, and supervisor-forced log out.

The state of a given browser tab is determined by an internal election process, which can be triggered when an agent closes a leader tab. The state is exposed through the data.frameState property on system events. The frameState property has three possible values:

  • LEADING: The election happened and this tab is the leader.
  • FOLLOWING: The election happened and this tab is a follower.
  • NEGOTIATING: The election is in progress and no tab is a leader or follower until the election is finished.
You can subscribe to system events as follows:
function eventHandler(message) {
  switch (message.event) {
    case 'system':
      log('Received system event: ', JSON.stringify(message, null, '\t'));
      break;
    default:
      break;
  }
}

genesys.wwe.service.subscribe(['system'], eventHandler, this);
When an election is triggered, you should see these types of system events:
Received system event:
{
    "event": "system",
    "data": {
        "frameState": "LEADING"
    },
    "userAgent": "WWE Server",
    "protocolVersion": 2
}
 
Received system event:
{
    "event": "system",
    "data": {
        "frameState": "NEGOTIATING"
    },
    "userAgent": "WWE Server",
    "protocolVersion": 2
}
Service Client API provides some helper functions through the System namespace to determine the state of a tab:

Service Client API updates the attached data for an interaction in the leader tab with a new caseId on eventType CASE_ID_CHANGED.

{
    "event": "interaction",
    "data": {
        "eventType": "CASE_ID_CHANGED",
        "caseId": "e6470563-af78-4942-657d-976a25dd9de3",
        "previousCaseId": "5f7e5f3a-fb6e-43f3-c404-eaee21d64ef1"
    },
    "userAgent": "WWE Server",
    "protocolVersion": 2
}
Comments or questions about this documentation? Contact us for support!