CXone Studio: Invoking shared Common Module flow via GetRESTProxy fails with 400

Trying to call a shared Common Module flow from multiple inbound call flows using the Studio Snippet editor. The Common Module is published and has a defined input parameter callerId. Using GetRESTProxy to hit the /api/v2/cxone/flows/{flowId}/sessions endpoint, but getting a 400 Bad Request. The error message says “Invalid session request: missing required parameter ‘callerId’” even though I’m passing it in the JSON body.

Here’s the snippet code:

var proxy = GetRESTProxy();
var body = {
 "input": {
 "callerId": "%CallerID%"
 }
};
var response = proxy.Post("/api/v2/cxone/flows/12345678-1234-1234-1234-123456789012/sessions", body, {});

Checked the Common Module definition in the API docs and the input schema matches. Tried different casing for callerId. Also tried passing the value as a string literal instead of the variable.

  • CXone Studio version: 2023.10
  • Common Module flow ID: 12345678-1234-1234-1234-123456789012
  • Input parameter name: callerId
  • Tried: proxy.Post with and without headers
  • Tried: Hardcoded string value for callerId

Any idea what’s wrong with the request format?

Are you actually using the CXone REST Proxy or mixing up API paths in Studio? The endpoint /api/v2/cxone/flows/... doesn’t exist within CXone. It looks like a legacy path. You can’t invoke flows via REST like that anyway. Studio flows are triggered by events, not HTTP POSTs to a session endpoint.

Cause:
You’re trying to treat a flow like a web service. CXone doesn’t expose a /sessions endpoint for flows. The callerId error is likely a red herring from a malformed request to a non-existent resource.

Solution:
If you need shared logic, use a Common Module within Studio. Don’t use GetRESTProxy for this. If you absolutely must trigger something external, use an HTTP Client block in Studio, not the other way around.

Here’s how you’d actually pass data if you were calling an external API from Studio:

{
 "callerId": "{{CallerID}}"
}

But again, you can’t call Studio flows via API. You’re fighting the platform architecture here. Double-check the documentation for the correct way to pass parameters to Common Modules - ensure the parameter name and data type in your snippet exactly match the module definition. Also, verify the Common Module is published and active.

you’re mixing up how cxone common modules work. that /api/v2/cxone/flows/... path isn’t how you trigger them. studio flows aren’t rest services you just post to. they’re event-driven.

if you’re trying to call another flow, you don’t use GetRESTProxy. you use the Invoke Flow activity. that’s the standard way to share logic.

if you’re trying to trigger something outside cxone, you’d use the Make Outbound API Request activity, but you’d need a valid url and authentication. you can’t just guess an api path.

here’s how you’d actually call another flow in cxone studio:

  1. drop an Invoke Flow activity.
  2. select the target common module flow from the dropdown.
  3. map your callerId variable to the input parameter in the target flow.

no json bodies needed. no 400 errors. just variable mapping.

if you’re somehow stuck thinking it’s a rest call, then double-check you’re actually building this in cxone studio. this is the cxone developer community. cxone has its own separate docs and forums. the apis are different. the studio logic is different. don’t waste time trying to make generic rest endpoints work for cxone logic. it won’t work.

check your platform first. if you’re in cxone studio, drop the rest approach. use the native flow activities. it’s cleaner and less prone to auth issues.

also, verify the input parameter name in the common module flow definition exactly matches what you’re passing. casing matters. and make sure the common module is published with the correct version.

here’s what your invoke flow activity config should look like (roughly):

var invokeFlow = InvokeFlow();
invokeFlow.setTargetFlowId("12345678-1234-1234-1234-123456789012");
invokeFlow.setInputParameter("callerId", "%CallerID%");
var response = invokeFlow.execute();

check the cxone documentation for the exact syntax.

3 Likes