Get Survey Information

If you want to ask the customer to fill out a survey about the conversation with the agent, you can get the conversation's session ID and engagement ID when the chat session is established, and then pass those values to a survey service when the conversation ends.

Let's say, for example, that you used a survey service such as Oracle Feedback Cloud Service to develop a survey which takes session and engagement parameters. When the agent conversation ends, you can display a link to the survey form, such as https://example.com?session=12345&surveyid=12345. Here's how to use the System.AgentInitiation component's chatResponseVariable property to get the IDs that you need, and then use the System.AgentConversation.conclusionMessage property to pass them in a link to a survey service.

When the chat session is established with the live agent, Oracle B2C Service sends the following payload for channels that are created in version 20.1 and later and connect to Oracle B2C Service 19A and later. This is referred to as the standard format.

{
  "sessionId": "string", // agent session id
  "completedSurveyId": int,
  "engagementId": int,  // survey id
  "cancelledSurveyId": int
}

For channels were created prior to 20.1, and for channels that connect to a Oracle B2C Service instance that's earlier than 19A, it sends this payload. This is referred to as the legacy format.

{
  "sessionId": "string", // agent session id

  "completedSurveyId": {
    "id": int
  },

  "engagementId": { // survey id
    "id": int
  },

  "cancelledSurveyId": {
    "id": int
  }
}

The dialog engine stores this payload in the map variable that's referenced by the System.AgentInitiation.chatResponseVariable property. (If System.AgentInitiation.chatResponseVariable isn't defined, then the payload is discarded.)

In the following example that uses the standard format, the System.AgentConversation component outputs a survey link after the agent conversation ends. The link includes the session and engagement ID from the map that was named by the chatResponseVariable property.

context:
  variables:
    agentSystemResponse: "map" # chat request response is stored in this variable.
    ...
states:
  ...
  agentInitiation:
    component: "System.AgentInitiation"
    properties:
      agentChannel: "B2CServiceIntegration"
      nlpResultVariable: "iResult"
      chatResponseVariable: "agentSystemResponse"  
    transitions:
      actions:
        accepted: "agentConversation"
        rejected: "tryAgain"
        error: "tryAgain"
  agentConversation:
    component: "System.AgentConversation"
    properties:
      agentChannel: "B2CServiceIntegration"
      nlpResultVariable: "iResult"
      exitKeywords: "bye, exit, take care, goodbye, quit"
      expiryMessage: "Your chat with the agent timed out."
      conclusionMessage: "Can you please fill out this survey: <PUT SURVEY URL HERE>?session=${agentSystemResponse.value.sessionId}&surveyid=${agentSystemResponse.value.engagementId}"
    transitions:
      next: "endPrompt"
      actions:
        agentLeft: "endPrompt"
        expired: "sessionExpired"
        error: "agentConversationError"

Tip:

You can configure the survey to take other parameters, such as the user's name and email address.