Google Calendar API Setup Guide

Complete guide to setting up Google Calendar API integration for automated meeting booking

Google Calendar API Setup Guide

What This Does

This completely replaces Calendly with direct Google Calendar integration:
  • Creates meetings instantly in your Google Calendar
  • Generates Google Meet links automatically
  • Sends calendar invites to both parties
  • Shows real-time availability from your actual calendar
  • Respects your working hours from Google Calendar settings
  • 36-hour minimum notice - no same-day bookings
  • No weekend availability - Monday-Friday only
  • No user interaction required - meeting is booked immediately
  • Fallback to Calendly if Google Calendar fails

Setup Steps

1. Create Google Cloud Project

  1. Go to Google Cloud Console
  2. Create a new project or select existing one
  3. Enable the Google Calendar API

2. Create Service Account

  1. Go to IAM & Admin > Service Accounts
  2. Click Create Service Account
  3. Name it: cascadia-marquee-calendar
  4. Click Create and Continue
  5. Skip roles for now, click Done

3. Generate Credentials

  1. Click on your service account
  2. Go to Keys tab
  3. Click Add Key > Create New Key
  4. Choose JSON format
  5. Download the JSON file

4. Share Calendar with Service Account

  1. Open your Google Calendar
  2. Go to Settings > Settings for my calendars
  3. Select your calendar
  4. Go to Share with specific people
  5. Add the service account email (from the JSON file)
  6. Give it Make changes to events permission

5. Environment Variables

Add these to your .env.local:
# Google Calendar API
GOOGLE_CLIENT_EMAIL=your-service-account@project.iam.gserviceaccount.com
GOOGLE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYour private key here\n-----END PRIVATE KEY-----\n"
GOOGLE_CALENDAR_ID=your-email@gmail.com
Important:
  • Replace \n with actual newlines in GOOGLE_PRIVATE_KEY
  • Use your email as GOOGLE_CALENDAR_ID

Testing

  1. Submit a meeting request through your form
  2. Check your Google Calendar - meeting should appear immediately
  3. Check your email - you should receive a calendar invite with Google Meet link
  4. Client should also receive a calendar invite

Fallback System

If Google Calendar fails, the system automatically falls back to Calendly scheduling links, so your booking system never breaks.

Benefits

  • Instant booking - No waiting for user confirmation
  • Google Meet integration - Automatic video call links
  • Calendar sync - Meetings appear immediately
  • Branded emails - Resend handles all communications
  • Reliable fallback - Calendly backup if needed

Troubleshooting

"Calendar not found" error:
  • Make sure you shared your calendar with the service account
  • Check that GOOGLE_CALENDAR_ID is your email address
"Authentication failed" error:
  • Verify GOOGLE_CLIENT_EMAIL and GOOGLE_PRIVATE_KEY are correct
  • Make sure private key has proper newlines
"Insufficient permissions" error:
  • Ensure service account has "Make changes to events" permission
  • Check that Google Calendar API is enabled