NYYU Logo
APINotification

Notification API Overview

Complete guide to NYYU notification system types, structures, and settings

Notification API

Manage user notifications, notification types, and settings with a powerful binary configuration system

Overview

The Notification API provides a comprehensive system for managing user notifications in the NYYU platform. It includes notification types, individual notifications, and an efficient binary-based settings storage system.

Core Types

NotificationType

๐Ÿ””
NotificationType
Defines a category of notification
type NotificationType {
  type: String
  index: Int
}
type

The name of the notification type (e.g., "NEW ROUND STARTED", "BID RANKING UPDATED")

index

The unique numeric identifier for this notification type

Notification

๐Ÿ“จ
Notification
Represents a notification sent to a user
type Notification {
  id: Int
  userId: Int
  timeStamp: Float
  nType: Int
  read: Boolean
  title: String
  msg: String
}
Core Fields
id - Unique notification identifier
userId - Recipient user ID
nType - Notification type index
read - Read status flag
Content Fields
timeStamp - Unix timestamp when sent
title - Notification title
msg - Notification message body

Notification Settings System

โš™๏ธ
Binary Settings Storage
Efficient notification preferences using bit flags

To optimize notification delivery, user notification settings are stored as a single integer value. Each notification type corresponds to a specific bit position in the binary representation.

How It Works

Each bit in the settings integer represents whether a specific notification type is enabled (1) or disabled (0)

Notification Type Values

๐Ÿ“‹
Standard Notification Types
Predefined notification categories
Type ValueBinary PositionNotification Type NameBinary Representation
0Bit 0NEW ROUND STARTED0000,0000,0000,0001b
1Bit 1BID RANKING UPDATED0000,0000,0000,0010b
2Bit 2ROUND FINISHED0000,0000,0000,0100b
3Bit 3PAYMENT RESULT0000,0000,0000,1000b
4Bit 4VERIFICATION RESULT0000,0000,0001,0000b
......Additional types......

Settings Calculation Examples

๐Ÿงฎ
Understanding the Binary System
How to calculate and decode notification settings
Example 1: Multiple Notifications Enabled

User has enabled: BID RANKING UPDATED (1), PAYMENT RESULT (3), and VERIFICATION RESULT (4)

Binary: 0001,1010b
Calculation: 2ยน + 2ยณ + 2โด = 2 + 8 + 16 = 26
Settings Value: 26

The user profile stores the integer value 26 to represent these three enabled notification types

Example 2: All Notifications Enabled

User has enabled all five notification types

Binary: 0001,1111b
Calculation: 2โฐ + 2ยน + 2ยฒ + 2ยณ + 2โด = 1 + 2 + 4 + 8 + 16 = 31
Settings Value: 31
Example 3: Single Notification

User only wants NEW ROUND STARTED (0) notifications

Binary: 0000,0001b
Calculation: 2โฐ = 1
Settings Value: 1

Checking Notification Settings

๐Ÿ”
Decoding User Settings
How to check if a notification type is enabled

To check if a specific notification type is enabled for a user, use bitwise AND operation:

// Check if BID RANKING UPDATED (type 1) is enabled
isEnabled = (userSettings & (1 << notificationType)) !== 0
// Example: userSettings = 26, notificationType = 1
isEnabled = (26 & (1 << 1)) !== 0
isEnabled = (26 & 2) !== 0
isEnabled = true // Result: 2 is non-zero

Use Cases

โšก
Fast Notification Filtering

Quickly determine which users should receive specific notifications using bitwise operations

๐Ÿ’พ
Efficient Storage

Store unlimited notification preferences in a single integer field

๐ŸŽฏ
User Preferences

Allow users to customize which notifications they want to receive

๐Ÿ“Š
Real-time Updates

Track read/unread status and manage notification history

๐Ÿš€
Ready to integrate?
Explore our query and mutation documentation to start managing notifications