The ThingConnect Pulse notification system allows you to push notifications to all running instances of the application through a simple JSON file hosted on AWS S3. The system automatically fetches notifications every 6 hours and displays them to users.
S3 Bucket (thingconnect-pulse.s3.ap-south-1.amazonaws.com)
└── notifications/
└── latest.json
↓
ThingConnect Pulse App (Background Service)
↓
Local SQLite Database
↓
Frontend UI (Bell Icon → Popover)
Bucket Details:
- Bucket Name:
thingconnect-pulse - Region:
ap-south-1(Asia Pacific - Mumbai) - Endpoint:
https://thingconnect-pulse.s3.ap-south-1.amazonaws.com/notifications/latest.json
Required S3 Permissions: The S3 bucket must allow public read access for the notifications file:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::thingconnect-pulse/notifications/*"
}
]
}CORS Configuration:
[
{
"AllowedHeaders": ["*"],
"AllowedMethods": ["GET"],
"AllowedOrigins": ["*"],
"ExposeHeaders": []
}
]The notification file must be named latest.json and placed in the notifications/ folder of the S3 bucket.
File Path: s3://thingconnect-pulse/notifications/latest.json
JSON Schema:
{
"version": "1.0.0",
"lastUpdated": "2024-01-15T10:30:00Z",
"notifications": [
{
"id": "new-unique-notification-id",
"type": "release|maintenance|warning|info",
"priority": "low|medium|high|critical",
"title": "Notification Title",
"message": "Detailed notification message",
"actionUrl": "https://example.com/action",
"actionText": "View Details",
"validFrom": "2024-01-15T00:00:00Z",
"validUntil": "2024-01-30T23:59:59Z",
"targetVersions": [">=1.0.0"],
"showOnce": false
}
]
}| Property | Type | Required | Description |
|---|---|---|---|
version |
string | Yes | Version of the notification format |
lastUpdated |
string (ISO 8601) | Yes | Timestamp when the file was last updated |
notifications |
array | Yes | Array of notification objects |
| Property | Type | Required | Description |
|---|---|---|---|
id |
string | Yes | Unique identifier for the notification |
type |
enum | Yes | Notification type: release, maintenance, warning, info |
priority |
enum | Yes | Priority level: low, medium, high, critical |
title |
string | Yes | Short notification title (max 100 chars) |
message |
string | Yes | Detailed notification message |
actionUrl |
string | No | URL to open when action button is clicked |
actionText |
string | No | Text for the action button (default: "Learn More") |
validFrom |
string (ISO 8601) | Yes | When the notification becomes active |
validUntil |
string (ISO 8601) | Yes | When the notification expires |
targetVersions |
array | No | Version patterns this notification targets |
showOnce |
boolean | No | Whether to show only once per user (default: false) |
| Type | Icon | Color Theme | Use Case |
|---|---|---|---|
release |
Download | Green | New version releases, feature announcements |
maintenance |
Settings | Blue | Scheduled maintenance, system updates |
warning |
Alert Triangle | Yellow/Orange | Important warnings, deprecations |
info |
Info | Blue | General information, tips |
| Priority | Badge Color | Behavior |
|---|---|---|
low |
Gray | Normal notification |
medium |
Blue | Normal notification |
high |
Orange | Highlighted notification |
critical |
Red | Top bar notification + highlighted |
The targetVersions array supports flexible version patterns:
"1.2.0"- Exact version match">=1.0.0"- Minimum version requirement"1.2.*"- Wildcard pattern matchingnullor[]- Show to all versions
{
"version": "1.0.0",
"lastUpdated": "2024-01-15T10:30:00Z",
"notifications": [
{
"id": "new-release-v1.2.0",
"type": "release",
"priority": "medium",
"title": "ThingConnect Pulse v1.2.0 Released",
"message": "New features include enhanced monitoring capabilities, improved dashboard, and performance optimizations.",
"actionUrl": "https://github.com/MachDatum/ThingConnect.Pulse/releases/tag/v1.2.0",
"actionText": "View Release Notes",
"validFrom": "2024-01-15T00:00:00Z",
"validUntil": "2024-02-15T23:59:59Z",
"targetVersions": [">=1.0.0"],
"showOnce": false
},
{
"id": "new-maintenance-jan-2024",
"type": "maintenance",
"priority": "high",
"title": "Scheduled Maintenance",
"message": "Our notification service will undergo maintenance on January 20th from 2:00 AM to 4:00 AM UTC.",
"actionUrl": "https://status.thingconnect.io",
"actionText": "View Status Page",
"validFrom": "2024-01-18T00:00:00Z",
"validUntil": "2024-01-21T00:00:00Z",
"targetVersions": [],
"showOnce": false
},
{
"id": "new-critical-security-update",
"type": "warning",
"priority": "critical",
"title": "Security Update Required",
"message": "A critical security vulnerability has been discovered. Please update to the latest version immediately.",
"actionUrl": "https://github.com/MachDatum/ThingConnect.Pulse/releases/latest",
"actionText": "Download Update",
"validFrom": "2024-01-10T00:00:00Z",
"validUntil": "2024-02-10T23:59:59Z",
"targetVersions": ["<1.1.5"],
"showOnce": true
}
]
}- Create or edit the
latest.jsonfile following the schema above - Validate the JSON format using a JSON validator
- Ensure all required fields are present
- Verify date formats are in ISO 8601 format
Using AWS Console:
- Log into the AWS S3 Console
- Navigate to the
thingconnect-pulsebucket - Go to the
notifications/folder - Upload or replace the
latest.jsonfile - Ensure the file has public read permissions
Using AWS CLI:
aws s3 cp latest.json s3://thingconnect-pulse/notifications/latest.json --acl public-readUsing AWS SDK (Node.js example):
const AWS = require('aws-sdk');
const s3 = new AWS.S3();
const params = {
Bucket: 'thingconnect-pulse',
Key: 'notifications/latest.json',
Body: JSON.stringify(notificationData),
ContentType: 'application/json',
ACL: 'public-read'
};
s3.upload(params, (err, data) => {
if (err) console.error(err);
else console.log('File uploaded successfully');
});- Check S3 URL: Visit
https://thingconnect-pulse.s3.ap-south-1.amazonaws.com/notifications/latest.json - Test in Application:
- Use the manual refresh button in the About page
- Or wait for the automatic 6-hour sync
- Monitor Logs: Check server logs for any fetch errors
For testing during development, you can modify the endpoint URL in the configuration:
File: ThingConnect.Pulse.Server/Services/NotificationBackgroundService.cs
public class NotificationFetchOptions
{
public string NotificationEndpoint { get; set; } = "http://localhost:3000/test-notifications.json"; // For testing
public int CheckIntervalHours { get; set; } = 6;
public bool EnableNotifications { get; set; } = true;
public int TimeoutSeconds { get; set; } = 30;
}- Valid Notifications: Upload a valid JSON file and verify it appears
- Invalid JSON: Upload malformed JSON and check error handling
- Expired Notifications: Test with past
validUntildates - Version Targeting: Test with different
targetVersionspatterns - Priority Levels: Test different priority levels and visual styling
- Action URLs: Test clicking notification action buttons
| File | Purpose | Description |
|---|---|---|
Services/NotificationBackgroundService.cs |
Background sync | Fetches notifications every 6 hours |
Controllers/NotificationController.cs |
API endpoints | REST API for frontend |
Data/Entities.cs |
Database models | EF Core entities for notifications |
Models/NotificationDtos.cs |
Data transfer objects | API request/response models |
The notifications are stored locally in SQLite with these tables:
Notifications Table:
Id(string, primary key)Type(enum: release, maintenance, warning, info)Priority(enum: low, medium, high, critical)Title,Message,ActionUrl,ActionTextValidFromTs,ValidUntilTs(Unix timestamps)IsRead,IsShown(tracking user interaction)CreatedTs,ReadTs,ShownTs(timestamps)
NotificationFetches Table:
- Tracks fetch attempts, success/failure, error messages
- Used for monitoring and debugging
| File | Purpose | Description |
|---|---|---|
components/notifications/NotificationBellSimple.tsx |
Bell icon | Shows in top-right corner |
components/notifications/NotificationCenterSimple.tsx |
Notification list | Popover content |
components/notifications/NotificationBannerSimple.tsx |
Individual notification | Single notification display |
components/notifications/NotificationTopBar.tsx |
Critical notifications | Top bar for critical alerts |
hooks/useNotifications.ts |
Data fetching | React Query hooks |
- Notification Bell: Top-right corner floating actions
- Notification Popover: Dropdown from bell icon
- Demo Page:
/settings/notifications(admin only) - About Page: Manual refresh section
The notification system is configured via these options:
public class NotificationFetchOptions
{
public string NotificationEndpoint { get; set; } = "https://thingconnect-pulse.s3.ap-south-1.amazonaws.com/notifications/latest.json";
public int CheckIntervalHours { get; set; } = 6;
public bool EnableNotifications { get; set; } = true;
public int TimeoutSeconds { get; set; } = 30;
}Configuration via appsettings.json:
{
"Notifications": {
"NotificationEndpoint": "https://your-custom-endpoint.com/notifications.json",
"CheckIntervalHours": 6,
"EnableNotifications": true,
"TimeoutSeconds": 30
}
}To disable the notification system:
- Set
EnableNotifications: falsein configuration - Or remove the background service registration from
Program.cs
Users with admin privileges can manually trigger a notification refresh:
Endpoint: POST /api/notification/refresh
Authorization: Admin only
Response: Success/error message
Frontend Usage:
- Available on the About page
- Button labeled "Refresh Notifications"
- Shows loading state and success/error feedback
The notification system logs important events:
- Successful fetches:
Successfully fetched X notifications - Network errors:
Network error fetching notifications - JSON errors:
JSON parsing error - Processing errors:
Error processing notifications
-
Notifications not appearing:
- Check S3 file is publicly accessible
- Verify JSON format is valid
- Check
validFrom/validUntildates - Ensure target versions match
-
Fetch errors:
- Network connectivity issues
- S3 bucket permissions
- CORS configuration
- Timeout settings
-
Popover positioning issues:
- Check CSS z-index conflicts
- Verify Chakra UI version compatibility
You can monitor notification system health via:
- Database: Check
NotificationFetchestable for recent successful fetches - API: Call
/api/notification/statsfor current status - Logs: Monitor application logs for fetch attempts
- Manual Test: Use refresh button on About page
- Public S3 Access: The notification file is publicly readable
- Content Safety: Ensure notification content is safe and appropriate
- URL Validation: Action URLs should be trusted domains only
- Version Targeting: Use carefully to avoid information disclosure
- Input Validation: Backend validates all notification data
- Testing: Always test notifications in a staging environment first
- Scheduling: Update notifications during low-usage periods
- Versioning: Use semantic versioning for targeting
- Urgency: Use critical priority sparingly for true emergencies
- Expiration: Set reasonable expiration dates to avoid clutter
- Clarity: Write clear, actionable notification messages
- Monitoring: Regularly check fetch logs for issues
Potential improvements to consider:
- Multiple Channels: Different notification types for different user roles
- Rich Content: Support for HTML formatting or images
- Localization: Multi-language support
- Analytics: Track notification engagement metrics
- Scheduling: Advanced scheduling and timezone support
- Templates: Predefined notification templates
- Approval Workflow: Review process before publishing notifications