Stuck on Script API 400 Error When Embedding Dynamic Variables in Architect Flow

Stuck on a persistent 400 Bad Request error when attempting to update Agent Script content via the /api/v2/scripts endpoint. We are building a multi-tenant integration where script templates are stored centrally and deployed to client orgs using multi-org OAuth. The deployment logic works perfectly for static text, but fails specifically when the script body contains dynamic variable references like {contact.attribute.custom.field1}.

Here is the environment setup:

  • SDK: Node.js 24.0.0
  • Genesys Cloud Version: Latest Public API v2
  • Script Type: Interactive (HTML)

The error response is vague, returning Invalid script content without pointing to the specific syntax error. We have validated the JSON structure against the Swagger definition multiple times. The issue seems to trigger only when the variable reference is nested within an HTML tag attribute, such as data-bind="value: {contact.attribute.custom.field1}".

Steps to reproduce:

  1. Create a new Script using POST /api/v2/scripts with a valid content object.
  2. Set type to html.
  3. In the content.body, include a div with an attribute binding a contact custom attribute: <div data-bind="text: {contact.attribute.custom.field1}"></div>.
  4. Send the request with a valid x-gw-oid header for the target org.
  5. Observe the 400 response with the message Invalid script content.

If we remove the curly braces or move the variable outside the HTML attribute, the request succeeds. However, this breaks the data binding in the Architect flow execution. We need the variable to resolve dynamically for each contact. Is there a specific escaping requirement for variables inside HTML attributes that isn’t documented? Or is this a known limitation of the Script API regarding complex binding expressions? Any insights from other partners who have tackled dynamic script generation would be appreciated.

TL;DR: Verify variable syntax.

This looks like a schema validation issue. The Script API expects strict JSON structure for dynamic fields. Ensure the variable references are properly escaped within the JSON body. Review the official documentation for the exact syntax required for contact attributes to avoid 400 errors.