diff --git a/packages/features/bookings/lib/handleCancelBooking.ts b/packages/features/bookings/lib/handleCancelBooking.ts index f8273dcc44..f8182ed25c 100644 --- a/packages/features/bookings/lib/handleCancelBooking.ts +++ b/packages/features/bookings/lib/handleCancelBooking.ts @@ -178,6 +178,7 @@ async function handler(req: NextApiRequest & { userId?: number }) { ...evt, ...eventTypeInfo, status: "CANCELLED", + smsReminderNumber: bookingToDelete.smsReminderNumber || undefined, }).catch((e) => { console.error(`Error executing webhook for event: ${eventTrigger}, URL: ${webhook.subscriberUrl}`, e); }) diff --git a/packages/features/bookings/lib/handleNewBooking.ts b/packages/features/bookings/lib/handleNewBooking.ts index 703bbfedfb..0d7032f306 100644 --- a/packages/features/bookings/lib/handleNewBooking.ts +++ b/packages/features/bookings/lib/handleNewBooking.ts @@ -984,6 +984,7 @@ async function handler(req: NextApiRequest & { userId?: number | undefined }) { metadata: reqBody.metadata, eventTypeId, status: "ACCEPTED", + smsReminderNumber: booking?.smsReminderNumber || undefined, }).catch((e) => { console.error(`Error executing webhook for event: ${eventTrigger}, URL: ${sub.subscriberUrl}`, e); }) diff --git a/packages/features/webhooks/lib/sendPayload.tsx b/packages/features/webhooks/lib/sendPayload.tsx index 8da4ac56bb..b29914ff87 100644 --- a/packages/features/webhooks/lib/sendPayload.tsx +++ b/packages/features/webhooks/lib/sendPayload.tsx @@ -85,6 +85,7 @@ const sendPayload = async ( rescheduleUid?: string; bookingId?: number; status?: string; + smsReminderNumber?: string; } ) => { const { appId, payloadTemplate: template } = webhook; diff --git a/packages/trpc/server/routers/viewer/bookings.tsx b/packages/trpc/server/routers/viewer/bookings.tsx index 3a4457a62e..813a4db28e 100644 --- a/packages/trpc/server/routers/viewer/bookings.tsx +++ b/packages/trpc/server/routers/viewer/bookings.tsx @@ -356,6 +356,7 @@ export const bookingsRouter = router({ dynamicEventSlugRef: true, dynamicGroupSlugRef: true, destinationCalendar: true, + smsReminderNumber: true, }, where: { uid: bookingId, @@ -528,7 +529,10 @@ export const bookingsRouter = router({ }; const webhooks = await getWebhooks(subscriberOptions); const promises = webhooks.map((webhook) => - sendPayload(webhook.secret, eventTrigger, new Date().toISOString(), webhook, evt).catch((e) => { + sendPayload(webhook.secret, eventTrigger, new Date().toISOString(), webhook, { + ...evt, + smsReminderNumber: bookingToReschedule.smsReminderNumber || undefined, + }).catch((e) => { console.error( `Error executing webhook for event: ${eventTrigger}, URL: ${webhook.subscriberUrl}`, e @@ -982,6 +986,7 @@ export const bookingsRouter = router({ bookingId, eventTypeId: booking.eventType?.id, status: "ACCEPTED", + smsReminderNumber: booking.smsReminderNumber || undefined, }).catch((e) => { console.error( `Error executing webhook for event: ${WebhookTriggerEvents.BOOKING_CREATED}, URL: ${sub.subscriberUrl}`,