Prompt
How do I delete calendar events when a booking is canceled?
Latest observation
Oct 15, 2026
OpenAI APIWeb search: off
To delete calendar events when a booking is canceled, the exact steps depend on which booking system and calendar integration you’re using. In general, you want to:
-
Detect the cancellation
- Use a webhook or cancellation event from your booking system.
- Example event names:
booking.canceled,appointment.deleted,reservation.cancelled.
-
Find the calendar event ID
- When you originally created the calendar event, store the returned calendar event ID alongside the booking ID in your database.
- This is important because you need that ID to delete the event later.
-
Call the calendar API to delete the event
- For example:
- Google Calendar:
events.delete - Microsoft Outlook / Graph: delete the event resource
- Apple Calendar: usually via CalDAV or by removing it from your app’s sync state
- Google Calendar:
- For example:
-
Handle the response
- If deletion succeeds, mark the booking as canceled and the calendar event as removed.
- If it fails, retry or queue it for later.
Example flow
- Booking created → create calendar event → save
booking_id+calendar_event_id - Booking canceled → receive webhook → look up
calendar_event_id→ delete event from calendar
Google Calendar example
You’d delete like this:
DELETE https://www.googleapis.com/calendar/v3/calendars/{calendarId}/events/{eventId}
Best practices
- Store the event ID immediately after creating the calendar event.
- Make cancellation idempotent so repeated cancellation events don’t cause errors.
- Log failures and retry deletion if the calendar API is temporarily unavailable.
- If you sync across multiple calendars, delete or mark canceled in all relevant calendars.
If you tell me what booking platform and calendar service you’re using, I can give you the exact API call or code example.