Skip to content

fix(bookings): propagate Google Meet videoCallUrl metadata#29352

Open
4arjun wants to merge 3 commits into
calcom:mainfrom
4arjun:fix1
Open

fix(bookings): propagate Google Meet videoCallUrl metadata#29352
4arjun wants to merge 3 commits into
calcom:mainfrom
4arjun:fix1

Conversation

@4arjun
Copy link
Copy Markdown
Contributor

@4arjun 4arjun commented May 16, 2026

What does this PR do?

Fixes Google Meet booking metadata propagation so the generated Meet URL from Google Calendar is written to metadata.videoCallUrl.

Root cause

The Google Calendar event creation flow was successfully creating a Google Meet link, but the booking metadata layer was not reliably reading that link from the Google Calendar result.

In the confirmed booking creation path, metadata extraction relied on results[0].createdEvent. That is fragile because the Google Calendar result is not guaranteed to be the first result once conferencing/calendar integrations are processed. As a result, the Meet link could exist on the Google Calendar event while the final booking metadata was built without videoCallUrl.

The final booking response also reused the original booking object metadata, so even when metadata was computed later in the flow, the returned booking could still expose stale {} metadata.

What changed

  • Reads Google Meet metadata from the actual Google Calendar result instead of assuming results[0].
  • Applies the same Google Calendar result lookup in both:
    • fresh booking creation
    • booking reschedule flow
  • Builds a merged booking metadata object that preserves existing/request metadata and applies the generated videoCallUrl.
  • Uses the merged metadata consistently for:
    • persisted booking metadata,
    • returned booking metadata,
    • returned top-level videoCallUrl,
    • webhook metadata.
  • Adds regression coverage for both Google Meet booking creation and Google Meet rescheduling.
{
  "metadata": {}
}

After this change, booking creation returns, persists, and sends webhook metadata with:

{
  "metadata": {
    "videoCallUrl": "https://meet.google.com/..."
  }
}

This keeps the fix scoped to the booking creation flow and adds regression coverage for the Google Meet case.

Visual Demo

Before After
Before.mp4
After.mp4

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 if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

Run the full changed test file

TZ=UTC yarn vitest run packages/features/bookings/lib/handleNewBooking/test/fresh-booking.test.ts

Screenshot 2026-05-16 at 9 04 35 AM

Checklist

  • I have read the contributing guide
  • My code follows the style guidelines of this project
  • I have avoided unnecessary comments and kept the change focused
  • I have checked the changed files
  • My PR is small and focused (<500 lines and <10 files)

@github-actions
Copy link
Copy Markdown
Contributor

Welcome to Cal.diy, @4arjun! Thanks for opening this pull request.

A few things to keep in mind:

  • This is Cal.diy, not Cal.com. Cal.diy is a community-driven, fully open-source fork of Cal.com licensed under MIT. Your changes here will be part of Cal.diy — they will not be deployed to the Cal.com production app.
  • Please review our Contributing Guidelines if you haven't already.
  • Make sure your PR title follows the Conventional Commits format.

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added the 🐛 bug Something isn't working label May 16, 2026
@4arjun 4arjun marked this pull request as ready for review May 16, 2026 03:55
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: aaec95c7-7c18-4f0d-b9f2-a9a6a6d3f28a

📥 Commits

Reviewing files that changed from the base of the PR and between 60a2a57 and b36a019.

📒 Files selected for processing (3)
  • packages/features/bookings/lib/handleNewBooking/test/fresh-booking.test.ts
  • packages/features/bookings/lib/handleNewBooking/test/reschedule.test.ts
  • packages/features/bookings/lib/service/RegularBookingService.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/features/bookings/lib/handleNewBooking/test/reschedule.test.ts
  • packages/features/bookings/lib/handleNewBooking/test/fresh-booking.test.ts
  • packages/features/bookings/lib/service/RegularBookingService.ts

📝 Walkthrough

Walkthrough

This pull request refactors how booking metadata is handled for webhooks and API responses. It adds helper functions to normalize and filter Prisma JSON values down to primitive types suitable for webhook payloads. For Google Meet bookings, it introduces logic to prefer the Google Calendar event's conference data when available. The metadata construction flow now merges booking metadata, request metadata, and computed videoCallUrl details, filters the result for webhook safety, and consistently exposes videoCallUrl in booking responses and database records. The test suite is updated to validate that videoCallUrl appears correctly across booking metadata, response fields, and webhook assertions.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main fix: propagating Google Meet videoCallUrl metadata, which directly addresses the PR's primary objective.
Description check ✅ Passed The description thoroughly explains the root cause, changes made, and includes test results demonstrating the fix works as intended.
Linked Issues check ✅ Passed The PR addresses all coding requirements from issue #28555: restores videoCallUrl in metadata by reading from the correct Google Calendar result, applies the fix consistently in fresh booking creation and reschedule flows, and includes regression test coverage.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the Google Meet metadata propagation issue: updates to RegularBookingService logic, test file assertions, and whitespace adjustments are all directly related to the fix objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/features/bookings/lib/service/RegularBookingService.ts (1)

2028-2033: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Potential inconsistency: reschedule path still uses results[0] for Google Meet metadata.

The create path was fixed to prefer googleCalResult?.createdEvent (lines 2100-2118), but the reschedule path here still extracts hangoutLink, conferenceData, and entryPoints from results[0]?.updatedEvent/createdEvent. This could exhibit the same fragility as the original bug if Google Calendar is not the first integration result during a reschedule.

Consider applying the same fix pattern used in the create path:

  1. Find the Google Calendar result using findIndex
  2. Prefer its updatedEvent/createdEvent for extracting hangoutLink and conference metadata
  3. Fall back to results[0] only if Google Calendar result is not found
🔄 Suggested fix pattern (similar to create path)
+        const googleCalIndex = updateManager.referencesToCreate.findIndex(
+          (ref) => ref.type === "google_calendar"
+        );
+        const googleCalResult = results[googleCalIndex];
+        const updatedOrCreatedEventWithAdditionalInformation = Array.isArray(googleCalResult?.updatedEvent)
+          ? googleCalResult.updatedEvent[0]
+          : (googleCalResult?.updatedEvent ?? googleCalResult?.createdEvent ?? 
+             (Array.isArray(results[0]?.updatedEvent)
+               ? results[0]?.updatedEvent[0]
+               : (results[0]?.updatedEvent ?? results[0]?.createdEvent)));
-        const createdOrUpdatedEvent = Array.isArray(results[0]?.updatedEvent)
-          ? results[0]?.updatedEvent[0]
-          : (results[0]?.updatedEvent ?? results[0]?.createdEvent);
-        metadata.hangoutLink = createdOrUpdatedEvent?.hangoutLink;
-        metadata.conferenceData = createdOrUpdatedEvent?.conferenceData;
-        metadata.entryPoints = createdOrUpdatedEvent?.entryPoints;
+        metadata.hangoutLink = updatedOrCreatedEventWithAdditionalInformation?.hangoutLink;
+        metadata.conferenceData = updatedOrCreatedEventWithAdditionalInformation?.conferenceData;
+        metadata.entryPoints = updatedOrCreatedEventWithAdditionalInformation?.entryPoints;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/features/bookings/lib/service/RegularBookingService.ts` around lines
2028 - 2033, The reschedule path still reads Google Meet metadata from
results[0] which is fragile; update the logic that sets metadata.hangoutLink,
metadata.conferenceData, and metadata.entryPoints to first locate the Google
Calendar result (use the same findIndex/variable name pattern used in the create
path, e.g., googleCalIndex/googleCalResult), prefer
googleCalResult?.updatedEvent ?? googleCalResult?.createdEvent as
createdOrUpdatedEvent, and only fall back to results[0]?.updatedEvent ??
results[0]?.createdEvent if no Google Calendar result is found; update the
existing createdOrUpdatedEvent variable assignment in RegularBookingService to
follow this pattern so the reschedule path mirrors the create fix.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@packages/features/bookings/lib/service/RegularBookingService.ts`:
- Around line 2028-2033: The reschedule path still reads Google Meet metadata
from results[0] which is fragile; update the logic that sets
metadata.hangoutLink, metadata.conferenceData, and metadata.entryPoints to first
locate the Google Calendar result (use the same findIndex/variable name pattern
used in the create path, e.g., googleCalIndex/googleCalResult), prefer
googleCalResult?.updatedEvent ?? googleCalResult?.createdEvent as
createdOrUpdatedEvent, and only fall back to results[0]?.updatedEvent ??
results[0]?.createdEvent if no Google Calendar result is found; update the
existing createdOrUpdatedEvent variable assignment in RegularBookingService to
follow this pattern so the reschedule path mirrors the create fix.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: af073d2d-0444-4d60-936a-b8f94523c737

📥 Commits

Reviewing files that changed from the base of the PR and between 180ede2 and 51570bd.

📒 Files selected for processing (2)
  • packages/features/bookings/lib/handleNewBooking/test/fresh-booking.test.ts
  • packages/features/bookings/lib/service/RegularBookingService.ts

@pull-request-size pull-request-size Bot added size/L and removed size/M labels May 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

@github-actions github-actions Bot added Stale and removed Stale labels May 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

@github-actions github-actions Bot added Stale and removed Stale labels Jun 1, 2026
@4arjun
Copy link
Copy Markdown
Contributor Author

4arjun commented Jun 3, 2026

@bandhan-majumder Could you please take a look at this?

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

Labels

🐛 bug Something isn't working size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in v6.2 (self hosted): Google Meet videoCallUrl missing from metadata when using Google Calendar integration

1 participant