Stuck on parsing a JSON response in a CXone Studio Snippet. I’m trying to call an internal API to fetch user preferences before the agent takes the call. The HTTP request itself seems fine-getting a 200 OK-but the response object in the snippet is coming back empty or null when I try to parse it.
Here’s the flow:
- Create REST Proxy
- Set headers (Authorization, Content-Type)
- Execute request
- Assign response to variable
- Parse JSON
The code looks like this:
{
"actionType": "GetRESTProxy",
"input": {
"requestUrl": "https://internal-api.example.com/v1/preferences",
"requestMethod": "GET",
"requestHeaders": {
"Authorization": "Bearer {{session.token}}",
"Accept": "application/json"
}
},
"output": {
"restProxy": "prefProxy"
}
}
Then immediately after:
{
"actionType": "ExecuteRESTProxy",
"input": {
"restProxy": "prefProxy"
},
"output": {
"statusCode": "prefStatus",
"responseBody": "prefBody"
}
}
When I log prefBody to the transcript, it’s blank. If I change the URL to a dummy echo service, it works. The internal API returns valid JSON. I’ve tried adding a wait action between the two, but that didn’t help. Is there a specific way to handle async responses in Studio Snippets or am I missing a header requirement? The token is definitely valid since other calls work.