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 <wollencarina@gmail.com>pull/6089/head
parent
a8b4198bf7
commit
ca045a040b
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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("}", "");
|
||||
|
|
Loading…
Reference in New Issue