diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index b224a4618e..6d6cfdd14d 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -1215,7 +1215,7 @@ "event_time_info": "The event start time", "location_info": "The event location", "organizer_name_info": "Your name", - "additional_notes_info": "The Additional notes of booking", + "additional_notes_info": "The additional notes of booking", "attendee_name_info": "The person booking's name", "to": "To", "workflow_turned_on_successfully": "{{workflowName}} workflow turned {{offOn}} successfully", @@ -1441,6 +1441,8 @@ "enter_option": "Enter Option {{index}}", "add_an_option": "Add an option", "radio": "Radio", + "meeting_url_workflow": "Meeting url", + "meeting_url_info": "The event meeting conference url", "date_overrides": "Date overrides", "date_overrides_subtitle": "Add dates when your availability changes from your daily hours.", "date_overrides_info": "Date overrides are archived automatically after the date has passed", diff --git a/packages/features/bookings/lib/handleNewBooking.ts b/packages/features/bookings/lib/handleNewBooking.ts index 763e041f92..fbec0b59c0 100644 --- a/packages/features/bookings/lib/handleNewBooking.ts +++ b/packages/features/bookings/lib/handleNewBooking.ts @@ -1066,7 +1066,7 @@ async function handler(req: NextApiRequest & { userId?: number | undefined }) { await scheduleWorkflowReminders( eventType.workflows, reqBody.smsReminderNumber as string | null, - evt, + { ...evt, ...{ metadata } }, evt.requiresConfirmation || false, rescheduleUid ? true : false, true diff --git a/packages/features/ee/workflows/api/scheduleEmailReminders.ts b/packages/features/ee/workflows/api/scheduleEmailReminders.ts index 3bce1c061b..e0ee21024d 100644 --- a/packages/features/ee/workflows/api/scheduleEmailReminders.ts +++ b/packages/features/ee/workflows/api/scheduleEmailReminders.ts @@ -7,6 +7,7 @@ import type { NextApiRequest, NextApiResponse } from "next"; import dayjs from "@calcom/dayjs"; import { defaultHandler } from "@calcom/lib/server"; import prisma from "@calcom/prisma"; +import { bookingMetadataSchema } from "@calcom/prisma/zod-utils"; import customTemplate, { VariablesType } from "../lib/reminders/templates/customTemplate"; import emailReminderTemplate from "../lib/reminders/templates/emailReminderTemplate"; @@ -125,6 +126,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { location: reminder.booking?.location || "", additionalNotes: reminder.booking?.description, customInputs: reminder.booking?.customInputs, + meetingUrl: bookingMetadataSchema.parse(reminder.booking?.metadata || {})?.videoCallUrl, }; const emailSubject = await customTemplate( reminder.workflowStep.emailSubject || "", diff --git a/packages/features/ee/workflows/api/scheduleSMSReminders.ts b/packages/features/ee/workflows/api/scheduleSMSReminders.ts index ac61ba7a90..0b31d01946 100644 --- a/packages/features/ee/workflows/api/scheduleSMSReminders.ts +++ b/packages/features/ee/workflows/api/scheduleSMSReminders.ts @@ -5,6 +5,7 @@ import type { NextApiRequest, NextApiResponse } from "next"; import dayjs from "@calcom/dayjs"; import { defaultHandler } from "@calcom/lib/server"; import prisma from "@calcom/prisma"; +import { bookingMetadataSchema } from "@calcom/prisma/zod-utils"; import { getSenderId } from "../lib/alphanumericSenderIdSupport"; import * as twilio from "../lib/reminders/smsProviders/twilioProvider"; @@ -98,6 +99,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { location: reminder.booking?.location || "", additionalNotes: reminder.booking?.description, customInputs: reminder.booking?.customInputs, + meetingUrl: bookingMetadataSchema.parse(reminder.booking?.metadata || {})?.videoCallUrl, }; const customMessage = await customTemplate( reminder.workflowStep.reminderBody || "", diff --git a/packages/features/ee/workflows/components/AddVariablesDropdown.tsx b/packages/features/ee/workflows/components/AddVariablesDropdown.tsx index f02c4cf270..0e27c1c382 100644 --- a/packages/features/ee/workflows/components/AddVariablesDropdown.tsx +++ b/packages/features/ee/workflows/components/AddVariablesDropdown.tsx @@ -16,6 +16,7 @@ const variables = [ "attendee_name", "attendee_email", "additional_notes", + "meeting_url", ]; export const AddVariablesDropdown = (props: IAddVariablesDropdown) => { diff --git a/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts b/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts index 088a733b44..09282e8d7f 100644 --- a/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts +++ b/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts @@ -10,6 +10,7 @@ import sgMail from "@sendgrid/mail"; import dayjs from "@calcom/dayjs"; import prisma from "@calcom/prisma"; +import { bookingMetadataSchema } from "@calcom/prisma/zod-utils"; import { BookingInfo, timeUnitLowerCase } from "./smsReminderManager"; import customTemplate, { VariablesType } from "./templates/customTemplate"; @@ -103,6 +104,7 @@ export const scheduleEmailReminder = async ( location: evt.location, additionalNotes: evt.additionalNotes, customInputs: evt.customInputs, + meetingUrl: bookingMetadataSchema.parse(evt.metadata || {})?.videoCallUrl, }; const emailSubjectTemplate = await customTemplate( diff --git a/packages/features/ee/workflows/lib/reminders/reminderScheduler.ts b/packages/features/ee/workflows/lib/reminders/reminderScheduler.ts index 1b5b1d46a4..fde9158da3 100644 --- a/packages/features/ee/workflows/lib/reminders/reminderScheduler.ts +++ b/packages/features/ee/workflows/lib/reminders/reminderScheduler.ts @@ -19,7 +19,7 @@ export const scheduleWorkflowReminders = async ( }; })[], smsReminderNumber: string | null, - evt: CalendarEvent, + evt: CalendarEvent & { metadata?: { videoCallUrl: string } }, needsConfirmation: boolean, isRescheduleEvent: boolean, isFirstRecurringEvent: boolean @@ -70,6 +70,7 @@ export const scheduleWorkflowReminders = async ( sendTo = evt.attendees[0].email; break; } + scheduleEmailReminder( evt, workflow.trigger, diff --git a/packages/features/ee/workflows/lib/reminders/smsReminderManager.ts b/packages/features/ee/workflows/lib/reminders/smsReminderManager.ts index 611d70782b..52911616a9 100644 --- a/packages/features/ee/workflows/lib/reminders/smsReminderManager.ts +++ b/packages/features/ee/workflows/lib/reminders/smsReminderManager.ts @@ -9,6 +9,7 @@ import { import dayjs from "@calcom/dayjs"; import prisma from "@calcom/prisma"; import { Prisma } from "@calcom/prisma/client"; +import { bookingMetadataSchema } from "@calcom/prisma/zod-utils"; import { getSenderId } from "../alphanumericSenderIdSupport"; import * as twilio from "./smsProviders/twilioProvider"; @@ -36,6 +37,7 @@ export type BookingInfo = { location?: string | null; additionalNotes?: string | null; customInputs?: Prisma.JsonValue; + metadata?: Prisma.JsonValue; }; export const scheduleSMSReminder = async ( @@ -101,6 +103,7 @@ export const scheduleSMSReminder = async ( location: evt.location, additionalNotes: evt.additionalNotes, customInputs: evt.customInputs, + meetingUrl: bookingMetadataSchema.parse(evt.metadata || {})?.videoCallUrl, }; const customMessage = await customTemplate(message, variables, evt.organizer.language.locale); message = customMessage.text; diff --git a/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts b/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts index a570f908a2..3ee20405ed 100644 --- a/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts +++ b/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts @@ -13,6 +13,7 @@ export type VariablesType = { location?: string | null; additionalNotes?: string | null; customInputs?: Prisma.JsonValue; + meetingUrl?: string; }; const customTemplate = async (text: string, variables: VariablesType, locale: string) => { @@ -33,7 +34,8 @@ const customTemplate = async (text: string, variables: VariablesType, locale: st .replaceAll("{EVENT_TIME}", timeWithTimeZone) .replaceAll("{LOCATION}", locationString) .replaceAll("{ADDITIONAL_NOTES}", variables.additionalNotes || "") - .replaceAll("{ATTENDEE_EMAIL}", variables.attendeeEmail || ""); + .replaceAll("{ATTENDEE_EMAIL}", variables.attendeeEmail || "") + .replaceAll("{MEETING_URL}", variables.meetingUrl || ""); const customInputvariables = dynamicText.match(/\{(.+?)}/g)?.map((variable) => { return variable.replace("{", "").replace("}", "");