We are trying to programmatically set the wrap-up code for a voice conversation immediately after the agent disconnects. The goal is to feed this data into our New Relic dashboard via a custom event, so manual selection isn’t an option.
I’m using the Python SDK to send a PATCH request to the conversation endpoint. The API returns a 204 No Content, which implies success. However, when I query the analytics stats later, the wrapupCode field is null. The state correctly shows completed.
Here is the payload I’m sending:
import genesyscloud
from genesyscloud.conversations.models import ConversationWrapup
# ... client setup ...
conversation_id = "abc-123-def"
wrapup_code = "sales_lead"
patch_body = {
"wrapupCode": wrapup_code
}
try:
result = client.conversations_api.patch_conversation(
conversation_id=conversation_id,
body=patch_body
)
print(f"Status: {result.status_code}")
except Exception as e:
print(e)
The response is 204. But checking the interaction in the Genesys UI shows no wrap-up code selected. Is there a specific timing requirement? Or do I need to use the wrapup object structure instead of just the string code?
Also, I noticed the docs mention wrapup as an object with code and duration. I tried that too:
{
"wrapup": {
"code": "sales_lead",
"duration": 1000
}
}
Same result. 204 OK, but no data in analytics.