Open thomaspoe opened 5 months ago
Hello @thomaspoe! I'm here to help you with any bugs, questions, or contributions. Let's work together to solve this issue.
The issue you're experiencing is due to the difference in how the booking acceptance process is handled between the manual acceptance through the 'Bookings' tab and the PATCH request via your custom backend.
When you manually accept a booking through the 'Bookings' tab, the handleConfirmation
function is triggered. This function includes comprehensive logic for sending emails, scheduling reminders, and integrating video call details like Zoom. However, the PATCH request handler (patchHandler
) you are using does not include this logic; it only updates the booking status in the database.
Here is the relevant part of the patchHandler
code:
export async function patchHandler(req: NextApiRequest) {
const { query, body } = req;
const { id } = schemaQueryIdParseInt.parse(query);
const data = schemaBookingEditBodyParams.parse(body);
await checkPermissions(req, data);
const booking = await prisma.booking.update({ where: { id }, data });
return { booking: schemaBookingReadPublic.parse(booking) };
}
This function updates the booking status but does not handle sending emails or adding Zoom details.
To achieve the same result as the manual acceptance, you need to trigger the handleConfirmation
function after updating the booking status via the PATCH request. Alternatively, you can configure a webhook to trigger on booking acceptance events to handle the sending of emails and integration of Zoom details. The WebhookTriggerEvents
enum includes several events that can be used for this purpose, such as BOOKING_RESCHEDULED
, BOOKING_CREATED
, and INSTANT_MEETING
[1][2][3].
By implementing one of these solutions, you can ensure that the booking acceptance process via your custom backend includes all necessary steps, such as sending confirmation emails and integrating Zoom details.
To continue talking to Dosu, mention @dosu.
Also worth noting, this is not self hosted, this is using cal.com embeds & API. I am sure there might be other things happening when accepting via the cal.com dashboard like dosubot mentions, but there is currently no documented way to have the same flow happen via the API. I have also reviewed some of the code base & based on what I can tell, the code mentioned above by dosubot is supposed to already happen when a PATCH request is made regardless, but that doesn't seem to be happening though I could be wrong.
where is the custom backend file ? @thomaspoe
Hello @thomaspoe! I'm here to help you with any bugs, questions, or contributions. Let's work together to solve this issue.
The issue you're experiencing is due to the difference in how the booking acceptance process is handled between the manual acceptance through the 'Bookings' tab and the PATCH request via your custom backend.
When you manually accept a booking through the 'Bookings' tab, the
handleConfirmation
function is triggered. This function includes comprehensive logic for sending emails, scheduling reminders, and integrating video call details like Zoom. However, the PATCH request handler (patchHandler
) you are using does not include this logic; it only updates the booking status in the database.Here is the relevant part of the
patchHandler
code:export async function patchHandler(req: NextApiRequest) { const { query, body } = req; const { id } = schemaQueryIdParseInt.parse(query); const data = schemaBookingEditBodyParams.parse(body); await checkPermissions(req, data); const booking = await prisma.booking.update({ where: { id }, data }); return { booking: schemaBookingReadPublic.parse(booking) }; }
This function updates the booking status but does not handle sending emails or adding Zoom details.
To achieve the same result as the manual acceptance, you need to trigger the
handleConfirmation
function after updating the booking status via the PATCH request. Alternatively, you can configure a webhook to trigger on booking acceptance events to handle the sending of emails and integration of Zoom details. TheWebhookTriggerEvents
enum includes several events that can be used for this purpose, such asBOOKING_RESCHEDULED
,BOOKING_CREATED
, andINSTANT_MEETING
[1][2][3].By implementing one of these solutions, you can ensure that the booking acceptance process via your custom backend includes all necessary steps, such as sending confirmation emails and integrating Zoom details.
To continue talking to Dosu, mention @dosu.
hey is this really a high priority issue ? then assign me and tel me where is this custom backend
@keithwillcode Is anyone working on v2 endpoint for updating a booking? I don't see any endpoint for that. If someone's working, then i think this issue will be closed once implemented, if not i would love to work on it. Or do you want me to update the v1 endpoint to work as how its working in platform app?
hey @asadath1395, for v2 endpoints we want to have a more granular approach to manipulating booking data, through action endpoints, similar to /cancel, /confirm, etc... these endpoints will make sure to update the data and trigger the relevant side effects depending on the actions
Issue Summary
Hello everyone,
I am currently building a backend that will accept or deny bookings based on credits on a user account elsewhere. Currently, I have the cal.com embed on the dashboard & that works perfectly. There is some weird behavior depending on how the booking is accepted. If I go on cal.com & sign in to manually accept through the 'Bookings' tab, it seems to work perfectly - the booking is confirmed & accepted, the confirmation is sent via email INCLUDING THE ZOOM DETAILS.
The problem arises when I try to confirm bookings via my custom backend. In the docs, it says I can make a PATCH request & pass 'ACCEPTED' as the status. When I do that, it does accept the booking & but doesn't send an email or show zoom details in the cal.com dashboard.
Am I doing something wrong or is this a bug?
Steps to Reproduce
Actual Results
Expected Results
Technical details
Here is my early implementation:
Evidence
The one with the zoom details was manually accepted in the dashboard, the one without was accepted via the implementation above.