Code example
The example below demonstrates how to listen for ambient events in the web SDK.React
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
🚀 New Form Filling SDK is out! Refer to the Release notes for details.
Learn how to use Ambient events in the Suki React Web SDK to track and manage Ambient interactions
import { SukiAssistant, SukiProvider, useSuki } from "@suki-sdk/react";
function MyComponent() {
const { on, activeAmbientId } = useSuki();
useEffect(() => {
const handleAmbientUpdate = (event) => {
console.log("Ambient event received:", event);
};
// Subscribe to ambient update events
const unsubscribe = on("ambient-update", handleAmbientUpdate);
// Cleanup subscription on unmount
return () => {
unsubscribe();
};
}, [on]);
return (
<>
Active Ambient ID: {activeAmbientId}
<SukiAssistant
// props
/>
</>
);
}
Was this page helpful?
Suggestions