Skip to content

Scheduling infrastructure for absolutely everyone.

call webhook before sending booking response

Syed Ali Shahbaz470c43befe7f
diff --git a/pages/api/bookings/index.ts b/pages/api/bookings/index.ts
index fc0030b6510..b99b3510d5f 100644
--- a/pages/api/bookings/index.ts
+++ b/pages/api/bookings/index.ts
@@ -88,7 +88,6 @@ async function createOrlistAllBookings(
const booking = schemaBookingReadPublic.parse(data);
if (booking) {
- res.status(201).json({ booking, message: "Booking created successfully" });
// Create Calendar Event for webhook payload
const eventType = await prisma.eventType
.findUnique({ where: { id: booking.eventTypeId as number } })
@@ -139,6 +138,9 @@ async function createOrlistAllBookings(
})
);
await Promise.all(promises);
+
+ res.status(201).json({ booking, message: "Booking created successfully" });
+
} else
(error: Error) => {
console.log(error);