Online bookings and calendars: how to prevent double bookings

A double booking happens when the booking form on your website does not know, at the right moment, that a staff member, room or piece of equipment is already busy in another calendar. The reliable fix is not more manual copying of appointments but a two-way booking calendar sync via API: read availability from Google or Outlook calendars before showing free slots, check it again just before confirmation, write the confirmed booking back and keep pulling changes made in the calendar. This article gives a practical example, implementation steps, trade-offs and a checklist.

Why double bookings happen

Most problems are not caused by customers but by the business having two or more sources of truth. The booking system knows its own bookings, but it does not know about the meeting, holiday or private appointment a staff member added directly to their calendar.

  • One-way copy: the website writes bookings into the calendar but never reads availability back.
  • Calendar subscription via an ICS link: data is refreshed according to how often the other application reads it, not at the moment of booking.
  • Race condition: two customers click the same free slot at the same moment and a system without a lock confirms both.
  • Unclear states: an event marked as “free time” or a tentative invitation is counted as busy one time and as free the next.

Example: a service company with three technicians

Illustrative example, not a real client: a service company accepts inspection bookings through its website. Two technicians use Google Calendar in Google Workspace, the third works in Outlook with Microsoft 365. Until now, bookings arrived by e-mail and a dispatcher copied them into the calendars. When a technician added a supplier visit to his calendar in the morning, the website did not know and offered the same time to a customer in the evening.

After the change, the website requests the availability of all three technicians when a day is selected, shows only slots where at least one of them is free and briefly holds the slot when the form is submitted. Only after a fresh availability check does it confirm the booking, write the event into the right technician’s calendar and store its identifier. When the technician moves or deletes the event, the system picks up the change and the dispatcher gets a task to contact the customer.

Three ways to connect bookings and calendars

Method How it works When it is enough Main risk
Calendar subscription via ICS link Another application periodically reads a published file of events Read-only display of appointments, for example an internal overview Delay and no check at the moment of booking
One-way write from the website to the calendar An event is created in the calendar after a booking The calendar is used only by the booking system The website cannot see appointments entered manually in the calendar
Two-way synchronisation via API The website reads availability, writes bookings and tracks changes Staff also schedule outside the booking system More demanding development, permissions and monitoring

If staff also put other commitments into their calendars, the third method is in practice the only reliable choice.

Step-by-step implementation

1. Define the source of truth and availability rules

Decide what is binding: working hours and service types in the booking system, actual availability in the calendar. Also write down rules such as service duration, buffer between appointments, travel time or the minimum notice before a booking.

2. Set up least-privilege access

You do not need event content to read availability. The Google Calendar API has a separate calendar.freebusy scope for availability queries (Google: Freebusy query). For the getSchedule method, Microsoft Graph lists Calendars.ReadBasic as the least privileged permission and supports work or school accounts, not personal Microsoft accounts (Microsoft Graph: getSchedule). Writing bookings requires broader permission, so limit it to the calendars that are actually bookable.

3. Read availability, not full events

For each calendar, Google returns a list of busy intervals within the period from timeMin to timeMax. One query can return availability for at most 50 calendars, and a group can expand to at most 100 calendar identifiers. The response can contain an error for an individual calendar, such as notFound or internalError, and Google warns that more error types may be added (source). Microsoft Graph returns availability for users, distribution lists and resources such as rooms and equipment, and the time slot of the availability view can be 5 to 1,440 minutes, 30 by default. If the result contains more than 1,000 entries, the service returns an error (source).

Recommendation: if any calendar returns an error, do not show that staff member’s slots as free. It is safer to offer fewer slots than to confirm a busy one.

4. Re-check and hold the slot before confirmation

Minutes can pass between displaying the calendar and submitting the form. On submission, create a short-lived hold in your own database with a unique constraint on the combination of resource and time, then check availability in the external calendar again, and only then confirm the booking. If the hold expires or the check fails, the customer is offered a different time. This step handles two customers booking simultaneously, which the calendar alone will not catch.

5. Write the booking with a persistent identifier

Store the calendar event identifier with every booking. The iCalendar standard requires a unique, persistent UID identifier for an event, and the TRANSP property defines whether an event blocks time in busy-time searches; events that actually consume time should be marked as OPAQUE (RFC 5545). This way, when a booking changes or is cancelled, you update the right event and do not create a duplicate.

6. Track calendar changes and plan for missed notifications

The Google Calendar API can send change notifications to your HTTPS webhook. A notification channel has an expiration time, there is no automatic renewal, and before it expires you must create a new channel with a new unique identifier. Google also states that notifications are not 100% reliable and a small percentage of messages may be dropped, so the application must keep syncing without them (Google: Push notifications).

Pull the changes incrementally: after the first full sync, store the nextSyncToken and subsequent requests return only changed events. If the server invalidates the token, it responds with status 410 and the application should wipe its local copy and run a new full sync (Google: Synchronize resources efficiently). In practice, combining notifications as a signal with a scheduled reconciliation sync works well.

7. Monitor and handle exceptions

Track expired channels, failed queries, slots in a “needs review” state and bookings whose calendar event is missing or has moved. For each type of exception, assign a responsible person and a procedure, such as calling the customer or offering an alternative time.

Trade-offs to decide consciously

  • Speed versus accuracy: a short-lived cache speeds up the display of slots, but the final check before confirmation must always use current data.
  • Tentative appointments: in its availability view, Microsoft Graph distinguishes free, tentative and busy time (source). Decide whether a tentative appointment blocks a booking. For expensive or long services, yes is the safer choice.
  • Privacy: availability without details protects staff members‘ private data, but dispatch sometimes needs to know the reason. Make details available only to roles that really need them.
  • Off-the-shelf tool versus custom solution: a ready-made booking system is a fast start. A custom integration makes sense when bookings must connect to a CRM, inventory, payments or rules the ready-made tool does not support.

Most common mistakes

  • Relying on an ICS link for slots that sell out quickly.
  • Checking availability only when the page loads, not at confirmation.
  • No lock or unique constraint in your own database.
  • Ignoring errors for individual calendars, so an unavailable calendar looks empty.
  • Forgetting to renew notification channels and having no fallback sync.
  • Bookings written as “free time”, which then do not block further slots.
  • Broad permissions to every company calendar when availability is all you need.

Pre-launch checklist

Area What to verify
Rules Working hours, service durations, buffers and minimum notice are documented
Permissions Reading availability and writing bookings are limited to the necessary calendars
Errors A calendar with an error returns no free slots
Concurrency A test of two simultaneous bookings of the same slot confirms only one
Writing The booking stores the event identifier and blocks time
Changes Moving or deleting an event in the calendar is reflected in the system
Fallback Scheduled sync works without notifications and handles status 410
Operations Channel expiry, errors and exceptions have an alert and a responsible person

Frequently asked questions

Is it enough to connect the booking form to a calendar via an ICS link?

For displaying appointments, yes; for protecting against double bookings, usually not. A link subscription is refreshed by the other application, and the booking system does not have the current state at confirmation.

Does the system need to see the content of staff calendar events?

No. To calculate free slots, availability is enough, meaning the start and end of busy intervals. Both Google and Microsoft provide separate methods and narrower permissions for this.

What if Google does not send a change notification?

You have to expect it, because Google states that a small percentage of notifications may be dropped. A regular incremental sync with a sync token catches the change even without a notification.

Can Google Calendar and Outlook be combined in one booking system?

Yes, if the system works with both APIs and knows, for each resource, which calendar to read availability from and where to write bookings. With Microsoft 365, keep in mind that the getSchedule method does not support personal Microsoft accounts.

How we can help

We design availability rules, connect bookings to Google or Outlook calendars and set up concurrency control, change tracking and monitoring. See what we do on the Webiant homepage, browse more practical guides on our blog, and if you want your booking process reviewed, contact us.

Sources

Choose which cookies to allow. You can change your choice at any time using the footer link or cookie button.

Privacy policy and cookie details