POST /calendar/event
{
"title": "Test Content Event",
"description": "Testing contentId in notification",
"startDate": "2025-01-15T10:00:00.000Z",
"endDate": "2025-01-15T11:00:00.000Z",
"eventType": "content_publishing",
"contentId": "507f1f77bcf86cd799439011",
"platform": ["twitter"],
"reminders": [
{ "type": "push", "time": 5 }
]
}POST /notifications/test/run-scheduler
GET /notifications?type=schedule&limit=5
{
"notifications": [
{
"_id": "...",
"userId": "...",
"type": "schedule",
"title": "Upcoming Event: Test Content Event",
"message": "Test Content Event is starting in 5 minutes.",
"priority": "medium",
"status": "unread",
"data": {
"eventId": "...",
"startDate": "2025-01-15T10:00:00.000Z",
"endDate": "2025-01-15T11:00:00.000Z",
"type": "content_publishing",
"reminderType": "push",
"contentId": "507f1f77bcf86cd799439011" // ← This should be included
},
"createdAt": "...",
"updatedAt": "..."
}
]
}-
Scheduler Service: Modified
generateEventNotification()andgenerateEventFollowUpNotification()to includecontentIdin notification data when the event has an associated content. -
Notification Service: Updated
generatePerformanceAlert(),generateTrendAlert(), andgenerateScheduleReminder()to:- Accept
userIdas first parameter - Use
createNotification()method instead of returning raw objects - This ensures proper broadcasting and settings enforcement
- Accept
- Direct Content Access: You can now access content directly from notifications via
notification.data.contentId - Consistent Broadcasting: All notification types now go through the same
createNotification()flow - Settings Enforcement: Performance and trend alerts now respect user notification settings and quiet hours
- WebSocket Support: All notifications are properly broadcast to connected clients
// Access content from notification
const contentId = notification.data?.contentId;
if (contentId) {
// Fetch content details
const content = await fetchContent(contentId);
// Show content preview in notification UI
}