Display participant Attributes in the Script

Hi

I have a question related to display the participant attributes in the Script.

While the agent is on the call with a customer, the agent performs some task in the CRM, the CRM sends the participant attributes (customer participant). via the API.

https://developer.mypurecloud.com/api/rest/v2/conversations/#patch-api-v2-conversations--conversationId--participants--participantId--attributes

We need to display that data in the Scripts, my thought would be have a button on the script, Agent clicks on the button, the button invoke a Data Action to call. the Data action points to https://developer.mypurecloud.com/api/rest/v2/conversations/#get-api-v2-conversations

extract the customer participant attributes from the conversation.

the conversation api's response is very complex, I wonder if anyone can help to me extract the customer participant attributes in the Data action. (or is there any script we can use within the Data action to extract).

Can you give an example of the conversation API response and what data you are trying to extract from it?

I need to extract the participant attributes of the 'Customer/External' party.

I have got it working with a Data Action. just post the solution here, in case someone asking in the future.

Configuration
Request URL Template (GET)
/api/v2/conversations/${input.conversationId}

Request
{
  "requestUrlTemplate": "/api/v2/conversations/${input.conversationId}",
  "requestType": "GET",
  "headers": {
    "Content-Type": "application/json; charset=UTF-8"
  },
  "requestTemplate": "${input.rawRequest}"
}

Response

    {
      "translationMap": {
        "customerAttributes": "$.participants[?(@.purpose =='customer')].attributes"
      },
      "translationMapDefaults": {},
      "successTemplate": "${successTemplateUtils.firstFromArray(\"${customerAttributes}\")}"
    }

Input Contract

{
  "title": "ConversationRequest",
  "type": "object",
  "properties": {
    "conversationId": {
      "type": "string"
    }
  },
  "additionalProperties": true
}

Output Contract

{
  "title": "CustAttr",
  "type": "object",
  "properties": {
    "ExampleAttribute1": {
      "type": "string"
    },
    "ExampleAttribute2": {
      "type": "string"
    }
  },
  "additionalProperties": true
}

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.