Step one: the flow triggers a SNIPPET action to grab active conversation metadata before routing to a skill group. We’re hitting /api/v2/conversations via the REST Proxy with a GET request. Response comes back as 200 OK, but the entities array isn’t populated.
Step two: swapped the endpoint to /api/v2/analytics/conversations/realtime/summary just to test the connection. Suddenly the payload is populated with the exact conversation details we need. JSON structure is totally different though.
Looking at the SNIPPET code, the mapping expects the standard conversation object shape.
// SNIPPET ASSIGN
var convList = GetRESTProxy().Response.Data.Entities;
ASSIGN("convId", convList[0].Id);
This assignment throws a runtime error because convList is null on the first endpoint. Analytics endpoint returns a records array instead of entities.
Is there a specific query parameter required for the /api/v2/conversations call to return active sessions? We’ve tried tacking on ?expand=participants and setting the Accept header to application/json, but nothing changes the empty result.
Documentation for the analytics endpoint mentions it’s aggregated data, so using it for real-time routing feels wrong. Latency jumps to 4s on the analytics call. Studio doesn’t like that spike.
Current request headers:
{
"Authorization": "Bearer {{OAuthToken}}",
"Accept": "application/json"
}
Maybe the token scope is missing conversation:read? Analytics endpoint works fine with analytics:read.
Also noticed the analytics endpoint returns a from and to timestamp in the query. Hardcoding a wide window like from=2023-01-01T00:00:00Z&to=2023-12-31T23:59:59Z pulls data, but it feels like a hack.
What’s the actual difference in how these endpoints filter data? First one should return live state. Second one is clearly for reporting.
If we stick with the analytics endpoint, have to rewrite the entire mapping logic in the SNIPPET to handle the records array structure.
Just want to get the conversation ID reliably without polling an analytics summary.
Flow times out if the REST Proxy takes more than 5 seconds.
Is there a way to force the conversations endpoint to return data? Or are we supposed to use a different resource entirely?
SNIPPET action is failing validation in the UI now because of the null reference.