Microsoft Calendar (minor): Add EventCreated, EventUpdated, EventDeleted, EventStart triggers#1009
Conversation
…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
There was a problem hiding this comment.
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.calendarbundle version to1.1.0and 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. |
| // 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); |
There was a problem hiding this comment.
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.
| // 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); |
| 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); |
There was a problem hiding this comment.
Agreed — add validation and normalization for minutesBefore right after it's read. Suggested change to lines 9–10 (replace the minutesBefore assignment):
| 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.
| "1.1.0": [ | ||
| "Added EventCreated, EventUpdated, EventDeleted, and EventStart triggers." | ||
| ] |
There was a problem hiding this comment.
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:
- 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.
- 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.
Summary
Implements #926 — adds 4 triggers to the microsoft.calendar connector.
New Components
Implementation Details
Version
Bumped to 1.1.0 in bundle.json with changelog entry.