Event callbacks
Hear about sends, unread changes, calls and errors in your host app.
Event callbacks
Pass these on ChatMain or Chat. Each one is optional. They report activity; they do not replace the built-in UI.
tsx
<ChatMain {...chatConfig} onMessageSent={(event) => { // event: { tempId, conversationId, content, kind, threadRootId? } toast.success("Message sent"); }} onUnreadChange={(summary) => { // Assign. Do not add this to a previous count. setBadge(summary.totalUnreadCount); }} onCallStarted={(event) => { // event: { callId, conversationId, mode, isGroupCall } analytics.track("call_started", event); }} onError={(error) => { // error: { message, source: "chat" | "socket" | "call", code?, conversationId? } console.error(error.source, error.message); }}/>When each one runs
See also Unread badge and Session end & token refresh (onSessionEnd).