I’m building a custom agent desktop extension using the Embeddable Client App SDK. The goal is to automatically set a specific wrap-up code on a conversation once the agent clicks our custom ‘Complete’ button. We want to skip the standard wrap-up screen for certain simple interactions.
The flow is straightforward. I detect the interaction end event in my SDK code. Then I make a direct REST call to the Genesys Cloud API. I’m using the endpoint /api/v2/conversations/{conversationId}. I send a PUT request with the wrap-up-code payload. Here is the JSON body I’m sending:
{
"wrap-up-code": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "General Inquiry"
}
}
The problem is the response. I consistently get a 409 Conflict error. The error message says the conversation is not in a valid state for this operation. It feels like the API rejects the request because the conversation status is already ‘completed’ or ‘closed’ by the time my code executes. The SDK event fires, but maybe the server-side state hasn’t fully transitioned yet, or perhaps the conversation is locked.
I tried adding a small delay before making the API call, but that didn’t help. I also checked if I can set the wrap-up code before ending the conversation, but the SDK doesn’t seem to expose a method for that in the agent desktop context. The conversationApi.updateConversation method requires the conversation ID, but I’m unsure about the exact timing.
Has anyone successfully set wrap-up codes programmatically after the agent has already ended the call? Is there a specific status I need to check for before sending the PUT request? Or is there a different endpoint I should be using? The documentation isn’t very clear on the state machine for conversations during wrap-up.