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
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable the Google Calendar API
2. Create Service Account
- Go to IAM & Admin > Service Accounts
- Click Create Service Account
- Name it:
cascadia-marquee-calendar - Click Create and Continue
- Skip roles for now, click Done
3. Generate Credentials
- Click on your service account
- Go to Keys tab
- Click Add Key > Create New Key
- Choose JSON format
- Download the JSON file
4. Share Calendar with Service Account
- Open your Google Calendar
- Go to Settings > Settings for my calendars
- Select your calendar
- Go to Share with specific people
- Add the service account email (from the JSON file)
- 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.comImportant:
- Replace
\nwith actual newlines inGOOGLE_PRIVATE_KEY - Use your email as
GOOGLE_CALENDAR_ID
Testing
- Submit a meeting request through your form
- Check your Google Calendar - meeting should appear immediately
- Check your email - you should receive a calendar invite with Google Meet link
- 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_IDis your email address
"Authentication failed" error:
- Verify
GOOGLE_CLIENT_EMAILandGOOGLE_PRIVATE_KEYare 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