const CohereCallWidget = () => {
// Tracks whether the widget is expanded/collapsed
const [expanded, setExpanded] = useState(false);
// Subscribe to the call status
const [callStatus, setCallStatus] = useState("closed");
Cohere.addCallStatusListener(setCallStatus);
return () => Cohere.removeCallStatusListener(setCallStatus);
if (callState === "closed") {
onClick={Cohere.makeCall}
onClick={() => setExpanded(false)}
<button onClick={() => setExpanded(true)}>Need help?</button>
// Don't show widget if call window is open.