Fixes SMS not sending for country codes not supporting alphanumeric sender IDs (#5969)
* don't use alphanumeric sender ID for not support country codes * fix import * rename file * fix spelling mistakes * add twilio phone number to .env file * add SENDER_ID to env variable and create function to get sender id * add NEXT_PUBLIC_SENDER_ID env variable * remove not needed Cal fallback * fix readme * code clean up * code clean up Co-authored-by: CarinaWolli <[email protected]>
This commit is contained in:
1 parent
56c07ec351
commit
c1bbb9b139
13 files changed
+133
-32
No files matched your search
@@ -6,6 +6,7 @@ import dayjs from "@calcom/dayjs";
|
||||
import { defaultHandler } from "@calcom/lib/server";
|
||||
import prisma from "@calcom/prisma";
|
||||
|
||||
import { getSenderId } from "../lib/alphanumericSenderIdSupport";
|
||||
import * as twilio from "../lib/reminders/smsProviders/twilioProvider";
|
||||
import customTemplate, { VariablesType } from "../lib/reminders/templates/customTemplate";
|
||||
import smsReminderTemplate from "../lib/reminders/templates/smsReminderTemplate";
|
||||
@@ -72,6 +73,8 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
? reminder.booking?.attendees[0].timeZone
|
||||
: reminder.booking?.user?.timeZone;
|
||||
|
||||
const senderID = getSenderId(sendTo, reminder.workflowStep.sender);
|
||||
|
||||
let message: string | null = reminder.workflowStep.reminderBody;
|
||||
switch (reminder.workflowStep.template) {
|
||||
case WorkflowTemplates.REMINDER:
|
||||
@@ -105,12 +108,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
break;
|
||||
}
|
||||
if (message?.length && message?.length > 0 && sendTo) {
|
||||
const scheduledSMS = await twilio.scheduleSMS(
|
||||
sendTo,
|
||||
message,
|
||||
reminder.scheduledDate,
|
||||
reminder.workflowStep.sender || "Cal"
|
||||
);
|
||||
const scheduledSMS = await twilio.scheduleSMS(sendTo, message, reminder.scheduledDate, senderID);
|
||||
|
||||
await prisma.workflowReminder.update({
|
||||
where: {
|
||||
|
||||
Reference in new issue
Block a user