Skip to content

Microsoft Calendar (minor): Add EventCreated, EventUpdated, EventDeleted, EventStart triggers#1009

Open
salatv-ai wants to merge 4 commits into
Appmixer-ai:devfrom
salatv-ai:feature/microsoft-calendar-triggers
Open

Microsoft Calendar (minor): Add EventCreated, EventUpdated, EventDeleted, EventStart triggers#1009
salatv-ai wants to merge 4 commits into
Appmixer-ai:devfrom
salatv-ai:feature/microsoft-calendar-triggers

Conversation

@salatv-ai

Copy link
Copy Markdown
Contributor

Summary

Implements #926 — adds 4 triggers to the microsoft.calendar connector.

New Components

  • EventCreated — webhook trigger, fires when a calendar event is created
  • EventUpdated — webhook trigger, fires when a calendar event is updated
  • EventDeleted — webhook trigger, fires when a calendar event is deleted
  • EventStart — polling trigger, fires when a calendar event is about to start (configurable minutes-before offset)

Implementation Details

  • Webhook triggers use Microsoft Graph subscriptions API
  • Subscription auto-renewal before expiration (max 4230 minutes)
  • Webhook validation via validationToken query parameter
  • EventDeleted outputs notification metadata only (event no longer exists)
  • EventStart polls /me/calendarView and tracks fired events in state to avoid duplicates

Version

Bumped to 1.1.0 in bundle.json with changelog entry.

Salat added 2 commits March 11, 2026 14:29
…d, EventStart triggers

Implements GitHub issue Appmixer-ai#926.

- EventCreated/Updated/Deleted: webhook-based using MS Graph subscriptions API
- EventStart: polling-based trigger using calendarView endpoint
- Auto-renews subscriptions before expiration (4230 min max)
- EventDeleted outputs notification metadata (event already gone)
- EventStart supports configurable minutesBefore offset
@vtalas vtalas linked an issue Mar 11, 2026 that may be closed by this pull request
@vtalas vtalas requested a review from Copilot March 17, 2026 08:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new Microsoft Calendar trigger components to the connector, enabling workflows to react to calendar event lifecycle changes and upcoming event start times.

Changes:

  • Added webhook triggers for event created/updated/deleted using Microsoft Graph subscriptions.
  • Added a polling trigger for “event about to start” based on /me/calendarView.
  • Bumped appmixer.microsoft.calendar bundle version to 1.1.0 and updated changelog.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/appmixer/microsoft/calendar/EventCreated/EventCreated.js New webhook trigger: subscribe to Graph created event notifications and fetch event details.
src/appmixer/microsoft/calendar/EventCreated/component.json Manifest for EventCreated trigger output fields and auth/quota settings.
src/appmixer/microsoft/calendar/EventUpdated/EventUpdated.js New webhook trigger: subscribe to Graph updated notifications and fetch event details.
src/appmixer/microsoft/calendar/EventUpdated/component.json Manifest for EventUpdated trigger output fields and auth/quota settings.
src/appmixer/microsoft/calendar/EventDeleted/EventDeleted.js New webhook trigger: subscribe to Graph deleted notifications and emit deletion metadata.
src/appmixer/microsoft/calendar/EventDeleted/component.json Manifest for EventDeleted trigger output fields and auth/quota settings.
src/appmixer/microsoft/calendar/EventStart/EventStart.js New tick-based trigger to emit events when they are about to start.
src/appmixer/microsoft/calendar/EventStart/component.json Manifest for EventStart trigger properties (minutesBefore) and output fields.
src/appmixer/microsoft/calendar/bundle.json Version bump and changelog entry for added triggers.

Comment on lines +11 to +14
// Look ahead window: check events starting within the next 15 minutes (+ minutesBefore offset).
const now = new Date();
const startDateTime = new Date(now.getTime() - minutesBefore * 60 * 1000);
const endDateTime = new Date(now.getTime() + 15 * 60 * 1000);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. The fix is to extend endDateTime by minutesBefore so the query window always covers events that are eligible to fire in this tick.

Suggested change
// Look ahead window: check events starting within the next 15 minutes (+ minutesBefore offset).
const now = new Date();
const startDateTime = new Date(now.getTime() - minutesBefore * 60 * 1000);
const endDateTime = new Date(now.getTime() + 15 * 60 * 1000);
const endDateTime = new Date(now.getTime() + (minutesBefore + 15) * 60 * 1000);

Comment on lines +9 to +14
const minutesBefore = context.properties.minutesBefore || 0;

// Look ahead window: check events starting within the next 15 minutes (+ minutesBefore offset).
const now = new Date();
const startDateTime = new Date(now.getTime() - minutesBefore * 60 * 1000);
const endDateTime = new Date(now.getTime() + 15 * 60 * 1000);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed — add validation and normalization for minutesBefore right after it's read. Suggested change to lines 9–10 (replace the minutesBefore assignment):

Suggested change
const minutesBefore = context.properties.minutesBefore || 0;
// Look ahead window: check events starting within the next 15 minutes (+ minutesBefore offset).
const now = new Date();
const startDateTime = new Date(now.getTime() - minutesBefore * 60 * 1000);
const endDateTime = new Date(now.getTime() + 15 * 60 * 1000);
const minutesBeforeRaw = context.properties.minutesBefore;
const minutesBefore = Math.max(0, Math.round(Number.isFinite(Number(minutesBeforeRaw)) ? Number(minutesBeforeRaw) : 0));

This clamps negative values to 0, rounds to an integer, and handles non-numeric inputs gracefully.

Comment on lines +20 to +22
"1.1.0": [
"Added EventCreated, EventUpdated, EventDeleted, and EventStart triggers."
]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new trigger components (EventCreated, EventUpdated, EventDeleted, EventStart) should each have coverage in the connector's E2E test flows.

At minimum, please add flows that:

  1. EventCreated / EventUpdated / EventDeleted — Create a calendar event, verify the trigger fires, update it, verify the updated trigger fires, then delete it and verify the deleted trigger fires.
  2. EventStart — Create an event starting in ~2 minutes with minutesBefore=1, wait for the trigger to fire.

You can reference the existing test-flow.json structure for the connector or the E2E test flow patterns used in other microsoft connectors (e.g. microsoft/sharepoint). If a full E2E flow is out of scope for this PR, at minimum update test-flow.json to include a stub for each new component so they're registered in the test plan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

microsoft.calendar: add triggers

4 participants