Legacy Dev Forum Posts

 View Only

Sign Up

Error trying to extract communicationId for messaging

  • 1.  Error trying to extract communicationId for messaging

    Posted 06-05-2025 18:46

    Marcelo_Casana | 2024-06-20 15:14:40 UTC | #1

    Hello everyone!

    I am having problems extracting the communicationId in my data action, I have tried different configurations but it always comes empty. Could someone tell me if they see that I am doing something wrong?

    I attach the data action, thank you!

    Get-Interaction-Data-TF-20240620121416.custom.json|attachment (1.3 KB)


    Jason_Mathison | 2024-06-20 15:51:12 UTC | #2

    Please provide an example of the response you are getting from the endpoint (it will show as the output of the "execute" step). Feel free to replace any sensitive data in the response, but make sure not to change the shape of it.


    Jason_Mathison | 2024-06-20 15:53:30 UTC | #3

    Also, I suggest using this tool to work on your jsonpath. https://www.javainuse.com/jsonpath

    This isn't an endpoint that I control, so my same comments around redacting any sensitive data apply.

    --Jason


    Marcelo_Casana | 2024-06-20 17:27:34 UTC | #4

    Jason, thank you very much for the response.

    This is what endpoint returns to me. I think that "communicationId" here is participants.message.id, right? that is what im trying to get in the data action.

    {
      "id": "8e892687-32d4-45ae-b596-852438d6e9e8",
      "startTime": "2024-06-18T19:51:38.212Z",
      "participants": [
        {
          "id": "4d6eea21-4abf-4167-b1ff-db322c6b388c",
          "startTime": "2024-06-18T19:51:38.212Z",
          "connectedTime": "2024-06-18T19:51:38.212Z",
          "externalContactId": "bf09ad18-e0a5-494b-bf8f-f7c1d4767ac5",
          "queueId": "bea61b84-2d59-486b-9631-64b565120866",
          "queueName": "CHAT_Tienda_Movil",
          "purpose": "customer",
          "wrapupRequired": false,
          "mediaRoles": [
            "full"
          ],
          "attributes": {
            "name": "Test Accesa",
            "customId": "890e75a8-f043-4955-a222-c0312f7a769c",
            "email": "accesa@accesa.com.uy"
          },
          "calls": [],
          "callbacks": [],
          "chats": [],
          "cobrowsesessions": [],
          "emails": [],
          "messages": [
            {
              "state": "connected",
              "initialState": "connected",
              "id": "07100cc9-98d4-4a9d-9523-690b2e76135a",
              "held": false,
              "segments": [
                {
                  "startTime": "2024-06-18T19:51:38.212Z",
                  "type": "Interact"
                }
              ],
              "direction": "inbound",
              "connectedTime": "2024-06-18T19:51:38.230Z",
              "provider": "PureCloud Messaging",
              "type": "webmessaging",
              "peerId": "5105101d-cac5-4d67-8e44-6cdcf3528518",
              "toAddress": {
                "name": "CHAT_Tienda_Movil",
                "addressNormalized": "683f53db-d3e5-4e55-8b3d-2c408e9804e0",
                "addressRaw": "683f53db-d3e5-4e55-8b3d-2c408e9804e0"
              },
              "fromAddress": {
                "addressNormalized": "f5f73787-2939-45fe-99c5-0bdf53368882",
                "addressRaw": "f5f73787-2939-45fe-99c5-0bdf53368882"
              },
              "messages": [
                {
                  "messageId": "f55512afb24e76d22dbe19afd9bd2e77",
                  "messageURI": "/api/v2/conversations/messages/8e892687-32d4-45ae-b596-852438d6e9e8/messages/f55512afb24e76d22dbe19afd9bd2e77",
                  "messageStatus": "received",
                  "messageSegmentCount": 1,
                  "messageTime": "2024-06-18T19:51:38.212Z",
                  "media": [],
                  "stickers": [],
                  "messageMetadata": {
                    "type": "Event",
                    "events": [
                      {
                        "eventType": "Presence",
                        "subType": "Join"
                      }
                    ],
                    "content": []
                  }
                }
              ],
              "journeyContext": {
                "customer": {
                  "id": "e63c8bae-5ed4-46d4-8ab7-98d1e06397eb",
                  "idType": "cookie"
                },
                "customerSession": {
                  "id": "24efb9d0-2dac-11ef-aa78-5b668c01d779",
                  "type": "web"
                }
              },
              "afterCallWork": {},
              "afterCallWorkRequired": false
            }
          ],
          "screenshares": [],
          "socialExpressions": [],
          "videos": []
        },
        {
          "id": "1029e047-1c2a-4f0d-a033-5702192272d5",
          "startTime": "2024-06-18T19:51:38.221Z",
          "endTime": "2024-06-18T19:51:40.126Z",
          "connectedTime": "2024-06-18T19:51:38.221Z",
          "name": "CHAT_Tienda_Movil_Flow",
          "purpose": "workflow",
          "wrapupRequired": false,
          "mediaRoles": [
            "full"
          ],
          "attributes": {},
          "calls": [],
          "callbacks": [],
          "chats": [],
          "cobrowsesessions": [],
          "emails": [],
          "messages": [
            {
              "state": "disconnected",
              "initialState": "connected",
              "id": "9adbeaaf-bf79-4c19-987d-16117551bf18",
              "held": false,
              "segments": [
                {
                  "startTime": "2024-06-18T19:51:38.221Z",
                  "endTime": "2024-06-18T19:51:40.126Z",
                  "type": "Interact",
                  "howEnded": "Disconnect",
                  "disconnectType": "transfer"
                }
              ],
              "direction": "inbound",
              "disconnectType": "transfer",
              "connectedTime": "2024-06-18T19:51:38.270Z",
              "disconnectedTime": "2024-06-18T19:51:40.126Z",
              "provider": "PureCloud Messaging",
              "type": "webmessaging",
              "peerId": "07100cc9-98d4-4a9d-9523-690b2e76135a",
              "toAddress": {
                "addressNormalized": "f5f73787-2939-45fe-99c5-0bdf53368882",
                "addressRaw": "f5f73787-2939-45fe-99c5-0bdf53368882"
              },
              "fromAddress": {
                "name": "CHAT_Tienda_Movil",
                "addressNormalized": "683f53db-d3e5-4e55-8b3d-2c408e9804e0",
                "addressRaw": "683f53db-d3e5-4e55-8b3d-2c408e9804e0"
              },
              "messages": [
                {
                  "messageId": "7e5ac61333267fe5562670f4f711f224",
                  "messageURI": "/api/v2/conversations/messages/8e892687-32d4-45ae-b596-852438d6e9e8/messages/7e5ac61333267fe5562670f4f711f224",
                  "messageStatus": "delivery-success",
                  "messageSegmentCount": 1,
                  "messageTime": "2024-06-18T19:51:38.705Z",
                  "media": [],
                  "stickers": [],
                  "messageMetadata": {
                    "type": "Text",
                    "events": [],
                    "content": []
                  }
                },
                {
                  "messageId": "a7e2a3901512ada474d78097a2096070",
                  "messageURI": "/api/v2/conversations/messages/8e892687-32d4-45ae-b596-852438d6e9e8/messages/a7e2a3901512ada474d78097a2096070",
                  "messageStatus": "delivery-success",
                  "messageSegmentCount": 1,
                  "messageTime": "2024-06-18T19:51:40.029Z",
                  "media": [],
                  "stickers": [],
                  "messageMetadata": {
                    "type": "Text",
                    "events": [],
                    "content": []
                  }
                }
              ],
              "afterCallWork": {},
              "afterCallWorkRequired": false
            }
          ],
          "screenshares": [],
          "socialExpressions": [],
          "videos": []
        },
        {
          "id": "a9f312c9-9f7c-434a-aab9-79ef18a42b8d",
          "startTime": "2024-06-18T19:51:40.171Z",
          "endTime": "2024-06-18T19:51:43.727Z",
          "connectedTime": "2024-06-18T19:51:40.171Z",
          "name": "CHAT_Tienda_Movil",
          "queueId": "bea61b84-2d59-486b-9631-64b565120866",
          "queueName": "CHAT_Tienda_Movil",
          "purpose": "acd",
          "wrapupRequired": false,
          "mediaRoles": [
            "full"
          ],
          "conversationRoutingData": {
            "queue": {
              "id": "bea61b84-2d59-486b-9631-64b565120866",
              "selfUri": "/api/v2/routing/queues/bea61b84-2d59-486b-9631-64b565120866"
            },
            "priority": 0,
            "skills": [],
            "scoredAgents": [],
            "label": "631f0939-be32-495a-baf9-970abb039192"
          },
          "attributes": {},
          "calls": [],
          "callbacks": [],
          "chats": [],
          "cobrowsesessions": [],
          "emails": [],
          "messages": [
            {
              "state": "disconnected",
              "initialState": "connected",
              "id": "3e4bf0b7-8385-44e8-bdb2-c897cd01914c",
              "held": false,
              "segments": [
                {
                  "startTime": "2024-06-18T19:51:40.171Z",
                  "endTime": "2024-06-18T19:51:43.727Z",
                  "type": "Interact",
                  "howEnded": "Disconnect",
                  "disconnectType": "transfer"
                }
              ],
              "direction": "inbound",
              "disconnectType": "transfer",
              "connectedTime": "2024-06-18T19:51:40.228Z",
              "disconnectedTime": "2024-06-18T19:51:43.727Z",
              "provider": "PureCloud Messaging",
              "type": "webmessaging",
              "peerId": "07100cc9-98d4-4a9d-9523-690b2e76135a",
              "toAddress": {
                "addressNormalized": "f5f73787-2939-45fe-99c5-0bdf53368882",
                "addressRaw": "f5f73787-2939-45fe-99c5-0bdf53368882"
              },
              "fromAddress": {
                "name": "CHAT_Tienda_Movil",
                "addressNormalized": "683f53db-d3e5-4e55-8b3d-2c408e9804e0",
                "addressRaw": "683f53db-d3e5-4e55-8b3d-2c408e9804e0"
              },
              "messages": [],
              "afterCallWork": {},
              "afterCallWorkRequired": false
            }
          ],
          "screenshares": [],
          "socialExpressions": [],
          "videos": []
        },
        {
          "id": "4266c007-113e-455a-ab61-a48ab1e26814",
          "startTime": "2024-06-18T19:51:40.360Z",
          "endTime": "2024-06-18T19:52:09.046Z",
          "connectedTime": "2024-06-18T19:51:43.738Z",
          "name": "CHAT_Tienda_Movil",
          "userUri": "/api/v2/users/a5c3b71f-623b-4db4-ba9a-a074eb838e12",
          "userId": "a5c3b71f-623b-4db4-ba9a-a074eb838e12",
          "queueId": "bea61b84-2d59-486b-9631-64b565120866",
          "queueName": "CHAT_Tienda_Movil",
          "purpose": "agent",
          "wrapupRequired": true,
          "wrapupPrompt": "forcedTimeout",
          "wrapupTimeoutMs": 10000,
          "wrapup": {
            "code": "ININ-WRAP-UP-TIMEOUT",
            "tags": [],
            "durationSeconds": 10,
            "endTime": "2024-06-18T19:52:19.046Z"
          },
          "mediaRoles": [
            "full"
          ],
          "conversationRoutingData": {
            "priority": 0,
            "skills": [],
            "scoredAgents": []
          },
          "alertingTimeoutMs": 30000,
          "attributes": {
            "asunto": ""
          },
          "calls": [],
          "callbacks": [],
          "chats": [],
          "cobrowsesessions": [],
          "emails": [],
          "messages": [
            {
              "state": "disconnected",
              "initialState": "alerting",
              "id": "0243671c-2ad4-4765-a4ef-c83de789e6dd",
              "held": false,
              "segments": [
                {
                  "startTime": "2024-06-18T19:51:40.360Z",
                  "endTime": "2024-06-18T19:51:43.738Z",
                  "type": "Alert",
                  "howEnded": "Interact"
                },
                {
                  "startTime": "2024-06-18T19:51:43.738Z",
                  "endTime": "2024-06-18T19:52:09.046Z",
                  "type": "Interact",
                  "howEnded": "Disconnect",
                  "disconnectType": "transfer"
                },
                {
                  "startTime": "2024-06-18T19:52:09.046Z",
                  "endTime": "2024-06-18T19:52:19.046Z",
                  "type": "Wrapup",
                  "howEnded": "Disconnect",
                  "disconnectType": "transfer"
                }
              ],
              "direction": "inbound",
              "disconnectType": "transfer",
              "startAlertingTime": "2024-06-18T19:51:40.383Z",
              "connectedTime": "2024-06-18T19:51:43.738Z",
              "disconnectedTime": "2024-06-18T19:52:09.046Z",
              "provider": "PureCloud Messaging",
              "type": "webmessaging",
              "scriptId": "ec1a47d7-d965-4571-b233-52570a4abe4e",
              "peerId": "07100cc9-98d4-4a9d-9523-690b2e76135a",
              "toAddress": {
                "addressNormalized": "f5f73787-2939-45fe-99c5-0bdf53368882",
                "addressRaw": "f5f73787-2939-45fe-99c5-0bdf53368882"
              },
              "fromAddress": {
                "name": "CHAT_Tienda_Movil",
                "addressNormalized": "683f53db-d3e5-4e55-8b3d-2c408e9804e0",
                "addressRaw": "683f53db-d3e5-4e55-8b3d-2c408e9804e0"
              },
              "messages": [],
              "wrapup": {
                "code": "ININ-WRAP-UP-TIMEOUT",
                "tags": [],
                "durationSeconds": 10,
                "endTime": "2024-06-18T19:52:19.046Z"
              },
              "afterCallWork": {
                "startTime": "2024-06-18T19:52:09.046Z",
                "endTime": "2024-06-18T19:52:19.046Z",
                "state": "complete"
              },
              "afterCallWorkRequired": false,
              "queueMediaSettings": {
                "alertingTimeoutSeconds": 30,
                "enableAutoAnswer": false
              }
            }
          ],
          "screenshares": [],
          "socialExpressions": [],
          "videos": [],
          "startAcwTime": "2024-06-18T19:52:09.046Z",
          "endAcwTime": "2024-06-18T19:52:19.046Z"
        },
        {
          "id": "45250920-2478-43b7-9243-1ce1d54d6480",
          "startTime": "2024-06-18T19:52:09.077Z",
          "connectedTime": "2024-06-18T19:52:09.077Z",
          "name": "Parking_TEST",
          "queueId": "a73e6857-353a-4e89-a470-2a9f57130a82",
          "queueName": "Parking_TEST",
          "purpose": "acd",
          "wrapupRequired": false,
          "mediaRoles": [
            "full"
          ],
          "conversationRoutingData": {
            "queue": {
              "id": "a73e6857-353a-4e89-a470-2a9f57130a82",
              "selfUri": "/api/v2/routing/queues/a73e6857-353a-4e89-a470-2a9f57130a82"
            },
            "priority": 0,
            "skills": [],
            "scoredAgents": [],
            "label": "631f0939-be32-495a-baf9-970abb039192"
          },
          "attributes": {},
          "calls": [],
          "callbacks": [],
          "chats": [],
          "cobrowsesessions": [],
          "emails": [],
          "messages": [
            {
              "state": "connected",
              "initialState": "connected",
              "id": "5105101d-cac5-4d67-8e44-6cdcf3528518",
              "held": false,
              "segments": [
                {
                  "startTime": "2024-06-18T19:52:09.077Z",
                  "type": "Interact"
                }
              ],
              "direction": "inbound",
              "connectedTime": "2024-06-18T19:52:09.188Z",
              "provider": "PureCloud Messaging",
              "type": "webmessaging",
              "peerId": "07100cc9-98d4-4a9d-9523-690b2e76135a",
              "toAddress": {
                "addressNormalized": "f5f73787-2939-45fe-99c5-0bdf53368882",
                "addressRaw": "f5f73787-2939-45fe-99c5-0bdf53368882"
              },
              "fromAddress": {
                "name": "CHAT_Tienda_Movil",
                "addressNormalized": "683f53db-d3e5-4e55-8b3d-2c408e9804e0",
                "addressRaw": "683f53db-d3e5-4e55-8b3d-2c408e9804e0"
              },
              "messages": [],
              "afterCallWork": {},
              "afterCallWorkRequired": false
            }
          ],
          "screenshares": [],
          "socialExpressions": [],
          "videos": []
        }
      ],
      "recordingState": "NONE",
      "divisions": [
        {
          "division": {
            "id": "7e8be380-748b-4a43-b57e-0170bfcb6f29",
            "selfUri": "/api/v2/authorization/divisions/7e8be380-748b-4a43-b57e-0170bfcb6f29"
          },
          "entities": [
            {
              "id": "394f07da-3eef-4fca-95d1-10fcd88440bf",
              "selfUri": "/api/v2/flows/394f07da-3eef-4fca-95d1-10fcd88440bf"
            },
            {
              "id": "bea61b84-2d59-486b-9631-64b565120866",
              "selfUri": "/api/v2/routing/queues/bea61b84-2d59-486b-9631-64b565120866"
            },
            {
              "id": "a5c3b71f-623b-4db4-ba9a-a074eb838e12",
              "selfUri": "/api/v2/users/a5c3b71f-623b-4db4-ba9a-a074eb838e12"
            },
            {
              "id": "4216e28b-0a3a-47e9-a356-c4084ac78d21",
              "selfUri": "/api/v2/flows/4216e28b-0a3a-47e9-a356-c4084ac78d21"
            },
            {
              "id": "a73e6857-353a-4e89-a470-2a9f57130a82",
              "selfUri": "/api/v2/routing/queues/a73e6857-353a-4e89-a470-2a9f57130a82"
            }
          ]
        }
      ],
      "recentTransfers": [
        {
          "id": "dcd57bdd-d0e5-4b52-8e78-9cadd64fb398",
          "state": "Complete",
          "dateIssued": "2024-06-18T19:51:40.105Z",
          "initiator": {},
          "modifiedBy": {},
          "destination": {},
          "transferType": "Unattended"
        },
        {
          "id": "5f690db8-0792-4d25-b299-10545adbd84f",
          "state": "Complete",
          "dateIssued": "2024-06-18T19:51:40.284Z",
          "initiator": {},
          "modifiedBy": {},
          "destination": {
            "userId": "a5c3b71f-623b-4db4-ba9a-a074eb838e12"
          },
          "transferType": "Attended"
        },
        {
          "id": "1f5cfcca-3989-4e66-a82c-39b68be6d6d6",
          "state": "Complete",
          "dateIssued": "2024-06-18T19:52:09.03Z",
          "initiator": {
            "userId": "a5c3b71f-623b-4db4-ba9a-a074eb838e12"
          },
          "modifiedBy": {},
          "destination": {},
          "transferType": "Unattended"
        }
      ],
      "securePause": false,
      "utilizationLabelId": "631f0939-be32-495a-baf9-970abb039192",
      "selfUri": "/api/v2/conversations/8e892687-32d4-45ae-b596-852438d6e9e8"
    }

    And thanks for that recommendation about JsonPath Evaluator, I'll check it out.


    Jason_Mathison | 2024-06-20 17:34:26 UTC | #5

    I can help you out with extracting information from the response, however I don't know what you mean by communicationId if it isn't actually in the response.

    You might find more knowledgeable people in the platformAPI or analytics rooms to help you figure out what it is you need from this response.

    --Jason


    Marcelo_Casana | 2024-06-20 18:04:20 UTC | #6

    Thanks Jason, it would be great if you could also help me correctly extract that element from the answer.

    On the other hand, this need to obtain the communicationId arises from using the api PUT /api/v2/externalcontacts/conversations/{conversationId} which requires the communicationId to function and associate the interaction. I had understood that the first Id that comes in participants.message is the communicationId, otherwise I wouldn't know where to find it


    Jason_Mathison | 2024-06-20 18:59:06 UTC | #7

    If you are looking for the conversation Id, it might be that ID at the very top of the response.


    Marcelo_Casana | 2024-06-20 19:11:35 UTC | #8

    Not really, im trying to use this API PUT /api/v2/externalcontacts/conversations/{conversationId}. And requieres conversationId and communicationId, i have the conversationId, I need the communicationId, which I think should be participants.message.Id, right?


    Jason_Mathison | 2024-06-20 22:33:50 UTC | #9

    I don't know. Have you tested out the API in the API Explorer or postman to see if it works that way?


    Marcelo_Casana | 2024-06-24 12:53:01 UTC | #10

    It worked as expected, could you help me extract the first Id that comes in messages?


    Jason_Mathison | 2024-06-25 13:41:59 UTC | #11

    See if firstFromArray can do what you need https://help.mypurecloud.com/articles/velocity-macros-data-actions/#firstFromArray

    --Jason


    system | 2024-07-26 13:42:59 UTC | #12

    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: 26890