Skip to content

Scheduling infrastructure for absolutely everyone.

Fixes additional inputs as variables in custom workflow templates (#7840)

Carina Wollendorfer0bae688da107
diff --git a/packages/features/bookings/lib/handleNewBooking.ts b/packages/features/bookings/lib/handleNewBooking.ts
index 2e5744dcb62..c560bdb524e 100644
--- a/packages/features/bookings/lib/handleNewBooking.ts
+++ b/packages/features/bookings/lib/handleNewBooking.ts
@@ -1948,7 +1948,7 @@ async function handler(
await scheduleWorkflowReminders(
eventType.workflows,
smsReminderNumber || null,
- { ...evt, ...{ metadata } },
+ { ...evt, responses, ...{ 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 5480e11eee1..38062d690bb 100644
--- a/packages/features/ee/workflows/api/scheduleEmailReminders.ts
+++ b/packages/features/ee/workflows/api/scheduleEmailReminders.ts
@@ -172,7 +172,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
timeZone: timeZone,
location: reminder.booking.location || "",
additionalNotes: reminder.booking.description,
- customInputs: reminder.booking.customInputs,
+ responses: reminder.booking.responses,
meetingUrl: bookingMetadataSchema.parse(reminder.booking.metadata || {})?.videoCallUrl,
};
const emailSubject = await customTemplate(
diff --git a/packages/features/ee/workflows/api/scheduleSMSReminders.ts b/packages/features/ee/workflows/api/scheduleSMSReminders.ts
index ce4f84e630b..3d1d0a5b07c 100644
--- a/packages/features/ee/workflows/api/scheduleSMSReminders.ts
+++ b/packages/features/ee/workflows/api/scheduleSMSReminders.ts
@@ -108,7 +108,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
timeZone: timeZone,
location: reminder.booking?.location || "",
additionalNotes: reminder.booking?.description,
- customInputs: reminder.booking?.customInputs,
+ responses: reminder.booking?.responses,
meetingUrl: bookingMetadataSchema.parse(reminder.booking?.metadata || {})?.videoCallUrl,
};
const customMessage = await customTemplate(
diff --git a/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts b/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts
index 384b1b3715e..92974d5fb70 100644
--- a/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts
+++ b/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts
@@ -100,7 +100,7 @@ export const scheduleEmailReminder = async (
timeZone: timeZone,
location: evt.location,
additionalNotes: evt.additionalNotes,
- customInputs: evt.customInputs,
+ responses: evt.responses,
meetingUrl: bookingMetadataSchema.parse(evt.metadata || {})?.videoCallUrl,
};
diff --git a/packages/features/ee/workflows/lib/reminders/smsReminderManager.ts b/packages/features/ee/workflows/lib/reminders/smsReminderManager.ts
index 6912f657d82..a6a326ec416 100644
--- a/packages/features/ee/workflows/lib/reminders/smsReminderManager.ts
+++ b/packages/features/ee/workflows/lib/reminders/smsReminderManager.ts
@@ -32,7 +32,7 @@ export type BookingInfo = {
title: string;
location?: string | null;
additionalNotes?: string | null;
- customInputs?: Prisma.JsonValue;
+ responses?: Prisma.JsonValue;
metadata?: Prisma.JsonValue;
};
@@ -107,7 +107,7 @@ export const scheduleSMSReminder = async (
timeZone: timeZone,
location: evt.location,
additionalNotes: evt.additionalNotes,
- customInputs: evt.customInputs,
+ responses: evt.responses,
meetingUrl: bookingMetadataSchema.parse(evt.metadata || {})?.videoCallUrl,
};
const customMessage = await customTemplate(message, variables, locale);
diff --git a/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts b/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts
index ec86a84ae73..4b6de8bd676 100644
--- a/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts
+++ b/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts
@@ -1,6 +1,6 @@
import { guessEventLocationType } from "@calcom/app-store/locations";
-import { Dayjs } from "@calcom/dayjs";
-import { Prisma } from "@calcom/prisma/client";
+import type { Dayjs } from "@calcom/dayjs";
+import type { Prisma } from "@calcom/prisma/client";
export type VariablesType = {
eventName?: string;
@@ -12,7 +12,7 @@ export type VariablesType = {
timeZone?: string;
location?: string | null;
additionalNotes?: string | null;
- customInputs?: Prisma.JsonValue;
+ responses?: Prisma.JsonValue;
meetingUrl?: string;
};
@@ -49,17 +49,17 @@ const customTemplate = async (text: string, variables: VariablesType, locale: st
});
customInputvariables?.forEach((variable) => {
- if (variables.customInputs) {
- Object.keys(variables.customInputs).forEach((customInput) => {
+ if (variables.responses) {
+ Object.keys(variables.responses).forEach((customInput) => {
const formatedToVariable = customInput
.replace(/[^a-zA-Z0-9 ]/g, "")
.trim()
.replaceAll(" ", "_")
.toUpperCase();
- if (variable === formatedToVariable && variables.customInputs) {
+ if (variable === formatedToVariable && variables.responses) {
dynamicText = dynamicText.replace(
`{${variable}}`,
- variables.customInputs[customInput as keyof typeof variables.customInputs]
+ variables.responses[customInput as keyof typeof variables.responses]
);
}
});