Skip to content

Notifications API

API for managing notifications and notification preferences

Endpoints

List Notifications

Get a list of notifications

http
GET /api/rpc/user/smartNotifications/list

Parameters

NameTypeDescription
pagenumberPage (default: 1)
limitnumberItems per page (default: 20)
unreadbooleanShow only unread

Mark as Read

Mark notifications as read

http
POST /api/rpc/user/smartNotifications/markRead

Body

json
{
  "notificationIds": ["notif_1", "notif_2"]
}

Notification Preferences

View and set notification preferences

http
GET /api/rpc/user/notificationPreferences
PATCH /api/rpc/user/notificationPreferences

Body (PATCH)

json
{
  "email": {
    "bookingConfirmed": true,
    "bookingCancelled": true,
    "reminder24h": true,
    "reminder1h": true,
    "reviewRequest": true
  },
  "sms": {
    "bookingConfirmed": true,
    "reminder1h": true
  },
  "push": {
    "newBooking": true,
    "newMessage": true
  }
}

Provider Notifications

Notifications for providers

http
GET /api/rpc/provider/notifications/list
POST /api/rpc/provider/notifications/send

Example Code

typescript
// Get notifications
const notifications = await fetch(
  '/api/rpc/user/smartNotifications/list?unread=true',
  { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } },
);

// Mark as read
await fetch('/api/rpc/user/smartNotifications/markRead', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ notificationIds: ['notif_1'] }),
});

// Set notification preferences
await fetch('/api/rpc/user/notificationPreferences', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    email: { bookingConfirmed: true },
    sms: { reminder1h: true },
  }),
});

Released under the MIT License.