Skip to main content

Overview

useMuteConversation returns a function that sets or clears the signed-in user’s mute on a conversation. Muting suppresses the message push for that conversation only — the message is still delivered and readable. Timed mutes expire on their own; push resumes with no further action. The client passes a duration choice, never a raw timestamp — the server resolves the window and represents “forever” via an explicit signal on the returned member.
Requires ChatProvider in the component tree, an authenticated user, and the chat bundle.

Usage Example

Parameters

The hook returns { muteConversation, muting }. muteConversation accepts:
conversationId
string
required
The conversation to mute or unmute.
duration
"8h" | "24h" | "1w" | "forever" | null
required
The mute duration choice, or null to clear the mute. Never a raw timestamp.

Returns

muteConversation resolves to the acting user’s own (self-serialized) currentMember. Read the resulting mute state off it:
mutedForever
boolean
true when the conversation is muted indefinitely (mutedUntil is then null).
mutedUntil
string | null
Real ISO timestamp for a timed mute; null when not muted or muted forever.
“Forever” is an explicit boolean, not a magic date. Check mutedForever — do not string-match a far-future mutedUntil. The SDK never receives the storage sentinel.

Notes

  • Available on @sublay/react-js, @sublay/react-native, and @sublay/expo (inherited from @sublay/core).
  • Mute state is personal — it’s returned only on the viewer’s own member row, never on other members’.
  • For per-type push toggles, see useNotificationPreferences.