Skip to main content

Overview

The Calendar Events API (also accessible as db.meetings) manages virtual meeting events, particularly Zoom meetings with agenda, media references, and feedback integration.

Event Management

getAll

Retrieve all calendar events.
db.meetings.getAll(): CalendarEvent[]
events
CalendarEvent[]
Array of all calendar events
Example:
const events = db.meetings.getAll();
const upcoming = events.filter(e => 
  new Date(e.date) > new Date()
);

getById

Get a specific event by ID.
db.meetings.getById(id: string): CalendarEvent | undefined
id
string
required
Event ID
event
CalendarEvent | undefined
The event if found
Example:
const event = db.meetings.getById('ev_123');
if (event) {
  console.log('Event:', event.title, event.meetingUrl);
}

create

Create a new calendar event.
db.meetings.create(
  data: Omit<CalendarEvent, 'id'>
): CalendarEvent
data
Omit<CalendarEvent, 'id'>
required
Event data (ID auto-generated)
event
CalendarEvent
The created event with generated ID
Example:
const event = db.meetings.create({
  title: 'Weekly Meditation Session',
  date: '2024-03-20',
  day: '20',
  month: 'mar',
  time: '19:00',
  location: 'Online',
  type: 'Online',
  color: '#4f46e5',
  platform: 'Zoom',
  meetingUrl: 'https://zoom.us/j/123456789',
  zoomId: '123456789',
  zoomPassword: 'cafh2024',
  eventStatus: 'Programada',
  agendaItems: [
    {
      id: 'ag_1',
      order: 1,
      title: 'Introducción',
      description: 'Bienvenida y presentación',
      durationMinutes: 10
    },
    {
      id: 'ag_2',
      order: 2,
      title: 'Meditación Guiada',
      durationMinutes: 30
    }
  ]
});

save

Update an existing event.
db.meetings.save(event: CalendarEvent): CalendarEvent
event
CalendarEvent
required
Complete event object with updates
event
CalendarEvent
The saved event
Example:
const event = db.meetings.getById('ev_123');
if (event) {
  event.eventStatus = 'En curso';
  event.zoomPassword = 'newpass123';
  db.meetings.save(event);
}

delete

Delete an event.
db.meetings.delete(id: string): void
id
string
required
Event ID to delete
Example:
db.meetings.delete('ev_123');

Zoom Widget Configuration

getZoomConfig

Get the global Zoom widget configuration.
db.meetings.getZoomConfig(): ZoomWidgetConfig
config
ZoomWidgetConfig
Zoom widget display settings
Example:
const config = db.meetings.getZoomConfig();
console.log('Join button text:', config.joinButtonText);

updateZoomConfig

Update Zoom widget configuration.
db.meetings.updateZoomConfig(
  cfg: ZoomWidgetConfig
): ZoomWidgetConfig
cfg
ZoomWidgetConfig
required
New configuration
config
ZoomWidgetConfig
The updated configuration
Example:
db.meetings.updateZoomConfig({
  subtitle: 'Reunión Virtual CAFH',
  activityName: 'Meditación Semanal',
  joinButtonText: 'Unirse a la Sala',
  zoomUrl: 'https://zoom.us/j/123456789?pwd=abc'
});

CalendarEvent Type

interface CalendarEvent {
  id: string;
  title: string;
  date: string;           // YYYY-MM-DD
  day: string;
  month: string;
  time: string;           // HH:MM
  location: string;
  type: 'Presencial' | 'Online' | 'Híbrido';
  color: string;
  
  // Zoom Integration
  meetingUrl?: string;
  zoomId?: string;
  zoomPassword?: string;
  platform?: 'Zoom';
  
  // Event Management
  eventStatus?: 'Programada' | 'En curso' | 'Finalizada';
  organizerContactId?: string;  // Reference to Contact
  
  // Content
  agendaItems?: MeetingAgendaItem[];
  mediaRefs?: MeetingMediaRef[];
  zoomWidgetConfig?: ZoomWidgetConfig;
  
  // Sync with Activity Calendar
  linkedActivityId?: string;    // Linked to ActivityEvent
  
  // Legacy fields (maintained for compatibility)
  agenda?: string[];
  resources?: EventResource[];
  seo?: SEOConfig;
}

MeetingAgendaItem

interface MeetingAgendaItem {
  id: string;
  order: number;
  title: string;
  description?: string;
  durationMinutes: number;
}

MeetingMediaRef

Reference to media library assets (read-only).
interface MeetingMediaRef {
  mediaAssetId: string;
  label?: string;
}

ZoomWidgetConfig

interface ZoomWidgetConfig {
  subtitle: string;
  activityName: string;
  joinButtonText: string;
  zoomUrl: string;
}

Working with Agenda

Add Agenda Items

const event = db.meetings.getById('ev_123');
if (event) {
  event.agendaItems = [
    {
      id: 'ag_1',
      order: 1,
      title: 'Opening',
      durationMinutes: 5
    },
    {
      id: 'ag_2',
      order: 2,
      title: 'Main Session',
      description: 'Guided meditation',
      durationMinutes: 45
    },
    {
      id: 'ag_3',
      order: 3,
      title: 'Q&A',
      durationMinutes: 10
    }
  ];
  db.meetings.save(event);
}

Linking to Activity Calendar

Events can be synchronized with the Activity Calendar module.
// When creating a virtual ActivityEvent, it auto-syncs to meetings
const activity = db.activities.create({
  title: 'Meditation Workshop',
  description: 'Weekly session',
  category: 'cat_meditation',
  tags: ['meditation'],
  startDate: '2024-03-20',
  endDate: '2024-03-20',
  startTime: '19:00',
  endTime: '20:00',
  modality: 'Virtual',
  status: 'Publicado',
  zoomUrl: 'https://zoom.us/j/123',
  featuredInDashboard: true
});

// This automatically creates a CalendarEvent
const event = db.meetings.getById(activity.linkedMeetingId);

Event Status Workflow

  1. Programada → Event created, not yet started
  2. En curso → Event is currently happening
  3. Finalizada → Event completed
// Update status as event progresses
const event = db.meetings.getById('ev_123');
if (event) {
  event.eventStatus = 'En curso';
  db.meetings.save(event);
}

Integration with Feedback

After an event, members can submit feedback (see Feedback API).
// Check if user has pending feedback for event
const hasPending = db.feedback.hasBlockingFeedback(userId);
if (hasPending) {
  console.log('User must submit feedback before joining next event');
}

Build docs developers (and LLMs) love