I have been working on a backend service to handle post-interaction routing logic outside of the standard Architect flow. The goal is to programmatically transfer an active voice conversation to a specific queue based on some external data enrichment we perform.
I am using the standard PATCH endpoint: PATCH /api/v2/conversations/voice/{conversationId}
Here is the JSON payload I am sending in the request body:
{
"actions": [
{
"type": "transfer",
"settings": {
"destination": {
"id": "12345678-abcd-1234-abcd-123456789012",
"type": "queue"
},
"method": "warm"
}
}
]
}
The id corresponds to a valid queue ID that I have verified exists in our org. I am authenticating with a service account that has the conversation:transfer permission.
The response I get back is consistently a 400 Bad Request with the following error:
{
"errors": [
{
"code": "invalid_request",
"message": "The conversation is not in a state that allows the requested action."
}
]
}
I have checked the conversation state via GET /api/v2/conversations/voice/{conversationId} right before the PATCH call, and it shows state: "connected". According to the docs, connected should allow transfers.
I have also tried changing the method to blind, but the result is identical. I am not using any of the newer “consent” features, so I assumed the standard transfer action would work.
Is there a specific header I need to include? Or is the type value wrong? I tried "type": "queueTransfer" as well but that just returns a 400 saying unknown action type.
The API seems very strict about the state machine transitions. I am stuck.