Quality API CSAT extraction for specific interaction IDs

Trying to pull CSAT scores via the Quality API to link them with our OTel spans. The standard reporting endpoints only give aggregated metrics, which doesn’t help with tracing individual calls. I need a way to query CSAT results by interaction_id. The docs are vague on this. Is there a direct endpoint for this?

You can’t query CSAT directly by interaction_id because the Quality API treats survey results as separate entities from the conversation metadata. The link is the conversationId, not the internal interaction trace ID. You have to fetch the survey result first, then map it back.

Here’s the flow in Python using the SDK. It’s a two-step dance.

from genesyscloud import PlatformClient, PlatformClientBuilder

# Initialize client
client = PlatformClientBuilder().with_client_id_secret(CLIENT_ID, SECRET).build()
quality_api = client.get_quality_api()

# 1. Search for survey results by the conversation ID
# Note: interaction_id isn't a filter parameter here. You need the conversationId.
search_body = {
 "query": "conversationId eq '{CONVERSATION_ID}'", 
 "pageSize": 25
}

try:
 survey_response = quality_api.post_quality_surveys_search(
 body=search_body
 )
 
 if survey_response.entities:
 survey = survey_response.entities[0]
 print(f"CSAT Score: {survey.rating}")
 print(f"Comments: {survey.comment}")
 else:
 print("No survey found for this conversation.")
 
except Exception as e:
 print(f"Error fetching survey: {e}")

The post_quality_surveys_search endpoint supports a limited set of filters. conversationId is the only reliable way to tie it back to a specific call or chat. If you only have the interaction_id from your OTel spans, you first need to call the Conversations API to get the conversationId from that interaction ID. Then you can run the survey search.

It’s messy, but it works. The aggregated endpoints won’t cut it for trace-level debugging.