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.
Web SDK now supports Medication Orders -> Learn more
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