cal.com
cal.com copied to clipboard
[CAL-1141] Add new events to webhook BOOKING_PAID, BOOKING_CONFIRMED, BOOKING_REJECTED
Add new events to webhook, namely:
- BOOKING_PAID | When a booking has been paid for successfully
- BOOKING_REQUESTED | When an opt-in booking is made (not yet confirmed)
- BOOKING_REJECTED | When an opt-in booking is REJECTED
From SyncLinear.com | CAL-1141
Currently, BOOKING_CREATED is triggered once a booking is confirmed. So this would be changed then, that it already triggers once a booking that requires confirmation is booked, right? Do we have any concerns here for already existing webhooks with BOOKING_CREATED triggers?
Yeah, that's a very good point. We should avoid changing BOOKING_CREATED and instead maybe use BOOKING_REQUESTED for the booking that isn't confirmed yet
I'm thinking about handling this one.
Do you have any guidance or a place where I can start?
Is this just adding to the enum?
@ologbonowiwi Thank you for looking into this π You do need to update the schema and add enum as @Josh-Archer mentioned, but that would only add it at the Database level.
enum WebhookTriggerEvents {
BOOKING_CREATED
BOOKING_RESCHEDULED
BOOKING_CANCELLED
FORM_SUBMITTED
MEETING_ENDED
BOOKING_PAID
BOOKING_REQUESTED
BOOKING_REJECTED
}
The next step would be to update the codebase to identify which hook should fire at what point. This would primarily be in the booking handler. Finally, these would need to be added to the webhook form to store them as webhook triggers.
Please pay close attention to the migration to make sure it doesn't destroy any existing webhooks π
All the best! π
I'm excited to help with the project and this issue seems perfect for me. I noticed that no one has claimed it yet. @alishaz-polymath Can I take this up and work on it over the weekend? I'll send you a PR as soon as possible.
I added the BOOKING_PAID webhook. Can you take a look @alishaz-polymath?
Thank you!
@alishaz-polymath I have added Booking Rejected webhook to the codebase. Let me know if this is what we are expecting. The issue is still under progress though. Moreover, I am hoping to add a test for the same with playwright as well. Let me know your thoughts on the same.
@alishaz-polymath @PeerRich I have a two questions,
-
Do we fire the Booking_Requested Webhook when a slot with event type, confirmation required, is created?
-
If the above it true, what will be the type of data sent in the webhook?
@alishaz-polymath @PeerRich I have a two questions,
* Do we fire the Booking_Requested Webhook when a **slot** with event type, confirmation required, is created?
YES π
* If the above it true, what will be the type of data sent in the webhook?
Essentially the same payload as confirmation, except with the booking status being PENDING
~~@alishaz-polymath I guess we can use sendGenericWebhookPayload for BOOKING_REQUESTED webhook then. https://github.com/calcom/cal.com/blob/94917dbb1ec002f49c9dd2cfed3eeadb323279dd/packages/features/webhooks/lib/sendPayload.ts#L128~~
Hi @alishaz-polymath , I noticed that @ologbonowiwi has implemented the BOOKING_PAID EventTrigger in the source code. I have also added the BOOKING_REQUESTED and BOOKING_REJECTED events in the handlers. I have created a PR for this and I would appreciate your feedback on my code. Please let me know if there are any issues that need to be fixed. Thank you
Hey @shivamklr Thanks a lot for your PR. I'm currently OOO but I'll review it as soon as I can. I'm also certain one of the team members would probably review it very soon. π