Mirra
Building with MirraScriptsEvents Reference

Google Calendar Events

Automate workflows based on calendar event changes

Google Calendar events fire when calendar events are updated or deleted in your connected Google Calendar. These events provide event details including times, attendees, location, and recurrence rules.


Event Types

calendar.event_updated

The calendar.event_updated event fires when an existing calendar event is modified. This includes changes to time, location, attendees, or any other event property.

Event Type:

type: 'calendar.event_updated'
source: 'google-calendar'

Fields:

content.text (string)

Event summary (title).

content.contentType (ContentType)

Always 'calendar_event' for calendar events.

actor.name (string)

Display name of the event creator.

context (null)

Always null for calendar events as they don't have channel context.

calendar.eventId (string)

Google Calendar event ID.

calendar.summary (string)

Event title or summary.

calendar.description (string)

Event description or notes. Empty string if no description.

calendar.location (string | null)

Event location or meeting room. Null if no location specified.

calendar.startTime (Date)

Event start time.

calendar.endTime (Date)

Event end time.

calendar.isAllDay (boolean)

True if the event is an all-day event.

calendar.creator (EmailAddress)

Event creator with email and optional display name.

calendar.attendees (EmailAddress[])

Array of attendee email addresses with optional names. Empty array if no attendees.

calendar.recurrence (RecurrenceRule | null)

Recurrence rule for repeating events. Null for one-time events.

All fields reflect the current (updated) event state.

Example - Change Notification:

export async function handler(event, context) {
  // Notify about event changes
  await mirra.telegram.sendMessage({
    chatId: 'your-chat-id',
    text: `📅 Event Updated: ${event.calendar.summary}\n\nNew time: ${event.calendar.startTime.toLocaleString()}\nLocation: ${event.calendar.location || 'None'}`
  });
  
  return { success: true };
}

calendar.event_deleted

The calendar.event_deleted event fires when a calendar event is deleted.

Event Type:

type: 'calendar.event_deleted'
source: 'google-calendar'

Fields:

calendar.eventId (string)

ID of the deleted event.

calendar.summary (string)

Title of the deleted event for reference.

Example - Deletion Logger:

export async function handler(event, context) {
  // Log deleted events
  await mirra.memory.create({
    type: 'calendar_deletion',
    content: `Event deleted: ${event.calendar.summary}`,
    metadata: {
      eventId: event.calendar.eventId,
      deletedAt: event.timestamp
    }
  });
  
  return { success: true };
}

Common Use Cases

Meeting Prep Assistant

export async function handler(event, context) {
  // Only for meetings with 3+ attendees
  if (event.calendar.attendees.length < 3) {
    return { success: true, skipped: true };
  }
  
  // Create meeting prep checklist 24 hours before
  const prepTime = new Date(event.calendar.startTime.getTime() - 24 * 60 * 60 * 1000);
  
  await mirra.assignments.create({
    title: `Prep for: ${event.calendar.summary}`,
    description: `Prepare for meeting with ${event.calendar.attendees.length} attendees`,
    dueDate: prepTime,
    metadata: {
      eventId: event.calendar.eventId,
      location: event.calendar.location,
      attendees: event.calendar.attendees.map(a => a.email)
    }
  });
  
  return { success: true };
}

Time Tracking

export async function handler(event, context) {
  // Calculate meeting duration
  const durationMs = event.calendar.endTime.getTime() - event.calendar.startTime.getTime();
  const durationHours = durationMs / (1000 * 60 * 60);
  
  // Log to time tracking sheet
  await mirra.google.sheets.appendRow({
    spreadsheetId: 'time-tracking-sheet-id',
    sheetName: 'Meetings',
    values: [
      event.calendar.startTime.toISOString().split('T')[0], // Date
      event.calendar.summary,
      durationHours.toFixed(2),
      event.calendar.attendees.length,
      event.calendar.location || 'Virtual'
    ]
  });
  
  return { success: true };
}

Recurring Meeting Tracker

export async function handler(event, context) {
  // Only track recurring meetings
  if (!event.calendar.recurrence) {
    return { success: true, skipped: true };
  }
  
  const recurrence = event.calendar.recurrence;
  
  // Store recurring meeting info
  await mirra.memory.create({
    type: 'recurring_meeting',
    content: `${event.calendar.summary} - ${recurrence.frequency}`,
    metadata: {
      eventId: event.calendar.eventId,
      frequency: recurrence.frequency,
      interval: recurrence.interval,
      until: recurrence.until,
      attendees: event.calendar.attendees.length
    }
  });
  
  return { success: true };
}

See Also

On this page