We’re trying to automate a session handover from a CXone Studio script to a NICE Cognigy voicebot. The idea is to use the GetRESTProxy snippet to push the current session ID and a few custom attributes to the Cognigy API, then spawn the new IVR session.
The Studio code looks something like this:
var proxy = GetRESTProxy("CognigyAPI");
var payload = {
"sessionId": Session.Id,
"callerNumber": Session.Caller.Number,
"intent": "handover_test"
};
var response = proxy.Post("/api/v1/sessions/handover", payload);
The REST proxy is configured with the correct base URL and the Bearer token header. When I debug the Studio script, the Post call returns a status code of 400. The error message in the proxy response is just "Invalid session context".
I’ve verified the Cognigy endpoint manually with Postman using the same payload structure, and it works fine. The issue seems to be how the session ID is being passed or perhaps the timing of the handover. We’re managing the CXone environment with Terraform, so the Studio script version is locked in state, but I can push updates.
Does the GetRESTProxy in Studio handle the JSON serialization differently? Or is there a specific header I’m missing for the handover endpoint? The Cognigy docs are pretty vague on the exact JSON schema for voicebot handovers. I’ve tried adding a Content-Type: application/json header to the proxy config, but that didn’t change anything. Any ideas on what might be causing the 400 error specifically in this context?