Genesys Cloud JS SDK: Programmatic wrap-up code assignment failing with 409 Conflict

Trying to set a wrap-up code programmatically via the JavaScript SDK after an interaction has already concluded, but hitting a 409 Conflict error. The interaction status is closed, and I’m attempting to update the wrap-up code using the conversationsApi.updateInteractionWrapup method.

Here’s the relevant snippet:

const wrapupData = {
 id: 'wrapup-123',
 wrapUpCode: {
 id: 'some-valid-wrapup-id',
 name: 'Resolved'
 }
};

try {
 await client.conversationsApi.updateInteractionWrapup(
 'interaction-id-456',
 wrapupData
 );
} catch (error) {
 console.error('Wrap-up update failed:', error.response.data);
}

The error response is:

{
 "code": "conflict",
 "message": "Interaction is not in a valid state for wrap-up update. Current state: closed."
}

The Genesys Cloud docs state that wrap-up codes can be updated post-interaction, but the SDK method seems to enforce a stricter state check. I’ve verified the interaction is indeed closed and not queued or active. Is there a specific flag or alternative endpoint I should be using for post-closure wrap-up assignment? The API reference mentions /api/v2/interactions/{interactionId}/wrapup, but the SDK method maps to this endpoint.

Also, checking the raw HTTP request, the Content-Type is correctly set to application/json, and the token has the necessary interactions:update scope. No luck with retrying or delaying the request either. The interaction ends, and immediately after, the update fails.

Any insights on whether this is an SDK limitation or a Genesys Cloud API constraint? I’ve checked the GitHub issues for the SDK but found nothing specific to post-closure wrap-up updates. The use case is straightforward: automate wrap-up assignment based on external data after the agent has hung up. Current workaround involves manual agent selection, which defeats the purpose of automation.

Looking for a programmatic solution that doesn’t require agent interaction. The SDK method seems correct, but the state check is blocking. Is there a way to bypass or override this state check? Or perhaps a different endpoint that allows post-closure updates? The current approach feels like a dead end.