We are trying to automate the wrap-up code assignment for voice interactions in our WFM dashboard. The goal is to set the code programmatically once the agent clicks end call, so the data is clean for our adherence reports.
I am using the Python SDK. The interaction is already in the COMPLETE state. I have the interactionId and the correct wrapUpCode ID from our system settings.
Here is the code snippet:
from genesyscloud import conversations_api
api_instance = conversations_api.ConversationsApi(api_client)
interaction_id = "e1234567-89ab-cdef-0123-456789abcdef"
# Attempting to update the interaction
body = {
"wrapUpCode": {
"id": "wrap-up-code-id-123"
}
}
try:
result = api_instance.post_interactions(interaction_id, body=body)
print("Success")
except Exception as e:
print("Error: %s\n" % e)
The response is a 400 Bad Request. The error message says:
Invalid input: Interaction state must be ACTIVE to update wrap-up code.
This is confusing. The docs for POST /api/v2/interactions/{interactionId} say you can update wrap-up codes for complete interactions. But the error implies the state must be ACTIVE.
If I try to change the state to ACTIVE first, I get a different error saying the state transition is invalid because it’s already COMPLETE.
Is there a specific endpoint for post-interaction wrap-up updates? Or is this a limitation of the Python SDK client?
I’ve checked the raw JSON payload. It looks correct. The wrap-up code ID exists in our org.