We’re building a New Relic dashboard to track agent performance, and we need to correlate Quality CSAT survey responses with specific interaction IDs. The goal is to feed this data into custom events.
I’ve been looking at the POST /api/v2/analytics/surveys/aggregates/query endpoint. The documentation suggests I can filter by date range and queue, but I’m struggling to find a way to join the survey data back to the interaction ID in a single call. The response gives me surveyId and agentId, but not the interactionId directly.
Here’s the Python snippet I’m using to fetch the aggregate data:
from genesyscloud import analytics_api
api_instance = analytics_api.AnalyticsApi(api_client)
body = analytics_api.AggregatesQueryRequest(
entity_ids=['queue_id_here'],
date_from='2023-10-01T00:00:00.000Z',
date_to='2023-10-02T00:00:00.000Z',
group_by=['agent'],
interval='P1D'
)
try:
api_response = api_instance.post_analytics_surveys_aggregates_query(body)
for entity in api_response.entities:
print(f"Agent: {entity.entity_id}, Score: {entity.score}")
except Exception as e:
print("Exception when calling AnalyticsApi->post_analytics_surveys_aggregates_query: %s\n" % e)
The score field is there, but without the interaction ID, I can’t enrich the event in New Relic with call details like duration or hold time. I considered using the evaluations endpoints but that seems to be for manual evaluations, not automated CSAT.
Is there a specific filter or nested object in the survey aggregates response that contains the interaction reference? Or is the standard pattern to fetch the survey details individually via GET /api/v2/quality/surveys/{surveyId} for each record? That feels like it would hit rate limits pretty fast if we have high volume.
Any pointers on the most efficient way to get that interaction ID would be appreciated.