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.
 

Email

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": "<Conversation GUID>",
     "agentParticipantId": "<Agent participant GUID>",
     "customerParticipantId": "<Customer participant GUID>",
     "awakenDisconnectOnClose": <Boolean>,
     "awakenOutcomeCode": "<Conversation wrap-up to be set string>",
     "awakenOutcomeComments": "<Conversation notes to be set string>",
     "customerEmail": {
          "id": "<Message GUID>",
          "to": [
               {
                    "email": "<Recipient email string>",
                    "name": "<Recipient email string>"
               }
          ],
          "cc": [{...}],
          "bcc": [{...}],
          "from": {
               "email": "<Sender email string>",
               "name": "<Sender name string>"
          },
          "subject": "<Email subject string>",
          "attachments": [
               {
                    "attachmentId": "<Attachment ID string>",
                    "name": "<Attachment filename string>",
                    "contentUri": "<Attachment path string>",
                    "contentType": "<Attachment MIME type string>",
                    "contentLength": <Attachment size in bytes integer>,
                    "inlineImage": <Boolean>
               }
          ],
          "textBody": "<Email body plaintext string>",
          "htmlBody": "<Email body HTML string>",
          "time": "<ISO 8601 datetime string>",
          "historyIncluded": <Boolean>,
          "selfUri": "/api/v2/conversations/emails/<Conversation GUID>/messages/<Message GUID>"
     }
}
 
 

Inbound

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": "<Conversation GUID>",
     "agentParticipantId": "<Agent participant GUID>",
     "customerParticipantId": "<Customer participant GUID>",
     "awakenDisconnectOnClose": <Boolean>,
     "awakenOutcomeCode": "<Conversation wrap-up to be set string>",
     "awakenOutcomeComments": "<Conversation notes to be set string>",
     "agentCall": {
          "id": "<Agent participant GUID>",
          "state": "<State string>",
          "recording": <Boolean>,
          "recordingState": "<State string>",
          "muted": <Boolean>,
          "confined": <Boolean>,
          "held": <Boolean>,
          "direction": "inbound",
          "self": {
               "nameRaw": "<Agent username string>",
               "addressNormalized": "<Agent normalised address string>",
               "addressRaw": "<Agent raw address string>",
               "addressDisplayable": "<Displayable string>",
               "additionalProperties": {}
          },
          "other": {
               "name": "<Customer name string>",
               "nameRaw": "<Customer raw name string>",
               "addressNormalized": "<Customer normalised address string>",
               "addressRaw": "<Customer raw address string>",
               "addressDisplayable": "<Displayable string>",
               "additionalProperties": {}
          },
          "provider": "Edge",
          "peerId": "<Peer GUID>",
          "connectedTime": "<ISO 8601 datetime string>",
          "afterCallWorkRequired": <Boolean>,
          "additionalProperties": {}
     },
     "customerCall": {
          "id": "<Customer participant GUID>",
          "state": "<State string>",
          "recording": <Boolean>,
          "recordingState": "<State string>",
          "muted": <Boolean>,
          "confined": <Boolean>,
          "held": <Boolean>,
          "direction": "inbound",
          "self": {
               "name": "<Customer name string>",
               "nameRaw": "<Customer raw name string>",
               "addressNormalized": "<Customer normalised address string>",
               "addressRaw": "<Customer raw address string>",
               "addressDisplayable": "<Displayable string>",
               "additionalProperties": {}
          },
          "other": {
               "name": "<Name string>",
               "nameRaw": "<Name raw string>",
               "addressNormalized": "<Normalised address the customer dialled string>",
               "addressRaw": "<Raw address the customer dialled string>",
               "addressDisplayable": "<Displayable string>",
               "additionalProperties": {}
          },
          "provider": "Edge",
          "connectedTime": "<ISO 8601 datetime string>",
          "afterCallWorkRequired": <Boolean>,
          "additionalProperties": {}
     }
}
 
 

Outbound - Predictive

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 outboundContact object is sourced from a Genesys Cloud API response object.
  • The data sub-object contains a list of the column names and values attached to the current contact in the contact list.
  • The outboundCampaign object is sourced from a Genesys Cloud API response object.
     
{
     "conversationId": "<Conversation GUID>",
     "agentParticipantId": "<Agent participant GUID>",
     "customerParticipantId": "<Customer participant GUID>",
     "awakenDisconnectOnClose": <Boolean>,
     "awakenOutcomeCode": "<Conversation wrap-up to be set string>",
     "awakenOutcomeComments": "<Conversation notes to be set string>",
     "dialerInteractionId": "<Preview interaction GUID>",
     "dialerCampaignId": "<Preview campaign GUID>",
     "dialerContactListId": "<Contact list GUID>",
     "dialerContactId": "<Contact list ID string>",
     "dialingMode": "predictive",
     "agentCall": {
          "id": "<Agent participant GUID>",
          "state": "<State string>",
          "recording": <Boolean>,
          "recordingState": "<State string>",
          "muted": <Boolean>,
          "confined": <Boolean>,
          "held": <Boolean>,
          "direction": "inbound",
          "self": {
               "nameRaw": "<Agent username string>",
               "addressNormalized": "<Agent normalised address string>",
               "addressRaw": "<Agent raw address string>",
               "addressDisplayable": "<Displayable string>",
               "additionalProperties": {}
          },
          "other": {
               "name": "<Customer name string>",
               "nameRaw": "<Customer raw name string>",
               "addressNormalized": "<Customer normalised address string>",
               "addressRaw": "<Customer raw address string>",
               "addressDisplayable": "<Displayable string>",
               "additionalProperties": {}
          },
          "provider": "Edge",
          "peerId": "<Peer GUID>",
          "connectedTime": "<ISO 8601 datetime string>",
          "afterCallWorkRequired": <Boolean>,
          "additionalProperties": {}
     },
     "customerCall": {
          "id": "<Customer participant GUID>",
          "state": "<State string>",
          "recording": <Boolean>,
          "recordingState": "<State string>",
          "muted": <Boolean>,
          "confined": <Boolean>,
          "held": <Boolean>,
          "direction": "inbound",
          "self": {
               "name": "<Customer name string>",
               "nameRaw": "<Customer raw name string>",
               "addressNormalized": "<Customer normalised address string>",
               "addressRaw": "<Customer raw address string>",
               "addressDisplayable": "<Displayable string>",
               "additionalProperties": {}
          },
          "other": {
               "name": "<Name string>",
               "nameRaw": "<Name raw string>",
               "addressNormalized": "<Normalised address the customer dialled string>",
               "addressRaw": "<Raw address the customer dialled string>",
               "addressDisplayable": "<Displayable string>",
               "additionalProperties": {}
          },
          "provider": "Edge",
          "peerId": "<Peer GUID>",
          "connectedTime": "<ISO 8601 datetime string>",
          "afterCallWorkRequired": <Boolean>,
          "additionalProperties": {}
     },
     "outboundContact": {
          "id": "<Contact ID string>",
          "contactListId": "<Contact list GUID>",
          "data": {...},
          "callable": <Boolean>,
          "phoneNumberStatus": {
               "Phone": {
                    "callable": <Boolean>
               }
          },
          "selfUri": "/api/v2/outbound/contactlists/<Contact list GUID>/contacts/<Contact ID string>"
     },
     "outboundCampaign": {
          "id": "<Campaign GUID>",
          "name": "<Campaign name string>",
          "dateCreated": "<ISO 8601 datetime string>",
          "dateModified": "<ISO 8601 datetime string>",
          "version": <Integer>,
          "contactList": {
               "id": "<Contact list GUID>",
               "name": "<Contact list name string>",
               "selfUri": "/api/v2/outbound/contactlists/<Contact list GUID>"
          },
          "queue": {
               "id": "<Queue GUID>",
               "name": "<Queue name string>",
               "selfUri": "/api/v2/routing/queues/<Queue GUID>"
          },
          "dialingMode": "predictive",
          "script": {
               "id": "<Script GUID>",
               "name": "<Script name string>",
               "selfUri": "/api/v2/scripts/published/<Script GUID>"
          },
          "site": {
               "id": "<Site GUID>",
               "name": "<Site name string>",
               "selfUri": "/api/v2/telephony/providers/edges/sites/<Site GUID>"
          },
          "campaignStatus": "<Status string>",
          "phoneColumns": [
               {
                    "columnName": "<Name string>",
                    "type": "<Type string>"
               }
          ],
          "abandonRate": <Integer>,
          "dncLists": [],
          "callAnalysisResponseSet": {
               "id": "<Response set GUID>",
               "name": "<Response set name string>",
               "selfUri": "/api/v2/outbound/callanalysisresponsesets/<Response set GUID>"
          },
          "callerName": "<Contact name string>",
          "callerAddress": "<E.164-formatted phone number string>",
          "outboundLineCount": <Integer>,
          "ruleSets": [],
          "skipPreviewDisabled": <Boolean>,
          "previewTimeOutSeconds": <Integer>,
          "singleNumberPreview": <Boolean>,
          "alwaysRunning": <Boolean>,
          "noAnswerTimeout": <Integer>,
          "priority": <Integer>,
          "contactListFilters": [],
          "division": {
               "id": "<Division GUID>",
               "name": "<Division name string>",
               "selfUri": "/api/v2/authorization/divisions/<Division GUID>"
          },
          "selfUri": "/api/v2/outbound/campaigns/<Campaign GUID>"
     }
}
 
 

Outbound - Preview

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 outboundContact object is sourced from a Genesys Cloud API response object.
  • The data sub-object contains a list of the column names and values attached to the current contact in the contact list.
  • The outboundCampaign object is sourced from a Genesys Cloud API response object.
  • The dialerPreview object is a replica of the agentCallback.dialerPreview object.
 
Below is an example data structure:
{
     "conversationId": "<Conversation GUID>",
     "agentParticipantId": "<Agent participant GUID>",
     "customerParticipantId": "<Customer participant GUID>",
     "awakenDisconnectOnClose": <Boolean>,
     "awakenOutcomeCode": "<Conversation wrap-up to be set string>",
     "awakenOutcomeComments": "<Conversation notes to be set string>",
     "dialerInteractionId": "<Preview interaction GUID>",
     "dialerCampaignId": "<Campaign GUID>",
     "dialerContactListId": "<Contact list GUID>",
     "dialerContactId": "<Contact ID string>",
     "dialingMode": "preview",
     "agentCallback": {
          "state": "<Callback state string>",
          "id": "<Callback GUID>",
          "held": <Boolean>,
          "dialerPreview": {
               "id": "<Preview interaction GUID>",
               "contactId": "<Contact ID string>",
               "contactListId": "<Contact list GUID>",
               "campaignId": "<Campaign GUID>",
               "phoneNumberColumns": [
                    {
                         "columnName": "<Contact column name string>",
                         "type": "<Contact column type string>",
                         "additionalProperties": {}
                    }
               ],
               "additionalProperties": {}
          },
          "callbackNumbers": [
               "<E.164-formatted phone number string>"
          ],
          "callbackUserName": "Customer",
          "scriptId": "<Script GUID>",
          "peerId": "<Peer GUID>",
          "externalCampaign": <Boolean>,
          "skipEnabled": <Boolean>,
          "provider": "PureCloud Callback",
          "timeoutSeconds": <Integer>,
          "connectedTime": "<ISO 8601 datetime string>",
          "afterCallWorkRequired": <Boolean>,
          "additionalProperties": {}
     },
     "outboundContact": {
          "id": "<Contact ID string>",
          "contactListId": "<Contact list GUID>",
          "data": {...},
          "callable": <Boolean>,
          "phoneNumberStatus": {
               "Phone": {
                    "callable": <Boolean>
               }
          },
          "selfUri": "/api/v2/outbound/contactlists/<Contact list GUID>/contacts/<Contact ID string>"
     },
     "outboundCampaign": {
          "id": "<Campaign GUID>",
          "name": "<Campaign name string>",
          "dateCreated": "<ISO 8601 datetime string>",
          "dateModified": "<ISO 8601 datetime string>",
          "version": <Integer>,
          "contactList": {
               "id": "<Contact list GUID>",
               "name": "<Contact list name string>",
               "selfUri": "/api/v2/outbound/contactlists/<Contact list GUID>"
          },
          "queue": {
               "id": "<Queue GUID>",
               "name": "<Queue name string>",
               "selfUri": "/api/v2/routing/queues/<Queue GUID>"
          },
          "dialingMode": "preview",
          "script": {
               "id": "<Script GUID>",
               "name": "<Script name string>",
               "selfUri": "/api/v2/scripts/published/<Script GUID>"
          },
          "campaignStatus": "<Status string>",
          "phoneColumns": [
               {
                    "columnName": "<Name string>",
                    "type": "<Type string>"
               }
          ],
          "abandonRate": <Integer>,
          "dncLists": [],
          "callerName": "<Contact name string>",
          "callerAddress": "<E.164-formatted phone number string>",
          "outboundLineCount": <Integer>,
          "ruleSets": [],
          "skipPreviewDisabled": <Boolean>,
          "previewTimeOutSeconds": <Integer>,
          "singleNumberPreview": <Boolean>,
          "alwaysRunning": <Boolean>,
          "noAnswerTimeout": <Integer>,
          "priority": <Integer>,
          "contactListFilters": [],
          "division": {
               "id": "<Division GUID>",
               "name": "<Division name string>",
               "selfUri": "/api/v2/authorization/divisions/<Division GUID>"
          },
          "selfUri": "/api/v2/outbound/campaigns/<Campaign GUID>"
     },
     "dialerPreview": {
          "id": "<Preview interaction GUID>",
          "contactId": "<Contact ID string>",
          "contactListId": "<Contact list GUID>",
          "campaignId": "<Campaign GUID>",
          "phoneNumberColumns": [
               {
                    "columnName": "<Contact column name string>",
                    "type": "<Contact column type string>",
                    "additionalProperties": {}
               }
          ],
          "additionalProperties": {}
     }
}
 
 

Web Chat

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": "<Conversation GUID>",
     "agentParticipantId": "<Agent participant GUID>",
     "customerParticipantId": "<Customer participant GUID>",
     "awakenDisconnectOnClose": <Boolean>,
     "awakenOutcomeCode": "<Conversation wrap-up to be set string>",
     "awakenOutcomeComments": "<Conversation notes to be set string>",
     "agentChat": {
          "state": "connected",
          "id": "<Agent chat GUID>",
          "provider": "PureCloud Webchat v2",
          "held": <Boolean>,
          "connectedTime": "<ISO 8601 datetime string>",
          "afterCallWorkRequired": <Boolean>,
          "additionalProperties": {}
     },
     "customerChat": {
          "state": "connected",
          "id": "<Customer chat GUID>",
          "provider": "PureCloud Webchat v2",
          "held": <Boolean>,
          "connectedTime": "<ISO 8601 datetime string>",
          "afterCallWorkRequired": <Boolean>,
          "additionalProperties": {},
          "attributes": {
               "context.awakenPopCampaign": "<Targeted Awaken campaign>",
               "context._genesys_url": "<Chat widget's source URL>",
               "context._genesys_source": "web",
               "context._genesys_pageTitle": "",
               ...
          },
          ...
     },
     "chatData": {
          "lastCustomerMessage": "<Message string>",
          "messages": [
               {
                    "id": "<Message GUID>",
                    "conversation": {
                         "id": "<Conversation GUID>",
                         "selfUri": "/api/v2/conversations/<Conversation GUID>"
                    },
                    "sender": {
                         "id": "<Chat participant GUID>"
                    },
                    "bodyType": "member-leave",
                    "timestamp": "<ISO 8601 datetime string>",
                    "selfUri": "/api/v2/conversations/chats/<Conversation GUID>/messages/<Message GUID>"
               },
               {
                    "id": "<Message GUID>",
                    "conversation": {
                         "id": "<Conversation GUID>",
                         "selfUri": "/api/v2/conversations/<Conversation GUID>"
                    },
                    "sender": {
                         "id": "<Chat participant GUID>"
                    },
                    "body": "<Message string>",
                    "bodyType": "standard",
                    "timestamp": "<ISO 8601 datetime string>",
                    "selfUri": "/api/v2/conversations/chats/<Conversation GUID>/messages/<Message GUID>"
               },
               {
                    "id": "<Message GUID>",
                    "conversation": {
                         "id": "<Conversation GUID>",
                         "selfUri": "/api/v2/conversations/<Conversation GUID>"
                    },
                    "sender": {
                         "id": "<Chat participant GUID>"
                    },
                    "bodyType": "member-join",
                    "timestamp": "<ISO 8601 datetime string>",
                    "selfUri": "/api/v2/conversations/chats/<Conversation GUID>/messages/<Message GUID>"
               }
          ],
          "customerActive": <Boolean>
     }
}