Architect Flow API 400 Error on Nested Data Action Attributes

  • Genesys Cloud: 2024-06-P1
  • Integration: Custom AppFoundry App (Node.js)
  • API: POST /api/v2/architect/flows
  • SDK: @genesyscloud/genesyscloud

The issue manifests when attempting to push a flow update that includes a Data Action with nested JSON attributes. The API returns a 400 Bad Request, specifically citing a schema validation failure for the body parameter of the HTTP request action.

The JSON structure being sent aligns with the public schema for simple key-value pairs, but fails when the value is an object. The error response indicates:

{
 "message": "Invalid value for property 'body' in schema",
 "code": "invalid.request",
 "errors": ["Expected string, got object at path $.dataActions[0].settings.body"]
}

The documentation implies that JSON bodies are supported, yet the validation layer seems to enforce a string type strictly unless specific serialization is applied client-side before transmission. Attempting to stringify the object prior to inclusion in the flow JSON results in a different error regarding malformed JSON within the flow definition itself.

Is there a specific wrapper or encoding requirement for nested attributes within Data Action settings that is not explicitly detailed in the Architect API documentation? The current implementation handles flat structures without issue, suggesting the limitation is specific to depth or type handling in the schema validator.

Make sure you stringify the nested JSON object before inserting it into the Data Action body attribute.

Cause: The Architect API schema expects a string for the body field, not a raw JSON object.
Solution: Use JSON.stringify(yourNestedObject) in your Node.js code before passing it to the SDK.