add meeting url to dynamic text variables of custom workflow templates (#5958)
* small design fix for time unit select * save video cal url to booking in metaData * save video url when bookings are confirmed * fix e2e tests * remove not needed waitForNavigation * add metadata to booking created webhook payload * add migration * fix type error * add meeting url variable to dropdown * add meeting url to custom template * add BookingMetaDataSchema * add meeting url to email reminder * add meeting url to sms notifcation * adjust e2e tests * add bookingMetadataSchema * add missing change from merge * fix spelling * fix type error * code clean up * fix e2e snapshot Co-authored-by: CarinaWolli <[email protected]>
This commit is contained in:
1 parent
a8b4198bf7
commit
ca045a040b
9 files changed
+19
-4
No files matched your search
@@ -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 || "",
|
||||
|
||||
@@ -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 || "",
|
||||
|
||||
@@ -16,6 +16,7 @@ const variables = [
|
||||
"attendee_name",
|
||||
"attendee_email",
|
||||
"additional_notes",
|
||||
"meeting_url",
|
||||
];
|
||||
|
||||
export const AddVariablesDropdown = (props: IAddVariablesDropdown) => {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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("}", "");
|
||||
|
||||
Reference in new issue
Block a user