Agent Scripting Variables Dropping Mid-Call

Agent scripting variables are dropping mid-call instead of rendering properly. Pushed the sync module to client staging org using genesys-cloud-sdk-js@3.82.1. The /api/v2/conversations/scripts endpoint doing jack all. It’s rejecting POST requests with 422 Unprocessable Entity whenever the JSON payload references a dynamic variable from Architect. Console logs show the schema validation fails on the steps array. The flow node keeps timing out after 30 seconds.

{ "error": "VALIDATION_FAILED", "message": "Unknown variable type: ARCHITECT_DYNAMIC" }

That 422 error is almost always a schema mismatch on the steps array. The SDK is strict about the structure. You can’t just dump dynamic variable references into the payload without wrapping them correctly.

Check your steps array. Each step needs a specific type and content structure. If you’re referencing an Architect variable, it needs to be in the content object, not floating loose.

Here’s a working payload snippet using the JS SDK:

const scriptBody = {
 name: "Test Script",
 steps: [
 {
 type: "text",
 content: {
 value: "Customer Name: {{customerName}}" // Must be in content
 }
 }
 ]
};

await platformClient.ScriptApi.postConversationsScripts(scriptBody);

If customerName isn’t defined in the flow context before the script renders, it might still fail validation depending on your org settings. Make sure the variable exists in the flow data before hitting that endpoint. Also, check if you’re using the latest SDK version. 3.82.1 is a bit old.