Genesys Cloud Script.Data Structure
When a Campaign has been popped from a Genesys Cloud interaction, the Script.Data layer will contain a synthesis of the event data object from Genesys Cloud as well as other data from Genesys Cloud, and related data generated within Scripting.
Three keys within the Script.Data layer specifically impact the end-of-Workflow behaviour:
-
awakenDisconnectOnClose is a boolean of whether the current interaction should be disconnect when the Workflow is completed. It either derives its value from the value of [var_disconnectOnClose] or can be set directly via Script.Data.SetPostDataItem(). Defaults to true.
-
awakenOutcomeCode is a string of the wrap-up code to be set against the conversation when the Workflow is completed. It either takes its value from the value of [var_csOBOutcomeCode] or can be set directly via Script.Data.SetPostDataItem(). Defaults to "".
-
awakenOutcomeComments is a string of the wrap-up code to be set against the conversation when the Workflow is completed. It either takes its value from the value of [var_csOBComments] or can be set directly via Script.Data.SetPostDataItem(). Defaults to "".
Note: all of the provided data structures in this article are representative of common scenarios, and may vary over the course of an interaction, or depend directly on the data returned by a Genesys Cloud API. It is recommended that the structure be confirmed against your specific usage cases.
When popping from an email interaction, the Script.Data layer is derived from a response from a Genesys Cloud API:
Below is an example data structure:
{
"conversationId": "",
"agentParticipantId": "",
"customerParticipantId": "",
"awakenDisconnectOnClose": ,
"awakenOutcomeCode": "",
"awakenOutcomeComments": "",
"customerEmail": {
"id": "",
"to": [
{
"email": "",
"name": ""
}
],
"cc": [],
"bcc": [],
"from": {
"email": "",
"name": ""
},
"subject": "",
"attachments": [
{
"attachmentId": "",
"name": "",
"contentUri": "",
"contentType": "",
"contentLength": ,
"inlineImage":
}
],
"textBody": "",
"htmlBody": "",
"time": "",
"historyIncluded": ,
"selfUri": "/api/v2/conversations/emails//messages/"
}
}
|
When popping from an inbound phone interaction, the Script.Data layer is derived from a subset of the conversation's data:
-
The agentCall and customerCall objects are sourced from the calls array within the participant object that has purpose of agent and customer respectively.
-
Both of these objects omit the segments, disconnectReasons, and startAlertingTime keys.
-
Both of these objects include an additionalProperties, self.additionalProperties, and other.additionalProperties object.
-
The attributes object within the participant root object of a participant isn't present in the Script.Data layer - use the checkConversationId JavaScript function if these attributes are required in-Workflow.
Below is an example data structure:
{
"conversationId": "",
"agentParticipantId": "",
"customerParticipantId": "",
"awakenDisconnectOnClose": ,
"awakenOutcomeCode": "",
"awakenOutcomeComments": "",
"agentCall": {
"id": "",
"state": "",
"recording": ,
"recordingState": "",
"muted": ,
"confined": ,
"held": ,
"direction": "inbound",
"self": {
"nameRaw": "",
"addressNormalized": "",
"addressRaw": "",
"addressDisplayable": "",
"additionalProperties": {}
},
"other": {
"name": "",
"nameRaw": "",
"addressNormalized": "",
"addressRaw": "",
"addressDisplayable": "",
"additionalProperties": {}
},
"provider": "Edge",
"peerId": "",
"connectedTime": "",
"afterCallWorkRequired": ,
"additionalProperties": {}
},
"customerCall": {
"id": "",
"state": "",
"recording": ,
"recordingState": "",
"muted": ,
"confined": ,
"held": ,
"direction": "inbound",
"self": {
"name": "",
"nameRaw": "",
"addressNormalized": "",
"addressRaw": "",
"addressDisplayable": "",
"additionalProperties": {}
},
"other": {
"name": "",
"nameRaw": "",
"addressNormalized": "",
"addressRaw": "",
"addressDisplayable": "",
"additionalProperties": {}
},
"provider": "Edge",
"connectedTime": "",
"afterCallWorkRequired": ,
"additionalProperties": {}
}
}
|
When popping from an outbound predictive interaction, the Script.Data layer is derived from a subset of the conversation's data and the response from a pair of Genesys Cloud APIs:
-
The agentCall and customerCall objects are sourced from the calls array within the participant object that has purpose of agent and customer respectively.
-
Both of these objects omit the segments, disconnectReasons, and startAlertingTime keys.
-
Both of these objects include an additionalProperties, self.additionalProperties, and other.additionalProperties object.
-
The attributes object within the participant root object of a participant isn't present in the Script.Data layer - use the checkConversationId JavaScript function if these attributes are required in-Workflow.
-
-
The data sub-object contains a list of the column names and values attached to the current contact in the contact list.
-
{
"conversationId": "",
"agentParticipantId": "",
"customerParticipantId": "",
"awakenDisconnectOnClose": ,
"awakenOutcomeCode": "",
"awakenOutcomeComments": "",
"dialerInteractionId": "",
"dialerCampaignId": "",
"dialerContactListId": "",
"dialerContactId": "",
"dialingMode": "predictive",
"agentCall": {
"id": "",
"state": "",
"recording": ,
"recordingState": "",
"muted": ,
"confined": ,
"held": ,
"direction": "inbound",
"self": {
"nameRaw": "",
"addressNormalized": "",
"addressRaw": "",
"addressDisplayable": "",
"additionalProperties": {}
},
"other": {
"name": "",
"nameRaw": "",
"addressNormalized": "",
"addressRaw": "",
"addressDisplayable": "",
"additionalProperties": {}
},
"provider": "Edge",
"peerId": "",
"connectedTime": "",
"afterCallWorkRequired": ,
"additionalProperties": {}
},
"customerCall": {
"id": "",
"state": "",
"recording": ,
"recordingState": "",
"muted": ,
"confined": ,
"held": ,
"direction": "inbound",
"self": {
"name": "",
"nameRaw": "",
"addressNormalized": "",
"addressRaw": "",
"addressDisplayable": "",
"additionalProperties": {}
},
"other": {
"name": "",
"nameRaw": "",
"addressNormalized": "",
"addressRaw": "",
"addressDisplayable": "",
"additionalProperties": {}
},
"provider": "Edge",
"peerId": "",
"connectedTime": "",
"afterCallWorkRequired": ,
"additionalProperties": {}
},
"outboundContact": {
"id": "",
"contactListId": "",
"data": {},
"callable": ,
"phoneNumberStatus": {
"Phone": {
"callable":
}
},
"selfUri": "/api/v2/outbound/contactlists//contacts/"
},
"outboundCampaign": {
"id": "",
"name": "",
"dateCreated": "",
"dateModified": "",
"version": ,
"contactList": {
"id": "",
"name": "",
"selfUri": "/api/v2/outbound/contactlists/"
},
"queue": {
"id": "",
"name": "",
"selfUri": "/api/v2/routing/queues/"
},
"dialingMode": "predictive",
"script": {
"id": "",
"name": "",
"selfUri": "/api/v2/scripts/published/"
},
"site": {
"id": "",
"name": "",
"selfUri": "/api/v2/telephony/providers/edges/sites/"
},
"campaignStatus": "",
"phoneColumns": [
{
"columnName": "",
"type": ""
}
],
"abandonRate": ,
"dncLists": [],
"callAnalysisResponseSet": {
"id": "",
"name": "",
"selfUri": "/api/v2/outbound/callanalysisresponsesets/"
},
"callerName": "",
"callerAddress": "",
"outboundLineCount": ,
"ruleSets": [],
"skipPreviewDisabled": ,
"previewTimeOutSeconds": ,
"singleNumberPreview": ,
"alwaysRunning": ,
"noAnswerTimeout": ,
"priority": ,
"contactListFilters": [],
"division": {
"id": "",
"name": "",
"selfUri": "/api/v2/authorization/divisions/"
},
"selfUri": "/api/v2/outbound/campaigns/"
}
}
|
When popping from an outbound preview interaction, the Script.Data layer is derived from a subset of the conversation's data and the response from a pair of Genesys Cloud APIs:
-
The agentCallback object is sourced from the callbacks array within the participant object that has purpose of agent.
-
This object omits the segments, and startAlertingTime keys.
-
This object includes an additionalProperties, dialerPreview.additionalProperties, and dialerPreview.phoneNumberColumns[i].additionalProperties object.
-
The attributes object within the participant root object of a participant isn't present in the Script.Data layer - use the checkConversationId JavaScript function if these attributes are required in-Workflow.
-
-
The data sub-object contains a list of the column names and values attached to the current contact in the contact list.
-
-
The dialerPreview object is a replica of the agentCallback.dialerPreview object.
Below is an example data structure:
{
"conversationId": "",
"agentParticipantId": "",
"customerParticipantId": "",
"awakenDisconnectOnClose": ,
"awakenOutcomeCode": "",
"awakenOutcomeComments": "",
"dialerInteractionId": "",
"dialerCampaignId": "",
"dialerContactListId": "",
"dialerContactId": "",
"dialingMode": "preview",
"agentCallback": {
"state": "",
"id": "",
"held": ,
"dialerPreview": {
"id": "",
"contactId": "",
"contactListId": "",
"campaignId": "",
"phoneNumberColumns": [
{
"columnName": "",
"type": "",
"additionalProperties": {}
}
],
"additionalProperties": {}
},
"callbackNumbers": [
""
],
"callbackUserName": "Customer",
"scriptId": "",
"peerId": "",
"externalCampaign": ,
"skipEnabled": ,
"provider": "PureCloud Callback",
"timeoutSeconds": ,
"connectedTime": "",
"afterCallWorkRequired": ,
"additionalProperties": {}
},
"outboundContact": {
"id": "",
"contactListId": "",
"data": {},
"callable": ,
"phoneNumberStatus": {
"Phone": {
"callable":
}
},
"selfUri": "/api/v2/outbound/contactlists//contacts/"
},
"outboundCampaign": {
"id": "",
"name": "",
"dateCreated": "",
"dateModified": "",
"version": ,
"contactList": {
"id": "",
"name": "",
"selfUri": "/api/v2/outbound/contactlists/"
},
"queue": {
"id": "",
"name": "",
"selfUri": "/api/v2/routing/queues/"
},
"dialingMode": "preview",
"script": {
"id": "",
"name": "",
"selfUri": "/api/v2/scripts/published/"
},
"campaignStatus": "",
"phoneColumns": [
{
"columnName": "",
"type": ""
}
],
"abandonRate": ,
"dncLists": [],
"callerName": "",
"callerAddress": "",
"outboundLineCount": ,
"ruleSets": [],
"skipPreviewDisabled": ,
"previewTimeOutSeconds": ,
"singleNumberPreview": ,
"alwaysRunning": ,
"noAnswerTimeout": ,
"priority": ,
"contactListFilters": [],
"division": {
"id": "",
"name": "",
"selfUri": "/api/v2/authorization/divisions/"
},
"selfUri": "/api/v2/outbound/campaigns/"
},
"dialerPreview": {
"id": "",
"contactId": "",
"contactListId": "",
"campaignId": "",
"phoneNumberColumns": [
{
"columnName": "",
"type": "",
"additionalProperties": {}
}
],
"additionalProperties": {}
}
}
|
When popping from a web chat interaction, the Script.Data layer is derived from a subset of the conversation's data and the response from a Genesys Cloud API:
-
The agentChat and customerChat objects are sourced from the chats array within the participant object that has purpose of agent and customer respectively.
-
The chatData object is sourced from a Genesys Cloud API response's entities object. It has the lastCustomerMessage and customerActive keys added on to the original response.
-
The contents of chatData are updated automatically whenever a message is sent by any participant.
-
The chatData.messages[i].sender.id key is linked to the agentChat.id and customerChat.id keys, rather than the standard participant GUIDs.
-
Known bodyType values are member-join, member-leave, and standard. If standard, there will be an additional body key that contains the message text.
-
Join and leave messages may be seen for entities other than the agent and customer - for instance internal queue and automation processes may be registered. These will commonly need to be filtered out.
-
The messages within chatData.messages are ordered reverse chronologically, with the most recent message being the first element in the array and the oldest message being the last element in the array.
Below is an example data structure, showing three message items (join, message, and leave) and the default awakenPopCampaign keyname used to specify the Campaign to be popped:
{
"conversationId": "",
"agentParticipantId": "",
"customerParticipantId": "",
"awakenDisconnectOnClose": ,
"awakenOutcomeCode": "",
"awakenOutcomeComments": "",
"agentChat": {
"state": "connected",
"id": "",
"provider": "PureCloud Webchat v2",
"held": ,
"connectedTime": "",
"afterCallWorkRequired": ,
"additionalProperties": {}
},
"customerChat": {
"state": "connected",
"id": "",
"provider": "PureCloud Webchat v2",
"held": ,
"connectedTime": "",
"afterCallWorkRequired": ,
"additionalProperties": {},
"attributes": {
"context.": "",
"context._genesys_url": "",
"context._genesys_source": "web",
"context._genesys_pageTitle": "",
},
},
"chatData": {
"lastCustomerMessage": "",
"messages": [
{
"id": "",
"conversation": {
"id": "",
"selfUri": "/api/v2/conversations/"
},
"sender": {
"id": ""
},
"bodyType": "member-leave",
"timestamp": "",
"selfUri": "/api/v2/conversations/chats//messages/"
},
{
"id": "",
"conversation": {
"id": "",
"selfUri": "/api/v2/conversations/"
},
"sender": {
"id": ""
},
"body": "",
"bodyType": "standard",
"timestamp": "",
"selfUri": "/api/v2/conversations/chats//messages/"
},
{
"id": "",
"conversation": {
"id": "",
"selfUri": "/api/v2/conversations/"
},
"sender": {
"id": ""
},
"bodyType": "member-join",
"timestamp": "",
"selfUri": "/api/v2/conversations/chats//messages/>"
}
],
"customerActive":
}
}
|
|