Legacy Dev Forum Posts

 View Only

Sign Up

Display participant Attributes in the Script

  • 1.  Display participant Attributes in the Script

    Posted 06-05-2025 19:10

    yuezhong | 2020-05-23 11:17:29 UTC | #1

    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).


    Jason_Mathison | 2020-05-26 11:51:56 UTC | #2

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


    yuezhong | 2020-05-26 12:17:16 UTC | #3

    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 }


    system | 2020-06-26 12:17:19 UTC | #4

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


    This post was migrated from the old Developer Forum.

    ref: 7872