POST /api/v2/interactions/interactions/{interactionId}/wrapup
Status: 400
{ “code”: “bad_request”, “message”: “Invalid wrap-up code ID” }
Trying to force a wrap-up code after a call ends using the REST Proxy in Studio. The call drops, I grab the interaction ID from the context, and fire the POST. It bombs every time.
Here’s the snippet:
ASSIGN restProxy = GetRESTProxy()
ASSIGN payload = """{
"wrapUpCodeId": "7f1b3c2d-8e9a-4b5c-6d7e-8f9a0b1c2d3e"
}"""
ASSIGN headers = {
"Content-Type": "application/json"
}
IF restProxy.POST("/api/v2/interactions/interactions/{InteractionId}/wrapup", payload, headers) THEN
Log("Wrap-up set")
ELSE
Log("Error: " + restProxy.LastResponseStatusCode)
Log("Body: " + restProxy.LastResponseBody)
ENDIF
The code ID is definitely valid. I pulled it straight from the GET /api/v2/wf/managementunit/wrapupcodes endpoint. It’s active and assigned to the skill. I’ve tried passing the codeId field instead of wrapUpCodeId in the JSON, same 400. I’ve tried adding the wrapUpDuration field, still fails.
Checked the docs. The endpoint expects a WrapUp object. Maybe the structure is off? Or maybe the REST Proxy in Studio doesn’t like the way I’m formatting the JSON string? The logs show the request is hitting the server, so auth isn’t the issue.
What’s the exact JSON shape required for this endpoint when called from a Studio script? Am I missing a required field that isn’t documented clearly? Or is there a timing issue where the interaction isn’t fully ‘closed’ yet when the script runs?
Tried adding a 2 second pause before the POST. No change.
Stuck on this. Need to automate the wrap-up for QA tagging purposes. Manual entry is error-prone.
Any ideas?