Error: 400 Bad Request - Invalid JSON Payload
Terraform v1.9.8
Provider v1.65.2
Region: Australia/Sydney
deploying custom agent script via genesyscloud_flow_script. the apply fails immediately with 400. no useful details in the plan output. just generic bad request.
hcl config:
resource “genesyscloud_flow_script” “agent_onboarding” {
name = “Onboarding Script v2”
description = “Standard onboarding for new hires”
scripts {
id = “script_01_intro”
name = “Introduction”
type = “text”
content = “
Welcome to the team. Please review the attached documents.
”}
scripts {
id = “script_02_compliance”
name = “Compliance Check”
type = “checkbox”
content = “
I have read and understood the compliance guidelines.
”}
}
api response body:
{
“errors”: [
{
“code”: “bad_request”,
“message”: “Invalid JSON structure for script content. Expected array of objects, got malformed string.”
}
]
}
tried removing html tags. tried plain text. tried escaping quotes. still 400.
checked the architect ui. manual creation works fine. same content. same structure.
using gc_cli to export existing script shows valid json. but importing into terraform state then applying changes triggers the error again.
is there a known issue with special characters in script content? or is the provider not handling the content field correctly?
also noticed that the script id is being generated by terraform. maybe that causes conflict with internal api expectations?
anyone else hitting this with agent scripts? need to automate this for prod deployment. manual updates not scalable.
logs attached if needed. but error is clear. invalid json. yet input looks valid.
thanks.