Trying to set a wrap-up code programmatically via the Conversations API once the interaction is already in the terminated state. I’m sending a PATCH request to /api/v2/conversations/voice/{id} with the correct wrapupCode in the request body. The API returns a 200 OK, but when I pull the conversation details later, the wrap-up code is null or empty. Is there a specific flag I need to set to allow post-termination updates, or am I hitting a state lock? Here’s the payload I’m sending:
{
"wrapupCode": "survey-sent"
}
You can’t patch a terminated conversation directly for wrap-up codes. The system locks the data once the state changes to terminated. It’s a strict design choice to prevent race conditions in reporting.
You need to update it while the interaction is still in the wrapup state. That window opens immediately after the agent ends the call but before they log out of that specific interaction. If you miss that window, the API rejects the write for compliance reasons.
Here is the correct payload structure for the wrapup state:
{
"wrapupCode": {
"id": "your-wrapup-code-id-here"
}
}
Send this via PATCH /api/v2/conversations/voice/{id}. Make sure your OAuth token has the conversation:write scope. If you’re automating this, you’ll need to listen for the conversation:wrapup event via Streaming API or Webhooks. Catch that event, then fire the patch immediately. Don’t wait for the termination event. By then it’s too late for the API.