What does this PR do?

  • Fixes #21050 (GitHub issue number) /claim #21050

Visual Demo (For contributors especially)

A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).

Video Demo (if applicable):

  • Show screen recordings of the issue or feature.
  • Demonstrate how to reproduce the issue, the behavior before and after the change.

Image Demo (if applicable):

  • Add side-by-side screenshots of the original and updated change.
  • Highlight any significant change(s).

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox. N/A
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set? Yes, you must set OFFICE365_WEBHOOK_CLIENT_STATE in .env, this is used to validate webhook notifications from Microsoft Graph about calendar changes.

  • What are the minimal test data to have? One user with Microsoft Outlook calendar connected and an event created to view availability page.

  • What is expected (happy path) to have (input and output)?

    • Input: View availability on booking page
    • Expected Output:
      • Before cron job runs: Shows availability fetched directly from API (logs show “Cache Miss”)
      • After cron job runs: ALL requests served from cache (logs show “Cache Hit”)
      • Calendar changes in Outlook trigger webhook → cache updates immediately → next UI request shows updated availability from cache
    1. Check Webhook Subscription:
      • In database: SelectedCalendar table should have office365SubscriptionId populated after cron run
      • Subscription expires after 3 days and auto-renews via cron
    2. Verify Cache Performance:
      • Enable debug logs: NEXT_PUBLIC_LOGGER_LEVEL=2 in .env
      • Expected logs after cron has run:
        [Cache Hit] Returning cached availability result
        
      • You should NOT see “Cache Miss” after the cron job has populated the cache
    3. Test Real-time Updates:
      • Create/modify/delete an event in Outlook
      • Webhook updates cache immediately
      • Refresh Cal.com availability page
      • Still shows “[Cache Hit]” but with updated availability
  • Any other important info that could help to test that PR

    1. Enable Feature Flags in the Feature table:
      • Set calendar-cache to true
      • Set calendar-cache-serve to true
    2. Connect Microsoft Outlook Calendar.
    3. Initialize Calendar Cache by calling the cron API (/api/calendar-cache/cron) either manually or have it setup to run automatically and wait for it to complete.

Note:

  • Currently the cache for the Google calendar integration is used only if the user is in a team and the team has the team feature flag enabled. For this Outlook calendar integration, the user doesn’t need to be part of a team and only the global calendar-cache and calendar-cache-serve flags need to be enabled. This was a concious design decision and can be adjusted based on the requirement.

Claim

Total prize pool $500
Total paid $0
Status Pending
Submitted July 17, 2025
Last updated July 17, 2025

Contributors

SI

sidequestdeveloper

@

100%

Sponsors

CA

Cal.com, Inc.

@cal

$500