Agent Script Execution Returning 409 on Staging Push

Pushed the script trigger module to client staging org using genesys-cloud-sdk-js@3.102.7. The script execution endpoint is doing jack all. It’s rejecting the POST with a 409 Conflict immediately after the OAuth token refresh. The multi-org setup runs fine for other endpoints, but this script execution call keeps bouncing back. The request payload includes the scriptId and the interactionId, both verified in the console. Console shows the script is published and not locked. Yet the API response returns a conflict error pointing to a state mismatch on the session object.

Tried switching to the interaction API route just to bypass the flow session layer. Same 409 result. Rate limiting headers are clean, nothing throttling the requests. The AppFoundry manifest has the correct permissions for flow:sessions:read and scripts:read, but maybe missing something for execution triggers. Logs in the client org show the script engine trying to acquire a lock, then failing because the session context is already bound to an outbound campaign. The custom connector routes these through after IVR. The handoff works, script just won’t fire via API.

Architect flow has the script set to auto-attach on contact start. Manual testing in the agent desktop works perfectly. API calls from the backend service keep hitting this wall. Payload structure matches the docs exactly.

{
 "scriptId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
 "interactionId": "int-987654321",
 "executionMode": "async"
}

Response body just says conflict on session state. No extra details in the trace. Looking at the session object directly, the scriptStatus field is null. Should be initializing to pending maybe. The SDK client isn’t throwing a validation error, just straight 409 from the gateway. Client is on the latest platform version. Checking the script execution API docs again for the trigger parameters. Might be missing a correlationId or something in the header. Token scope looks fine.

check your script version first. 409s on staging pushes usually mean you’re hitting a lock state or trying to overwrite a published version without the right force flag. the sdk doesn’t always expose the underlying conflict reason clearly.

try hitting the endpoint directly with curl to see the actual conflict detail in the response body.

curl -X POST https://api.mypurecloud.com/api/v2/scripts/published \
 -H "Authorization: Bearer {token}" \
 -H "Content-Type: application/json" \
 -d '{"scriptId": "your-script-id", "interactionId": "your-interaction-id", "version": 1}'

also verify the script isn’t currently attached to an active interaction in that session. if it is, the api will block the push to prevent data corruption. you might need to wait for the session to close or use the dry-run mode if available in your sdk version.

make sure the service account has flow:script:write scope. missing scopes sometimes masquerade as conflicts in older sdk versions.