Notifications & Events Overview

DocuPulse features a comprehensive notification and event logging system that provides real-time alerts, email notifications, and detailed audit trails. The system combines in-app notifications with email delivery, offering users multiple ways to stay informed about important activities and system events. Built with security and compliance in mind, it provides complete visibility into user actions and system activities.

Notification System
Notification Types
User Management
  • account_created - New user account created
  • password_reset - Password reset requested
  • account_deleted - User account deleted
  • account_updated - User profile updated
  • password_changed - Password successfully changed
Collaboration
  • room_invite - Invited to join room
  • room_invite_removed - Removed from room
  • conversation_invite - Invited to conversation
  • conversation_invite_removed - Removed from conversation
  • conversation_message - New message received
Notification Creation
Creation Process
  • 1. Event triggers notification
  • 2. System validates notification type
  • 3. Creates notification record
  • 4. Generates email template
  • 5. Sends email via SMTP
  • 6. Updates notification status
Required Parameters
  • notif_type - Type of notification
  • user_id - Target user ID
  • sender_id - Optional sender ID
  • details - Additional data
  • generate_mail - Email flag
Email Integration
SMTP Configuration
  • smtp_server - SMTP server address
  • smtp_port - SMTP port number
  • use_tls - TLS encryption flag
  • username - SMTP username
  • password - SMTP password
  • sender_email - From email address
Email Templates
  • Account Created - New user welcome
  • Password Reset - Reset instructions
  • Room Invite - Room invitation
  • Conversation Invite - Chat invitation
  • Conversation Message - Message alerts
Event Logging System
Event Types
User Events
  • user_login - User authentication
  • user_logout - User logout
  • user_create - Account creation
  • user_update - Profile updates
  • user_delete - Account deletion
Room Events
  • room_create - Room creation
  • room_update - Room modifications
  • room_delete - Room deletion
  • room_member_add - Member addition
  • room_member_remove - Member removal
File Events
  • file_upload - File uploads
  • file_download - File downloads
  • file_delete - File deletions
  • file_rename - File renaming
  • file_move - File moving
Conversation Events
  • conversation_create - Chat creation
  • conversation_update - Chat updates
  • conversation_delete - Chat deletion
  • message_create - Message sending
  • conversation_open - Chat access
Event Logging Process
Logging Steps
  • 1. Event occurs in system
  • 2. log_event() function called
  • 3. Validates event type
  • 4. Captures user context
  • 5. Records IP and user agent
  • 6. Stores in database
Event Data
  • event_type - Type of event
  • user_id - User who triggered
  • timestamp - Event time
  • details - Event-specific data
  • ip_address - User IP address
  • user_agent - Browser/client info
Notification Management
Notification Operations
User Operations
  • get_user_notifications - Fetch user notifications
  • mark_notification_read - Mark as read
  • mark_all_notifications_read - Mark all read
  • get_unread_count - Count unread
  • delete_notification - Delete notification
System Operations
  • delete_old_notifications - Cleanup old notifications
  • generate_mail_from_notification - Create email
  • send_email_via_smtp - Send email
  • get_smtp_settings - Get email config
  • create_notification - Create new notification
Event Queries
Event Retrieval
  • get_user_events - User-specific events
  • get_room_events - Room-specific events
  • get_recent_events - Recent system events
  • get_events_by_type - Filter by event type
  • get_events_by_date_range - Date range filter
Query Parameters
  • user_id - Filter by user
  • event_type - Filter by type
  • start_date - Start date
  • end_date - End date
  • limit - Result limit
Email Template System
Template Variables
User Variables
  • {{ '{{ user.username }}' }} - User's full name
  • {{ '{{ user.email }}' }} - User's email
  • {{ '{{ user.company }}' }} - User's company
  • {{ '{{ user.position }}' }} - User's position
  • {{ '{{ sender.username }}' }} - Sender's name
System Variables
  • {{ '{{ site.company_name }}' }} - Company name
  • {{ '{{ site.company_website }}' }} - Website
  • {{ '{{ setup_link }}' }} - Setup URL
  • {{ '{{ reset_link }}' }} - Reset URL
  • {{ '{{ created_at }}' }} - Creation time
Content Variables
  • {{ '{{ conversation.name }}' }} - Chat name
  • {{ '{{ message.content }}' }} - Message text
  • {{ '{{ room_link }}' }} - Room URL
  • {{ '{{ conversation_link }}' }} - Chat URL
  • {{ '{{ updated_fields }}' }} - Changed fields
Time Variables
  • {{ '{{ created_at }}' }} - Creation timestamp
  • {{ '{{ updated_at }}' }} - Update timestamp
  • {{ '{{ deleted_at }}' }} - Deletion timestamp
  • {{ '{{ removed_at }}' }} - Removal timestamp
  • {{ '{{ expiry_time }}' }} - Expiration time
Quick Reference
Notification Status
Unread Pending
Read Processed
Email Sent Delivered
Email Failed Error
System Limits
Notification Retention 30 days
Event Retention 90 days
Email Queue Real-time
Notification Features
  • Real-time in-app notifications
  • Email notification delivery
  • Template-based email system
  • Notification filtering and search
  • Bulk notification management
  • Notification preferences
Event Logging Features
  • Comprehensive audit trails
  • IP address tracking
  • User agent logging
  • Event categorization
  • Time-based filtering
  • Export capabilities
Security Features
  • Secure SMTP configuration
  • TLS encryption support
  • IP address logging
  • User authentication tracking
  • Access control validation
  • Data retention policies
Technical Stack
Backend
Flask + SQLAlchemy
Notification processing
Email
SMTP + Jinja2
Email templates
Database
PostgreSQL
Event storage
Frontend
JavaScript + AJAX
Real-time updates