Skip to content

Scheduling infrastructure for absolutely everyone.

fix: SMS reminders are being sent out with an HTML code (#16966)

Anik Dhabal Babu8aee8d9d3b98
diff --git a/packages/features/ee/workflows/components/WorkflowStepContainer.tsx b/packages/features/ee/workflows/components/WorkflowStepContainer.tsx
index 6da41d15206..4744d946dd1 100644
--- a/packages/features/ee/workflows/components/WorkflowStepContainer.tsx
+++ b/packages/features/ee/workflows/components/WorkflowStepContainer.tsx
@@ -10,6 +10,7 @@ import { SENDER_ID, SENDER_NAME } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { HttpError } from "@calcom/lib/http-error";
import { getTimeFormatStringFromUserTimeFormat } from "@calcom/lib/timeFormat";
+import turndown from "@calcom/lib/turndownService";
import { TimeUnit, WorkflowActions, WorkflowTemplates, WorkflowTriggerEvents } from "@calcom/prisma/enums";
import type { RouterOutputs } from "@calcom/trpc/react";
import { trpc } from "@calcom/trpc/react";
@@ -913,22 +914,22 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {
return props.form.getValues(`steps.${step.stepNumber - 1}.reminderBody`) || "";
}}
setText={(text: string) => {
- props.form.setValue(`steps.${step.stepNumber - 1}.reminderBody`, text);
+ if (isSMSOrWhatsappAction(step.action)) {
+ props.form.setValue(`steps.${step.stepNumber - 1}.reminderBody`, turndown(text));
+ } else {
+ props.form.setValue(`steps.${step.stepNumber - 1}.reminderBody`, text);
+ }
props.form.clearErrors();
}}
variables={DYNAMIC_TEXT_VARIABLES}
- addVariableButtonTop={
- step.action === WorkflowActions.SMS_ATTENDEE || step.action === WorkflowActions.SMS_NUMBER
- }
+ addVariableButtonTop={isSMSAction(step.action)}
height="200px"
updateTemplate={updateTemplate}
firstRender={firstRender}
setFirstRender={setFirstRender}
editable={!props.readOnly && !isWhatsappAction(step.action)}
excludedToolbarItems={
- step.action !== WorkflowActions.SMS_ATTENDEE && step.action !== WorkflowActions.SMS_NUMBER
- ? []
- : ["blockType", "bold", "italic", "link"]
+ !isSMSAction(step.action) ? [] : ["blockType", "bold", "italic", "link"]
}
/>
diff --git a/packages/lib/turndownService.ts b/packages/lib/turndownService.ts
index f80bea7618d..f97f60a37b8 100644
--- a/packages/lib/turndownService.ts
+++ b/packages/lib/turndownService.ts
@@ -5,6 +5,7 @@ const turndownService = new TurndownService();
function turndown(html: string | TurndownService.Node): string {
let result = turndownService.turndown(html);
result = result.replaceAll("[<p><br></p>]", "");
+ result = result.replace(/\\_/g, "_");
if (result === "<p><br></p>") {
result = "";