Agent Scripting API 400: Invalid JSON Structure for Custom Variable Injection

Configuration is broken for some reason…

We are attempting to dynamically inject custom variables into our Agent Scripting flow using the POST /api/v2/floorscripts/executions endpoint. The goal is to pull specific customer context from our CRM and display it within the script before the agent takes the call. This is critical for our Chicago team’s adherence to personalized greeting protocols.

Error: 400 Bad Request - Invalid JSON Structure

The request fails immediately upon submission. The payload structure follows the documentation for FloorscriptExecutionRequest, specifically the variables object. Here is a sanitized snippet of the payload:

{
 "floorscript_id": "f98a7b6c-1234-5678-90ab-cdef12345678",
 "variables": {
 "customer_name": "John Doe",
 "loyalty_tier": "Gold",
 "last_interaction_date": "2023-10-15"
 }
}

The error response body indicates:
"errors": [{"code": "invalid_content", "message": "The provided variables map contains keys not defined in the floorscript definition."}]

This is confusing because the floorscript definition does contain these variables as custom inputs. I have verified the floorscript_id is correct and the script is published. The variable names match character-for-character, including case sensitivity. We are using the latest Genesys Cloud SDK for Python (v2023.10.0).

I suspect this might be related to how the variables are scoped in the Architect flow versus the scripting engine. Are custom variables defined in the flow’s “Data” section automatically available to the scripting API, or do they need to be explicitly exposed in the floorscript metadata?

This is blocking our weekly schedule publish workflow integration, as we need this context for shift-specific coaching scripts. Any insight into the expected JSON schema for dynamic variable injection would be appreciated.

The documentation actually says…

G’day.

Check the payload structure. The variables block requires a flat map of string values, not nested objects.

resource "genesyscloud_flow" "main" {
 # ensure variables are strings
}

Verify your JSON schema matches the OpenAPI spec exactly.