Can anyone clarify the expected behavior of the Agent Scripting API when handling simultaneous wrap-up requests across multiple organizations under a single AppFoundry deployment?
We are experiencing intermittent 404 Not Found errors on the POST /api/v2/integrations/scripting/interactions/{interactionId}/wrapup endpoint. This occurs specifically when agents complete conversations and trigger our custom compliance script via the Architect flow. The environment is a multi-org setup where our AppFoundry application uses a single OAuth client with admin:all scopes to manage scripting for three distinct customer organizations.
The error pattern is inconsistent. Approximately 15% of requests fail with a 404, while the remaining 85% succeed. The failing requests often correspond to interactions that have just transitioned to the closed state. We have verified that the interactionId is valid and exists in the system by checking the GET /api/v2/conversations/{conversationId} endpoint immediately before the scripting call. The conversation data is present, but the scripting endpoint returns 404.
Our hypothesis is that there is a race condition between the conversation state change and the availability of the interaction record for scripting purposes. However, the documentation does not specify a required delay or a polling mechanism for scripting readiness. We are using the latest Platform API version available in our region.
Has anyone encountered similar latency issues with the scripting API in high-volume environments? We are considering implementing an exponential backoff strategy, but we want to ensure this is not a configuration error on our part regarding multi-org permissions or OAuth token scopes. Any insights into the internal processing pipeline for scripting events would be appreciated.