Hi team,
I have an internal data action to get participant data from interactions that we use from Scripter to collect customer data used in scripts and openUrl actions and things.
I have a case where I'm attempting to return a small library of data from the GET /api/v2/conversations/calls/${input.conversationId} endpoint and some of the attributes I am expecting are not present. This is a valid use case, as the library of participant data will depend on the path the customer took through the Architect flow, or whether or not they were found in customer ID API calls etc..
My problem is that the missing attributes are not being populated by my translationMapDefault values. This is causing an error when the Data Action attempts to apply the output translation, as some attributes don't have values.
Here is my translation Map that picks up the customer attributes:
{
"AttributeA": "$.participants[?(@.purpose =="customer")].attributes.AttributeA",
"AttributeB": "$.participants[?(@.purpose == "customer")].attributes.AttributeB",
"AttributeC": "$.participants[?(@.purpose == "customer")].attributes.AttributeC",
"AttributeD": "$.participants[?(@.purpose == "customer")].attributes.AttributeD",
"AttributeE": "$.participants[?(@.purpose == "customer")].attributes.AttributeE",
"AttributeF": "$.participants[?(@.purpose == "customer")].attributes.AttributeF",
"AttributeG": "$.participants[?(@.purpose == "customer")].attributes.AttributeG"
}
Here is my translationMapDefaults that I expect to fill the gaps:
{
"AttributeA": "["Billing1", "Billing2"]",
"AttributeB": "["Peter", "Piper"]",
"AttributeC": "["Peanuts", "Potatoes"]",
"AttributeD": "["0000000000", "1111111111"]",
"AttributeE": "["false", "true"]",
"AttributeF": "["false", "true"]",
"AttributeG": "["0000", "1111"]"
}
Here's what is inside the customer participant returned from the api (no AttributeC, AttributeE or AttributeG value):
"attributes": {
"AttributeA": "Billing2",
"AttributeB": "7184436708",
"AttributeD": "1481975438",
"Result": "0",
"AttributeF": "true",
"CustomerIdDebug": "Failed with search term: tel:+61XXXXXXXXX",
"DebugStep": "Customer ID By Account Success"
}
Here's the resolved translation map:
{
"AttributeA": "[ "Billing2" ]",
"AttributeB": "[ "7184436708" ]",
"AttributeC": "[ ]",
"AttributeD": "[ "1481975438" ]",
"AttributeE": "[ ]",
"AttributeF": "[ "true" ]",
"rawResult":
"AttributeG": "[ ]"
}
And here's the error I'm getting:
{
"message": "Transform failed to process result using 'successTemplate' template due to error:'Unexpected character (',' (code 44)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n at [Source: (String)"{\n "AttributeA": "Billing2", "AttributeB": "7184436708", "AttributeC": , "AttributeD": "1481975438", "AttributeE": "true", "AttributeF": , "AttributeG": }"; line: 2, column: 67]'\n Template:'{\n "AttributeA": ${successTemplateUtils.firstFromArray(${AttributeA})}, "AttributeB": ${successTemplateUtils.firstFromArray(${AttributeB})}, "AttributeC": ${successTemplateUtils.firstFromArray(${AttributeC})}, "AttributeD": ${successTemplateUtils.firstFromArray(${AttributeD})}, "AttributeE": ${successTemplateUtils.firstFromArray(${AttributeE})}, "AttributeF": ${successTemplateUtils.firstFromArray(${AttributeF})}, "AttributeG": ${successTemplateUtils.firstFromArray(${AttributeG})}}'.",
"code": "bad.request",
"status": 400,
"messageParams": {},
"contextId": "f7f30dc9-4861-461d-b58e-2005fb48bc94",
"details": [
{
"errorCode": "ACTION.PROCESSING"
}
],
"errors": []
}
Anyone have any idea why aren't my defaults being used in this case?
Cheers,
Andy