Skip to main content
The push module lets the signed-in user manage which event types they receive as a push notification. Because @sublay/js authenticates as an end user, these acting-user-scoped endpoints fit naturally — the server derives the user from the token, so there is no userId parameter.
Requires the push bundle installed on the project. See Notification Preferences & Mute for the model and the full event palette.
Per-conversation muting lives on the chat module (chat.muteConversation).

getNotificationPreferences

Reads the signed-in user’s disabled push types. Returns an empty array (all-on) when no preferences are set.
const { disabledTypes } = await sublay.push.getNotificationPreferences();
ReturnsPromise<NotificationPreferences>
interface NotificationPreferences {
  disabledTypes: PushEventType[]; // e.g. ["new-follow", "message"]
}

updateNotificationPreferences

Replaces the signed-in user’s disabled-types set (upsert). Send the complete set you want stored, not a delta; only valid event type names are accepted.
import { PUSH_EVENT_TYPES } from "@sublay/js";

await sublay.push.updateNotificationPreferences({
  disabledTypes: ["comment-mention", "message"],
});
disabledTypes
PushEventType[]
required
The complete set of event types to disable for push. Values must be from PUSH_EVENT_TYPES (see the event palette); unknown names are rejected. Pass [] to re-enable everything.
ReturnsPromise<NotificationPreferences> (the stored, deduplicated set).