Trying to call an internal REST endpoint from a CXone Studio flow using a Snippet. The goal is to fetch user metadata before routing, but the script fails immediately on the proxy initialization.
Here’s the snippet code:
var proxy = GetRESTProxy();
var response = proxy.execute("GET", "/api/v2/users/me", {}, {});
SET("user_metadata", response.body);
The error log shows:
INVALID_FUNCTION: GetRESTProxy is not a valid function in this context.
I’ve checked the documentation and it clearly states GetRESTProxy() is available for outbound API calls within Studio. I’m using the latest Studio version. Is there a specific permission or flow type restriction I’m missing? The flow is triggered by a chat transfer.
I’ve also tried passing headers:
var headers = {"Authorization": "Bearer " + GET("access_token")};
var response = proxy.execute("GET", "/api/v2/users/me", {}, headers);
Same error. It’s like the function doesn’t exist. We’ve been using this pattern in other flows without issues, but this specific script keeps failing.
Checked the debug logs and the token is valid. The issue seems isolated to the function call itself.
Any ideas?