I feel so close but yet so far away and just can't figure this out. I've created a data action using the
/api/v2/speechandtextanalytics/conversations/{conversationId} API. It looks like the input and outputs are formed correctly, but keep getting an error. My goal is to return the sentiment of the conversation and route based on if the conversation is a negative score, coming from a digital bot flow. Below is the error and json. What am I missing??
ERROR: Apply output transformation: Transform failed to process result using 'successTemplate' template due to error:'Unexpected character ('S' (code 83)): was expecting comma to separate Object entries at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION
disabled); line: 1, column: 107]' Template:'{ "sentimentScore": ${sentimentScore}, "sentimentTrend": ${sentimentTrend}, "sentimentTrendClass": "${sentimentTrendClass}" }'.
{
"name": "Get Conversation Analytics",
"description": "Retrieves analytics data for a given conversation ID",
"secure": false,
"requestType": "HTTP",
"requestTemplate": "https://api.usw2.pure.cloud/api/v2/speechandtextanalytics/conversations/${input.conversationID}",
"requestUrlTemplate": "${requestTemplate}",
"integrationType": "purecloud-data-actions",
"actionType": "REQUEST",
"config": {
"request": {
"template": "https://api.usw2.pure.cloud/api/v2/speechandtextanalytics/conversations/${input.conversationID}",
"method": "GET",
}
},
"response": {
"translationMap": {
"conversationId": "$.conversation.id",
"sentimentScore": "$.sentimentScore",
"sentimentTrend": "$.sentimentTrend",
"sentimentTrendClass": "$.sentimentTrendClass"
},
"successTemplate": "{ "conversationId": "${conversationId}", "sentimentScore": ${sentimentScore}, "sentimentTrend": ${sentimentTrend}, "sentimentTrendClass": "${sentimentTrendClass}" }"
}
},
"contract": {
"input": {
"inputSchema": {
"type": "object",
"properties": {
"conversationID": {
"type": "string",
"description": "The ID of the conversation to retrieve analytics for"
}
},
"required": [
"conversationID"
]
}
},
"output": {
"successSchema": {
"type": "object",
"properties": {
"conversationId": {
"type": "string",
"description": "The ID of the conversation"
},
"sentimentScore": {
"type": "number",
"format": "double",
"description": "The sentiment score of the conversation"
},
"sentimentTrend": {
"type": "number",
"format": "double",
"description": "The sentiment trend of the conversation"
},
"sentimentTrendClass": {
"type": "string",
"description": "The sentiment trend classification"
}
}
}
}
}
}