[CAL-3740] PATCH Bookings API Calls Don't Trigger "Rescheduled" Emails or "BOOKING_RESCHEDULED" Webhook Events
Issue Summary
I'm using the Hosted API to reschedule bookings with PATCH Bookings.
When I perform this operation, I can successfully change the Start and End Times of the appointment, verified both in the API response and checking the booking in our cal.com dashboard.
However the "Rescheduled" confirmation email does not get sent, nor does the BOOKING_RESCHEDULED Webhook Event. This is an issue because the attendees original calendar event will remain unchanged and will not update with the new Start and End Times.
This seems to be an issue with this particular endpoint/operation. Because I can use POST/bookings and DELETE/bookings and those operations will properly trigger both the corresponding email and webhook events.
Additionally, rescheduling a booking from the UI will properly trigger the Rescheduled Email and BOOKING_RESCHEDULED Webhook Event.
Steps to Reproduce
- Create a new booking (either via the API or through the UI)
- Call PATCH for that booking and set a new startTime and endTime in the body
- Verify that the API response is successful
- Check the booking on the cal.com dashboard and see that the booking has the new start and end times
- Check your email and see that the Rescheduled Email was not sent
- Check your webhook destination and see that a BOOKING_RESCHEDULED was not received
Actual Results
- The PATCH API Call is successful (as shown by the response and verifying the corresponding booking in the UI) -The Rescheduled Email was not sent to the host nor attendee
- A BOOKING_RESCHEDULED was not received
Expected Results
- BOOKING_RESCHEDULED Webhook event is sent. "Rescheduled" email with the attached ics is sent to host and attendee (see example below):
-BOOKING_RESCHEDULED webhook event is sent
Hey @henrym9345, great to see you back! Hope all's been well since our last chat.
It appears that the issue you're encountering with the "Rescheduled" emails not being sent and the "BOOKING_RESCHEDULED" webhook events not being triggered when using the PATCH operation to reschedule bookings through the Cal.com API is due to the absence of explicit handling for these functionalities in the provided code path. Specifically, while there is an attempt to send a rescheduling email via the sendRequestRescheduleEmail function, there's no implementation for triggering "BOOKING_RESCHEDULED" webhook events within the PATCH operation's code.
If the rescheduled emails are not being received, it could be related to an error within the sendRequestRescheduleEmail function. This would require a closer look into the function's implementation or any logged errors that occur during its execution.
Additionally, I found references to similar issues in the Cal.com repository, but none provide a direct solution to the problem you're facing. This suggests that the functionality to trigger "BOOKING_RESCHEDULED" webhook events might not be implemented in the current codebase for the PATCH operation.
For resolving this issue, it might be necessary to review the implementation of the sendRequestRescheduleEmail function for potential errors and consider adding explicit logic for triggering "BOOKING_RESCHEDULED" webhook events during the rescheduling process.
Sources
- [CAL-1215] no email sent for reschedule
- [CAL-180] Booking Reschedule not working.
- [CAL-219] Reschedule emails are not sent
- packages/app-store/vital/lib/reschedule.ts
- packages/app-store/wipemycalother/lib/reschedule.ts
- apps/api/v1/pages/api/bookings/[id]/_patch.ts
- packages/trpc/server/routers/viewer/bookings/requestReschedule.handler.ts
- packages/emails/email-manager.ts
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.