We’re trying to automate the assignment of wrap-up codes for our adherence tracking in the Central timezone queue. The goal is to set the code immediately after an interaction ends so the data is clean for our WFM reports.
I’ve been looking at the API docs and found the endpoint POST /api/v2/conversations/voice/{conversationId}/wrapup. It seems like the right tool for the job. I’m using Python requests to hit it.
Here’s the snippet:
import requests
import json
headers = {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json'
}
data = {
"code": "Sale-Completed",
"reason": "Customer purchased premium plan"
}
response = requests.post(
f'https://api.mypurecloud.com/api/v2/conversations/voice/{conversation_id}/wrapup',
headers=headers,
json=data
)
print(response.status_code)
print(response.text)
The conversation is definitely in the closed state when I run this. I waited 10 seconds just to be safe. But I keep getting a 405 Method Not Allowed error. The response body is empty.
I checked the endpoint path against the Swagger docs and it looks correct. I’ve also tried using the code ID instead of the name, but the error is the same.
Is this endpoint deprecated? Or am I missing a header that tells the API this is a post-interaction update?