Skip to content

Scheduling infrastructure for absolutely everyone.

If no location is set, default to Cal Video (#5812)

Joe Au-Yeung5e88ad50ea3d
diff --git a/apps/web/pages/booking/[uid].tsx b/apps/web/pages/booking/[uid].tsx
index 9c4b97fd870..2f783caf768 100644
--- a/apps/web/pages/booking/[uid].tsx
+++ b/apps/web/pages/booking/[uid].tsx
@@ -167,9 +167,11 @@ export default function Success(props: SuccessProps) {
if ((isCancellationMode || changes) && typeof window !== "undefined") {
window.scrollTo(0, document.body.scrollHeight);
}
+
const location: ReturnType<typeof getEventLocationValue> = Array.isArray(props.bookingInfo.location)
- ? props.bookingInfo.location[0] || ""
- : props.bookingInfo.location || "";
+ ? props.bookingInfo.location[0]
+ : // If there is no location set then we default to Cal Video
+ "integrations:daily";
if (!location) {
// Can't use logger.error because it throws error on client. stdout isn't available to it.
diff --git a/apps/web/playwright/webhook.e2e.ts b/apps/web/playwright/webhook.e2e.ts
index 5c452c8d413..cf1c64b3f09 100644
--- a/apps/web/playwright/webhook.e2e.ts
+++ b/apps/web/playwright/webhook.e2e.ts
@@ -65,6 +65,8 @@ test("add webhook & test that creating an event triggers a webhook call", async
body.payload.additionalInformation = dynamic;
body.payload.requiresConfirmation = dynamic;
body.payload.eventTypeId = dynamic;
+ body.payload.videoCallData = dynamic;
+ body.payload.appsStatus = dynamic;
// if we change the shape of our webhooks, we can simply update this by clicking `u`
// console.log("BODY", body);
diff --git a/apps/web/playwright/webhook.e2e.ts-snapshots/webhookResponse--calcom-web.txt b/apps/web/playwright/webhook.e2e.ts-snapshots/webhookResponse--calcom-web.txt
index 04144019b52..fdc324df8a0 100644
--- a/apps/web/playwright/webhook.e2e.ts-snapshots/webhookResponse--calcom-web.txt
+++ b/apps/web/playwright/webhook.e2e.ts-snapshots/webhookResponse--calcom-web.txt
@@ -1 +1 @@
-{"triggerEvent":"BOOKING_CREATED","createdAt":"[redacted/dynamic]","payload":{"type":"30 min","title":"30 min between PRO and Test Testson","description":"","additionalNotes":"","customInputs":{},"startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"PRO","email":"[redacted/dynamic]","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"[email protected]","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"hideCalendarNotes":false,"requiresConfirmation":"[redacted/dynamic]","eventTypeId":"[redacted/dynamic]","seatsShowAttendees":false,"uid":"[redacted/dynamic]","eventTitle":"30 min","eventDescription":null,"price":0,"currency":"usd","length":30,"bookingId":"[redacted/dynamic]","metadata":{},"status":"ACCEPTED","additionalInformation":"[redacted/dynamic]"}}
\ No newline at end of file
+{"triggerEvent":"BOOKING_CREATED","createdAt":"[redacted/dynamic]","payload":{"type":"30 min","title":"30 min between PRO and Test Testson","description":"","additionalNotes":"","customInputs":{},"startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"PRO","email":"[redacted/dynamic]","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"[email protected]","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"hideCalendarNotes":false,"requiresConfirmation":"[redacted/dynamic]","eventTypeId":"[redacted/dynamic]","seatsShowAttendees":false,"uid":"[redacted/dynamic]","videoCallData":"[redacted/dynamic]","appsStatus":"[redacted/dynamic]","eventTitle":"30 min","eventDescription":null,"price":0,"currency":"usd","length":30,"bookingId":"[redacted/dynamic]","metadata":{},"status":"ACCEPTED","additionalInformation":"[redacted/dynamic]"}}
\ No newline at end of file
diff --git a/packages/core/EventManager.ts b/packages/core/EventManager.ts
index 8479718d94d..2a9c15888b0 100644
--- a/packages/core/EventManager.ts
+++ b/packages/core/EventManager.ts
@@ -100,6 +100,8 @@ export default class EventManager {
*/
public async create(event: CalendarEvent): Promise<CreateUpdateResult> {
const evt = processLocation(event);
+ // Fallback to cal video if no location is set
+ if (!evt.location) evt["location"] = "integrations:daily";
const isDedicated = evt.location ? isDedicatedIntegration(evt.location) : null;
const results: Array<EventResult<Exclude<Event, AdditionalInformation>>> = [];
@@ -107,7 +109,7 @@ export default class EventManager {
if (isDedicated) {
const result = await this.createVideoEvent(evt);
- if (result.createdEvent) {
+ if (result?.createdEvent) {
evt.videoCallData = result.createdEvent;
evt.location = result.originalEvent.location;
result.type = result.createdEvent.type;
diff --git a/packages/core/videoClient.ts b/packages/core/videoClient.ts
index f9d1e3e88f7..96ac48280c0 100644
--- a/packages/core/videoClient.ts
+++ b/packages/core/videoClient.ts
@@ -47,6 +47,14 @@ const createMeeting = async (credential: CredentialWithAppName, calEvent: Calend
const [firstVideoAdapter] = videoAdapters;
let createdMeeting;
try {
+ if (!calEvent.location) {
+ const defaultMeeting = await createMeetingWithCalVideo(calEvent);
+ if (defaultMeeting) {
+ createdMeeting = defaultMeeting;
+ calEvent.location = "integrations:dailyvideo";
+ }
+ }
+
createdMeeting = await firstVideoAdapter?.createMeeting(calEvent);
if (!createdMeeting) {