Genesys Cloud - Developer Community!

 View Only

Sign Up

Expand all | Collapse all

Call Data Action Translation Map Errors When Retrieving Queue ID from Conversations Messages API

  • 1.  Call Data Action Translation Map Errors When Retrieving Queue ID from Conversations Messages API

    Posted 4 hours ago

    Hi All,

    I'm hoping someone here can help me with a call data action I'm trying to build. I'm currently using the following endpoint:

    /api/v2/conversations/messages/{ConversationID}

    The goal is to use the conversation ID to retrieve the most recent queue ID and then redirect the message to that queue, along with the skill used during the transfer. However, when I attempt to configure the translation map, I am encountering several errors.

    The error I receive is:

    Resolve translation map: Failed while processing the translation map. Could not resolve value for the key: 'queueID' and no default value was configured. Additional details: Expected to find an object with property ['queue'] in path $['participants'] but found 'java.util.ArrayList'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JsonSmartJsonProvider'.

    Below is the translation map I am using:

    {
      "translationMap": {
        "queueID": "$.participants.queue.ID"
      },
      "translationMapDefaults": {},
      "successTemplate": "{queueID\":${queueID}"
    }
    

    I appreciate that this example doesn't yet include the skill mapping, but at this stage, simply retrieving the last queue ID would be considered a success.

    Thanks in advance for any guidance or suggestions.


    #DataActions

    ------------------------------
    Hannah Wrigley
    Contact Manager, Bupa Global Change & IT, BGUK Technology
    ------------------------------


  • 2.  RE: Call Data Action Translation Map Errors When Retrieving Queue ID from Conversations Messages API

    Posted 4 hours ago
    Edited by Kaio Oliveira 4 hours ago

    Olá Hannah, 

     
     
    I beleave your error is happening because the participants field returned by /api/v2/conversations/messages/{conversationId} is an array, not a JSON object.
     
    In your translation map you are trying to access it as if it were an object "$.participants.queue.ID", but since participants is a list, the JSONPath engine expects you to iterate or filter the array first.
     
    Typically, the queue information is found on the ACD participant, so you need to filter the array to find that participant before accessing the queue object.
     
    For example:
     
    $.participants[?(@.purpose=='acd')].queue.id
     
    Your translation map could look like this:
     
    {
      "translationMap": {
        "queueID": "$.participants[?(@.purpose=='acd')].queue.id"
      },
      "translationMapDefaults": {},
      "successTemplate": "{\"queueID\": \"${queueID}\"}"
    }
     
    However, depending on the conversation flow, there may be multiple ACD participants (for example after transfers). If your goal is to retrieve the most recent queue, you might need to handle the returned array and select the last value.
    I hope this helps.



    ------------------------------
    Kaio Oliveira
    GCP - GCQM - GCS - GCA - GCD - GCO - GPE & GPR - GCWM

    PS.: I apologize if there are any mistakes in my English; my primary language is Portuguese-Br.
    ------------------------------