SOBIE Conference API Documentation

Communication System Documentation

Overview

The SOBIE Conference Communication System provides comprehensive messaging, announcements, and notification capabilities with special support for schedule changes that preserve original information using strikethrough formatting.

Features

🔗 Core Messaging

📢 Announcements

📅 Schedule Change Notifications

🔔 Notification System

API Endpoints

Messages

Get User Messages

GET /api/communications/messages

Query Parameters:

Get Specific Message

GET /api/communications/messages/:messageId

Response includes:

Send Message

POST /api/communications/messages

Body:

{
  "subject": "Meeting Request",
  "content": "Let's discuss the research proposal.",
  "recipientIds": ["user1_id", "user2_id"],
  "messageType": "direct",
  "priority": "normal",
  "conferenceId": "conference_id",
  "attachments": [
    {
      "filename": "proposal.pdf",
      "fileType": "application/pdf",
      "fileSize": 1024000,
      "url": "https://storage.example.com/files/proposal.pdf"
    }
  ],
  "scheduledSendTime": "2024-03-15T10:00:00Z"
}

Reply to Message

POST /api/communications/messages/:messageId/reply

Body:

{
  "content": "Thanks for the information!",
  "replyToAll": false
}

Announcements

Send Announcement

POST /api/communications/announcements

Required Roles: Admin, Conference Chairperson, Editor

Body:

{
  "subject": "Important Conference Update",
  "content": "Please review the updated conference schedule.",
  "conferenceId": "conference_id",
  "priority": "high",
  "targetAudience": "all",
  "scheduledSendTime": "2024-03-15T09:00:00Z"
}

Target Audience Options:

Schedule Changes

Send Schedule Change Notification

POST /api/communications/schedule-changes

Required Roles: Admin, Editor

Body:

{
  "sessionId": "session_id",
  "changeType": "time",
  "originalData": {
    "scheduledTime": "2024-03-15T10:00:00Z",
    "location": "Room A101"
  },
  "newData": {
    "scheduledTime": "2024-03-15T14:00:00Z",
    "location": "Room B205"
  },
  "reason": "Venue conflict resolution",
  "customMessage": "We apologize for any inconvenience caused by this change."
}

Change Types:

Notifications

Get User Notifications

GET /api/communications/notifications

Query Parameters:

Mark Notification as Read

PUT /api/communications/notifications/:notificationId/read

Mark Multiple Notifications as Read

PUT /api/communications/notifications/mark-read

Body:

{
  "notificationIds": ["notif1_id", "notif2_id"]
}

Utility Endpoints

Get Communication Statistics

GET /api/communications/stats

Response:

{
  "success": true,
  "data": {
    "messages": {
      "total": 45,
      "unread": 3,
      "byType": {
        "direct": 30,
        "announcement": 10,
        "schedule_change": 5
      }
    },
    "notifications": {
      "total": 67,
      "unread": 8,
      "byType": {
        "message": 40,
        "announcement": 15,
        "schedule_change": 8,
        "system": 4
      }
    }
  }
}

Search Messages

GET /api/communications/messages/search?q=research&type=direct

Schedule Change HTML Formatting

The system automatically generates rich HTML for schedule changes with strikethrough formatting for original data:

Example Output

<div class="schedule-change-notification">
  <div class="change-header">
    <h3>⚠️ Schedule Change: TIME CHANGE</h3>
    <p><strong>Reason:</strong> Venue conflict resolution</p>
  </div>
  
  <div class="change-details">
    <div class="change-item">
      <strong>Time:</strong>
      <span class="original-value">March 15, 2024 10:00 AM</span>
      <span class="arrow"></span>
      <span class="new-value">March 15, 2024 2:00 PM</span>
    </div>
    
    <div class="change-item">
      <strong>Location:</strong>
      <span class="original-value">Room A101</span>
      <span class="arrow"></span>
      <span class="new-value">Room B205</span>
    </div>
  </div>
</div>

CSS Styling

.schedule-change-notification .original-value {
  text-decoration: line-through;
  color: #999;
  background-color: #ffe6e6;
  padding: 2px 4px;
  border-radius: 3px;
}

.schedule-change-notification .new-value {
  color: #d73527;
  background-color: #e6f3ff;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: bold;
}

Models

Message Model

{
  subject: String,
  content: String,
  messageType: ['direct', 'announcement', 'schedule_change'],
  priority: ['low', 'normal', 'high', 'urgent'],
  senderId: ObjectId,
  recipients: [{
    userId: ObjectId,
    readStatus: ['unread', 'read'],
    readTimestamp: Date,
    deliveryStatus: ['pending', 'delivered', 'failed']
  }],
  scheduleChange: {
    changeType: String,
    originalData: Object,
    newData: Object
  },
  attachments: [{
    filename: String,
    fileType: String,
    fileSize: Number,
    url: String
  }],
  threadId: ObjectId,
  parentMessageId: ObjectId,
  isReply: Boolean,
  deliveryStatus: ['draft', 'sending', 'sent', 'failed'],
  scheduledSendTime: Date,
  actualSendTime: Date
}

Notification Model

{
  title: String,
  message: String,
  type: ['message', 'announcement', 'schedule_change', 'system', 'community'],
  priority: ['low', 'normal', 'high', 'urgent'],
  userId: ObjectId,
  status: ['unread', 'read'],
  channels: [{
    type: ['in_app', 'email', 'sms', 'push'],
    status: ['pending', 'sent', 'delivered', 'failed'],
    sentAt: Date,
    deliveredAt: Date
  }],
  actionRequired: Boolean,
  actionType: String,
  actionUrl: String,
  expiresAt: Date
}

Usage Examples

Send Direct Message with Attachment

const messageData = {
  subject: "Research Collaboration",
  content: "I'd like to discuss a potential collaboration.",
  recipientIds: ["user123", "user456"],
  attachments: [{
    filename: "research_proposal.pdf",
    fileType: "application/pdf",
    fileSize: 1500000,
    url: "https://storage.example.com/files/proposal.pdf"
  }]
};

const response = await fetch('/api/communications/messages', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${token}`
  },
  body: JSON.stringify(messageData)
});

Send Conference Announcement

const announcementData = {
  subject: "Conference Dinner Details",
  content: "Join us for the conference dinner at the Grand Hotel.",
  conferenceId: "conf123",
  priority: "normal",
  targetAudience: "all"
};

const response = await fetch('/api/communications/announcements', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${token}`
  },
  body: JSON.stringify(announcementData)
});

Notify of Schedule Change

const scheduleChangeData = {
  sessionId: "session123",
  changeType: "location",
  originalData: { location: "Room A" },
  newData: { location: "Online Meeting" },
  reason: "Technical difficulties with AV equipment",
  customMessage: "Please check your email for the meeting link."
};

const response = await fetch('/api/communications/schedule-changes', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${token}`
  },
  body: JSON.stringify(scheduleChangeData)
});

Integration Notes

With Conference System

With Community System

With User Roles

Security Considerations

Performance Optimization

Testing

Run the communication system tests:

node src/tests/communicationTests.js

This will test:

Future Enhancements