The Zeroic Journal

Google Calendar two way sync: stop double bookings

Why booking apps still double-book after connecting Google Calendar, and the sync design that closes each gap: tokens, channels, time zones and a slot lock.

On this page 7 sections
  1. How Google Calendar two way sync works
  2. Store sync tokens from the last page
  3. Push channels expire and miss messages
  4. Where double bookings come from
  5. Lock the slot in your database
  6. How to decide what to build
  7. Glibzter shipped 1:1 coach booking in 6 weeks

Google Calendar two way sync stops double bookings only when four pieces work together: sync tokens, push channels you renew before they expire, a live free/busy check at booking time, and a database constraint that refuses overlapping slots. Google says push notifications are not 100% reliable, so a synced copy alone will eventually let one through.

This matters most for booking, telehealth and marketplace apps, where a double booking means a provider with two patients at 10:00 or a buyer refunded for a session that never happened. Most guides stop at “connect the calendar and block busy times.” The failures live in the parts they skip: tokens that go invalid, channels that quietly expire, time zones and the race between two customers clicking the same slot.

How Google Calendar two way sync works

Two-way sync is two separate flows that share one mapping table.

Calendar to app. Your server keeps a copy of each connected calendar’s events. The first time, it lists everything; after that, it asks Google only for what changed. Your availability engine reads busy times from that copy.

App to calendar. When someone books in your app, you write the booking to the provider’s Google Calendar with events.insert, and update or delete it when the booking changes.

Push notifications connect the two. Google’s push notification guide is direct about what they are: the messages “do not contain specific information about updated resources, you will need to make another API call to see the full change details.” A notification is a ping that says “this calendar changed.” Your handler responds by running the incremental sync.

That makes the mapping table the center of the design: your booking ID, the Google calendar ID, the Google event ID, the event’s last updated time, and the connection it belongs to. Every fix below reads from it, the same way the mapping table anchors our QuickBooks API integration guide.

Store sync tokens from the last page

Google’s sync guide describes the pattern. A full sync lists the calendar’s events, page by page. The nextSyncToken “is present only on the very last page,” so keep following pageToken until it appears, then store it. On the next run, send that token as syncToken and Google returns only entries changed since then.

Three rules from the events.list reference trip teams up:

  • Filters don’t mix with tokens. timeMin, timeMax, updatedMin, q, orderBy, iCalUID and the extended-property filters can’t be sent with a sync token. Limit the date range on the full sync only, and keep every other parameter identical between full and incremental runs.
  • Deletes come back as events. With a sync token, “all events deleted since the previous list request will always be in the result set.” A deleted event arrives with status: "cancelled". If your code only handles new and changed events, a provider’s cancelled personal appointment keeps blocking the slot, or a deleted block keeps it free in your copy.
  • Pages are capped. The default page is 250 events and the maximum is 2,500, so a busy calendar’s first sync takes several requests.

Then handle the error that every long-running integration eventually sees. When Google invalidates a token, for example after it expires or the calendar’s sharing changes, the incremental request returns 410 Gone. Google’s documented fix is to wipe the local copy, discard the token and run a full sync.

async function syncCalendar(conn) {
  try {
    await incrementalSync(conn, conn.syncToken);
  } catch (err) {
    if (err.status !== 410) throw err;
    await db.events.deleteByCalendar(conn.calendarId); // Google: wipe and resync
    await fullSync(conn);                               // stores the new nextSyncToken
  }
}

Run one sync per calendar at a time. A notification storm can fire three handlers for the same calendar within a second, and three overlapping syncs racing to save a token is how a copy drifts.

Push channels expire and miss messages

You open a channel by calling watch on a calendar’s events with a unique id (up to 64 characters, Google suggests a UUID), type: "web_hook" and an HTTPS address. Google only delivers to an endpoint with a valid certificate, and self-signed ones don’t count.

The expiry is where integrations go quiet. The channel lasts until the time you request or Google’s own internal limit, “the more restrictive value is used,” and the watch response returns the exact expiry in milliseconds. Google states “there’s no automatic way to renew a notification channel.” Store the expiry next to the channel ID and resourceId, create a replacement with a new ID before it runs out, and stop the old channel once the new one is live. The two overlap briefly, which is harmless if your handler only triggers a sync.

The handler itself should be small:

  • Return 200 fast. Google treats 200, 201, 202, 204 and 102 as success. Put the calendar on a sync queue and respond.
  • Ignore the first message. A sync value in X-Goog-Resource-State only announces that the channel is open.
  • Check the channel token. Set a token when you create the channel and compare it with X-Goog-Channel-Token on every request. Google warns against putting OAuth tokens in it.

Even with all of that, Google’s own guide says “notifications are not 100% reliable.” Add a scheduled incremental sync per calendar as a safety net. With a sync token, a calendar that hasn’t changed returns no events, so the check is cheap. Spread those runs out: Google’s usage limits page recommends randomizing schedules and varying intervals by about 25% instead of syncing everything at midnight.

Where double bookings come from

A double booking almost always traces back to one of these six causes:

  1. A stale copy. An expired channel, a missed notification or a sync job that died leaves busy times out of date. The safety-net sync and channel renewal above close most of this.
  2. Two customers, one slot. Both load the booking page, both see 10:00 free, both pay. No amount of calendar sync fixes this; your database has to.
  3. A disconnected provider. Google’s OAuth documentation lists the ways a refresh token dies: a consent screen still in “Testing” status issues refresh tokens that expire in 7 days, a token unused for six months expires, and there’s a limit of 100 refresh tokens per Google account per OAuth client. A disconnected calendar looks free. Show the provider a visible “reconnect Google Calendar” state and stop offering their slots until they do.
  4. Events that don’t block time. The events resource has a transparency field; a transparent event “does not block time on the calendar.” All-day events use start.date instead of start.dateTime. Decide how your app treats both, and treat tentative invitations as busy unless the provider says otherwise.
  5. Time zones and recurring events. For recurring events, start.timeZone “is required and specifies the time zone in which the recurrence is expanded.” A weekly 9:00 meeting in New York stays at 9:00 local through a daylight-saving change, so its UTC time moves. Store every booking as a UTC instant plus the IANA zone it was booked in, and let Google expand recurrences. The recurring events guide explains that a moved or cancelled instance becomes an exception identified by recurringEventId and originalStartTime, so match instances on those, not on the start time.
  6. Your own writes coming back. Every event your app creates shows up in the next incremental sync. If the pull side doesn’t recognize it, the slot is counted twice or the booking is duplicated.

The fix for the last one is to choose the event ID yourself. The events.insert reference lets you set an id of 5-1,024 characters using lowercase letters a-v and digits 0-9. A UUID with its dashes removed fits, so derive the ID from your booking’s UUID and a retried insert targets the same event. Google notes it “cannot guarantee that ID collisions will be detected at event creation time,” so also write the booking ID into extendedProperties.private and match on it during sync.

Lock the slot in your database

Sync keeps your copy close to the truth. It can’t stop two checkouts landing in the same second. Do two things at the moment of booking.

Re-check Google live. Call the freebusy query endpoint for that provider and that slot. It returns busy ranges only, no event details, and accepts the narrow calendar.freebusy scope. One request covers up to 50 calendars, enough for a clinic’s whole roster.

Let the database refuse overlaps. If you’re on Postgres, an exclusion constraint makes double booking impossible at the storage layer. The PostgreSQL range types documentation shows the pattern with the btree_gist extension:

CREATE EXTENSION btree_gist;
CREATE TABLE bookings (
  provider_id uuid,
  slot tstzrange,
  EXCLUDE USING GIST (provider_id WITH =, slot WITH &&)
);

The second insert for an overlapping slot fails with a constraint error. Catch it, show the customer the next free time, and write to Google only after the database insert succeeds. Google Calendar mirrors the booking; your database owns it. Payments follow the same rule of one record that owns the truth, as in our guide to Stripe webhooks that drift.

Ask for the narrowest scopes that do the job. Google’s scope list includes calendar.freebusy to read availability, calendar.events.owned to manage events on calendars the user owns, and calendar.app.created if you’d rather write bookings to a separate calendar your app creates. Broad scopes such as full calendar access ask more of your users, and Google requires a verification process for scopes that reach certain user data.

Plan for quota and its new pricing too. As of December 2026, the usage limits page lists 10,000 requests per minute per project and 600 per minute per user per project. Google launched Standard and Scaled usage tiers on November 24, 2026, and its tiering page says billing for Scaled Tier usage won’t be enforced before April 1, 2027. Push plus sync tokens keeps a booking app far below these numbers; polling every calendar every minute does not.

How to decide what to build

  • Scheduling isn’t your product: embed a scheduling tool and store the bookings it reports. Two-way sync is a long list of edge cases you don’t need to own.
  • You only need to avoid clashes: read busy times with free/busy at booking, write confirmed bookings to Google, and skip the full mirror. This covers most single-provider apps.
  • Providers set availability in your app and live in Google Calendar: full two-way sync with sync tokens, renewed channels, a safety-net sync and the database lock.
  • Many providers per account, such as clinics or marketplaces: everything above, plus a per-provider sync queue, a reconnect flow and alerting when a channel or token fails.
  • Building a Calendly-style product: the calendar layer is the product. Our page on building an app like Calendly covers the rest of the stack, and the industries we build for covers telehealth and marketplace specifics.

If you’re starting a booking product from scratch, our MVP development sprint builds the sync, the slot lock and the payment flow together, so none of them is bolted on later.

Glibzter shipped 1:1 coach booking in 6 weeks

Scheduling is only as good as the booking and billing records under it. For Glibzter, a two-sided coaching platform, we built the 1:1 consulting booking flow with a coach-side calendar and automated reminders, alongside scored assessments, a video course player and Stripe checkout, in a 6-week build. Course sales and consulting packages run against the same billing record. That’s the principle behind the slot lock above: one record owns the booking, and everything else, including an outside calendar, follows it.

Sometimes the right move is to integrate a scheduler instead of building one. For KeepTrack, a white-label client portal for agencies and freelancers, we integrated Calendly for scheduling alongside project management, branded client views and Stripe milestone payments.

For calendar work, we quote one fixed price before work starts. Single integrations start at $1,000. Our API integration services page covers Google Calendar and the other systems your product needs to talk to.

Frequently asked questions

How does two-way sync with Google Calendar work?
Your app reads changes from Google with events.list and a stored sync token, and writes its own bookings with events.insert using an event ID it chooses. Push notification channels tell your server when a calendar changed, but they carry no event data, so every notification triggers another incremental sync. A periodic sync catches any notification that never arrives.
Why does my booking app still double book with Google Calendar connected?
Usually because availability comes from a stale local copy of the calendar. A missed push notification, an expired watch channel or a disconnected OAuth token leaves the copy out of date. Two customers booking the same slot at once is the other cause. Check Google's free/busy endpoint at the moment of booking and lock the slot in your own database.
How long do Google Calendar push notification channels last?
Google doesn't promise a fixed lifetime. A channel expires at the time you request or at Google's own internal limit, whichever comes first, and the watch response tells you the exact expiry in milliseconds. There's no automatic renewal, so store each channel's expiry, create a replacement channel before it runs out, then stop the old one.
What does a 410 error mean in Google Calendar sync?
A 410 Gone response means the sync token you sent is no longer valid. Google can invalidate tokens when they expire or when access to the calendar changes. The fix Google documents is to discard the token, clear your local copy of that calendar's events and run a full sync again, then store the new token from the last page.
What are the Google Calendar API rate limits?
As of December 2026, Google's quota page lists 10,000 requests per minute per project and 600 requests per minute per user per project. Going over returns HTTP 403 or 429 with a usageLimits error. Google recommends truncated exponential backoff and warns that polling every calendar on a timer quickly uses up the quota.

References

  1. Google Calendar API - Synchronize resources efficiently
  2. Google Calendar API - Push notifications
  3. Google Calendar API - Events: list
  4. Google Calendar API - Events: insert
  5. Google Calendar API - Events resource
  6. Google Calendar API - Freebusy: query
  7. Google Calendar API - Recurring events
  8. Google Calendar API - Usage limits
  9. Google Calendar API - Choose scopes
  10. Google Identity - Using OAuth 2.0 (refresh token expiration)
  11. Google Workspace - Standardized model for agent tools and APIs (tiers and billing)
  12. PostgreSQL documentation - Range types and exclusion constraints

More from the journal

Hear from Prashant within 24 hours.

Prashant Abbi Partner @ Zeroic

Adding Google Calendar to your booking app? Tell us which calendars you need to read, what you write back and where double bookings slip through today. We'll design the sync and quote one price before we start.

Rather talk it through? Book a 30-minute call