Notifications

List notifications

GET /api/notifications
ParamTypeDefaultDescription
limitnumber50Max notifications
offsetnumber0Offset for pagination
const notifications = await client.listNotifications(50, 0)
notifications = client.list_notifications(limit=50, offset=0)

Mark notification as read

PATCH /api/notifications/:id/read
await client.markNotificationRead('notification-id')
client.mark_notification_read("notification-id")

Mark all as read

POST /api/notifications/read-all
await client.markAllNotificationsRead()
client.mark_all_notifications_read()

Mark scope as read

POST /api/notifications/read-scope

Mark all notifications for a specific server or channel as read.

FieldTypeDescription
serverIdstringServer ID (optional)
channelIdstringChannel ID (optional)
await client.markScopeRead({ serverId: 'server-id' })
client.mark_scope_read(server_id="server-id")

Get unread count

GET /api/notifications/unread-count
const { count } = await client.getUnreadCount()
result = client.get_unread_count()
count = result["count"]

Get scoped unread counts

GET /api/notifications/scoped-unread

Returns unread counts grouped by server/channel.

const scoped = await client.getScopedUnread()
scoped = client.get_scoped_unread()

Get notification preferences

GET /api/notifications/preferences
const prefs = await client.getNotificationPreferences()
prefs = client.get_notification_preferences()

Update notification preferences

PATCH /api/notifications/preferences
FieldTypeDescription
strategystringall, mention_only, or none
mutedServerIdsstring[]Server IDs to mute
mutedChannelIdsstring[]Channel IDs to mute
const updated = await client.updateNotificationPreferences({
  strategy: 'mention_only',
  mutedServerIds: ['server-1'],
})
updated = client.update_notification_preferences(
    strategy="mention_only",
    mutedServerIds=["server-1"],
)

Channel notification preferences

GET /api/notifications/channel-preferences PATCH /api/notifications/channel-preferences

Get or update per-channel notification preferences.

FieldTypeDescription
kindstringNotification kind
channelstringChannel ID
enabledbooleanWhether notifications are enabled
// Get
const prefs = await client.getNotificationChannelPreferences()

// Update
const updated = await client.updateNotificationChannelPreference({
  kind: 'message',
  channel: 'channel-id',
  enabled: false,
})
prefs = client.get_notification_channel_preferences()

updated = client.update_notification_channel_preference(
    kind="message",
    channel="channel-id",
    enabled=False,
)

Register push token

POST /api/notifications/push-tokens DELETE /api/notifications/push-tokens/:idOrToken

Register a mobile push notification token.

FieldTypeDescription
platformstringios, android, or web
tokenstringPush token
deviceNamestringOptional device name
await client.registerPushToken({
  platform: 'ios',
  token: 'push-token-string',
  deviceName: 'iPhone',
})
client.register_push_token(
    platform="ios",
    token="push-token-string",
    deviceName="iPhone",
)

Register web push subscription

POST /api/notifications/web-push-subscriptions DELETE /api/notifications/web-push-subscriptions/:idOrEndpoint

Register a Web Push API subscription.

FieldTypeDescription
endpointstringPush subscription endpoint
keys.p256dhstringP-256 DH key
keys.authstringAuth secret
userAgentstringOptional user agent
await client.registerWebPushSubscription({
  endpoint: 'https://...',
  keys: { p256dh: '...', auth: '...' },
  userAgent: navigator.userAgent,
})
client.register_web_push_subscription(
    endpoint="https://...",
    keys={"p256dh": "...", "auth": "..."},
)