Browser integration boundaries
Keep browser input, supported widget forms, and privileged server actions separate.
Use browser input to collect a visitor's intent, then send that intent to a backend you control. Validate inputs on the server, authenticate the caller where appropriate, and call AgentStack's REST API with a server-held API key. This preserves a clean boundary between an untrusted browser and privileged organization operations. For an AI-invoked widget form, use the supported Client-side forms contract rather than an improvised browser callback.
Design each backend action as a small, recoverable workflow. Give the visitor a pending state, show a useful error when validation fails, and make retries safe where possible. A submission should not rely on a chat transcript being present, nor should it assume the widget can authorize administrative work. If an integration needs to create a contact, send a message, or update agent data, make the operation explicit in the backend and use the documented REST response envelope.
Keep consent and privacy clear. Only send fields that are needed for the requested outcome, and describe what happens after submission. The current browser custom-action registration surface does not have a complete widget execution bridge, so it is not a supported workflow to build against. For a verified contact flow, use the dedicated identity-verification endpoints rather than inventing a browser-only proof mechanism.