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:
- Create a new Script using
POST /api/v2/scriptswith a validcontentobject. - Set
typetohtml. - In the
content.body, include a div with an attribute binding a contact custom attribute:<div data-bind="text: {contact.attribute.custom.field1}"></div>. - Send the request with a valid
x-gw-oidheader for the target org. - 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.