StockBud.io Notifications Schema
Schema for notification and alert systems in StockBud.io
🔔 StockBud.io Notifications Schema
Version: 1.0.0
Schema for notification and alert systems in StockBud.io
Overview
This schema defines 7 data structures:
Notification- Base notification structure...NotificationAction- Action that can be taken on a notification...NotificationTemplate- Template for generating notifications...NotificationRule- Rule for automated notification generation...NotificationPreferences- User notification preferences...NotificationDelivery- Notification delivery record...NotificationDigest- Digest of multiple notifications...
Definitions
Notification
Base notification structure
Properties
| Property | Type | Required | Description |
|---|---|---|---|
id | string | ✓ | Unique notification identifier |
type | enum: 'trade_execution', 'order_status', 'portfolio_alert', 'market_alert', 'system_alert', 'performance_update', 'risk_warning', 'news_update', 'strategy_signal', 'compliance_alert' | ✓ | Notification type |
title | string | ✓ | Notification title |
message | string | ✓ | Notification message content |
priority | enum: 'low', 'normal', 'high', 'urgent', 'critical' | ✓ | Notification priority level |
severity | enum: 'info', 'warning', 'error', 'critical' | Notification severity | |
category | enum: 'trading', 'portfolio', 'market', 'system', 'compliance', 'performance' | Notification category | |
source | string | Source system or component | |
user_id | string | Target user identifier | |
account_id | string | Related account identifier | |
symbols | Array<string> | Related stock symbols | |
metadata | object | Additional notification metadata | |
actions | Array<NotificationAction> | Available actions for the notification | |
channels | Array<string> | Delivery channels | |
delivery_status | object | Delivery status by channel | |
read | boolean | Whether notification has been read | |
read_at | string | When notification was read | |
acknowledged | boolean | Whether notification has been acknowledged | |
acknowledged_at | string | When notification was acknowledged | |
acknowledged_by | string | Who acknowledged the notification | |
expires_at | string | Notification expiration timestamp | |
timestamp | string | ✓ | Notification creation timestamp |
TypeScript
NotificationAction
Action that can be taken on a notification
Properties
| Property | Type | Required | Description |
|---|---|---|---|
id | string | ✓ | Action identifier |
label | string | ✓ | Action label for display |
action_type | enum: 'acknowledge', 'dismiss', 'view_details', 'execute_trade', 'modify_order', 'cancel_order', 'view_portfolio', 'contact_support' | ✓ | Type of action |
url | string | URL for action execution | |
method | enum: 'GET', 'POST', 'PUT', 'DELETE' | HTTP method for action | |
payload | object | Payload for action execution | |
confirmation_required | boolean | Whether action requires confirmation |
TypeScript
NotificationTemplate
Template for generating notifications
Properties
| Property | Type | Required | Description |
|---|---|---|---|
id | string | ✓ | Template identifier |
name | string | ✓ | Template name |
type | string | ✓ | Notification type this template applies to |
title_template | string | ✓ | Title template with placeholders |
message_template | string | ✓ | Message template with placeholders |
variables | Array<Record<string, unknown>> | Template variables | |
channels | Array<string> | Supported delivery channels | |
channel_templates | object | Channel-specific templates | |
priority_rules | Array<Record<string, unknown>> | Rules for determining notification priority | |
enabled | boolean | Whether template is enabled | |
created_at | string | Template creation timestamp | |
updated_at | string | Last update timestamp |
TypeScript
NotificationRule
Rule for automated notification generation
Properties
| Property | Type | Required | Description |
|---|---|---|---|
id | string | ✓ | Rule identifier |
name | string | ✓ | Rule name |
description | string | Rule description | |
trigger | object | ✓ | Trigger conditions for the rule |
template_id | string | ✓ | Notification template to use |
target_users | Array<string> | Target user IDs | |
target_groups | Array<string> | Target user groups | |
channels | Array<string> | Delivery channels for this rule | |
schedule | object | Schedule restrictions for notifications | |
rate_limiting | object | Rate limiting configuration | |
enabled | boolean | ✓ | Whether rule is enabled |
created_at | string | Rule creation timestamp | |
updated_at | string | Last update timestamp |
TypeScript
NotificationPreferences
User notification preferences
Properties
| Property | Type | Required | Description |
|---|---|---|---|
user_id | string | ✓ | User identifier |
global_enabled | boolean | Global notification toggle | |
channels | object | Channel-specific preferences | |
notification_types | object | Preferences by notification type | |
quiet_hours | object | Quiet hours configuration | |
digest | object | Digest notification preferences | |
updated_at | string | Last update timestamp |
TypeScript
NotificationDelivery
Notification delivery record
Properties
| Property | Type | Required | Description |
|---|---|---|---|
id | string | ✓ | Delivery record identifier |
notification_id | string | ✓ | Associated notification identifier |
channel | enum: 'email', 'sms', 'push', 'slack', 'discord', 'webhook' | ✓ | Delivery channel |
recipient | string | Recipient identifier or address | |
status | enum: 'pending', 'sent', 'delivered', 'failed', 'bounced', 'rejected' | ✓ | Delivery status |
attempts | integer | Number of delivery attempts | |
max_attempts | integer | Maximum delivery attempts | |
next_retry | string | Next retry timestamp | |
provider_id | string | Provider-specific message ID | |
provider_response | object | Provider response data | |
error | string | Error message if delivery failed | |
delivered_at | string | Delivery timestamp | |
timestamp | string | ✓ | Record creation timestamp |
TypeScript
NotificationDigest
Digest of multiple notifications
Properties
| Property | Type | Required | Description |
|---|---|---|---|
id | string | ✓ | Digest identifier |
user_id | string | ✓ | Target user identifier |
period_start | string | ✓ | Digest period start |
period_end | string | ✓ | Digest period end |
notifications | Array<Notification> | ✓ | Notifications included in digest |
summary | object | Digest summary statistics | |
generated_at | string | Digest generation timestamp | |
sent_at | string | Digest send timestamp |