Google Calendar Integration — Setup Guide
This guide explains how to enable company-level Google Calendar integration to automatically sync job appointments. Follow each step carefully.
Part 1: Google Cloud Console Setup (Required First)
Step 1: Create Google Cloud Project
- Open your browser and go to: https://console.cloud.google.com/
- Sign in with your Google account.
- Create a new project or select an existing one:
- Click the “Select a project” dropdown at the top of the page.
- Click “New Project”.
- Enter a project name (e.g., YourCompany Calendar Integration).
- Click “Create”.
Step 2: Enable Google Calendar API
- Go to: Google API Library.
- Type Google Calendar API in the search bar.
- Click on the result for Google Calendar API.
- Click the Enable button.
Step 3: Create OAuth 2.0 Credentials
- Go to: Credentials.
- Click Create Credentials → OAuth client ID.
- If prompted, configure the OAuth consent screen:
- Click “Configure consent screen”.
- Select “External” (unless your company uses Google Workspace).
- Fill in the required details:
- App name: Enter your company name.
- User support email: Enter your email address.
- Developer contact information: Enter your email address again.
- Click “Save and Continue”.
- Skip scopes for now by clicking “Save and Continue” again.
- Add test users if needed, then click “Save and Continue”.
- Create OAuth Client ID:
- Application type: Web application.
- Name: Calendar Integration Client.
- Add the following Authorized redirect URIs (replace
yourdomain.comwith movematebend.co.uk):https://yourdomain.com/api/oauth/google/callback yourapp://oauth/callback
to look like thishttps://movematebend.co.uk/api/oauth/google/callback yourapp://oauth/callback
- Click Create.
- Download the JSON credentials file:
- Click “Download JSON” and save it somewhere safe on your computer.
- Open the file (usually named something like
client_secret_xxxxx.apps.googleusercontent.com.json) using Notepad. - Look for these values in the JSON:
{ "web": { "client_id": "your-client-id.apps.googleusercontent.com", "client_secret": "GOCSPX-your-client-secret", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", ... } } - Copy these two values perhaps into a new notepad file which can be saved if you prefer optional:
- Client ID: The string ending with
.apps.googleusercontent.com - Client Secret: The string starting with
GOCSPX-
- Client ID: The string ending with
- You will use these later in the app Company Admin Dashboard.
Step 4: Configure OAuth Consent Screen Scopes
- Return to: OAuth Consent Screen.
- Click Edit App.
- Go to the Scopes tab.
- Click Add or Remove Scopes.
- Add the following scopes:
https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/calendar.events
- Click Update and then Save and Continue.
Part 2: Company Admin Setup (In Your App)
Step 1: Access Calendar Integration
- Log in to your app as a company owner/admin (role level 6+).
- Go to the Company Admin Dashboard.
- Click on Calendar Integration (or go directly to
/calendar).
Step 2: Configure OAuth Credentials
- In the OAuth Config section, enter the following:
- Client Type: Web application (this will be pre-filled).
- Client ID: Paste the Client ID you copied earlier from the JSON file.
- Client Secret: Paste the Client Secret you copied earlier from the JSON file.
- Authorized Redirect URIs: Enter the same values you configured in Google Cloud:
https://yourdomain.com/api/oauth/google/callback yourapp://oauth/callback
- Scopes:
https://www.googleapis.com/auth/calendar
- Click Save OAuth Config.
Step 3: Connect Google Calendar
- Click the Connect Google Calendar button.
- You will be redirected to Google’s authorization page.
- Log in with the Google account that has the calendar you want to sync.
- Click Allow to grant permissions.
- You will be redirected back to your app with a success message.
Step 4: Configure Calendar Settings
- Expand the Calendar Settings section.
- Set the options:
- Enable Auto-sync Jobs to automatically create events for new jobs.
- Enable Sync Pickups to create events for pickup appointments.
- Enable Sync Deliveries to create events for delivery appointments.
- Enable Include Customer in Events to add the customer’s email as an attendee.
- Event Duration: Enter the default duration in minutes (e.g., 60).
- Event Title Template: Customize the event title format (e.g.,
Job #{jobId} - {eventType} - {customerName}).
- Your settings will be saved automatically.
Part 3: User Access and Permissions
Admin Users (Platform Level)
- Have full access to calendar integration management across all companies.
- Can view and manage all company integrations.
- Location: Admin dashboard → Calendar Management.
Company Users
- Owner/Manager (Role Level 6+):
- Can configure OAuth credentials.
- Can connect/disconnect calendar.
- Can modify settings.
- Can create manual events.
- Staff (Role Level < 6):
- Can only view integration status.
- Cannot change settings or credentials.
- Jobs they create will still sync automatically if enabled.
Part 4: Testing the Integration
- Create a test job with pickup/delivery dates.
- Check your Google Calendar at calendar.google.com.
- Verify the job appears with correct details.
- Modify the job details and confirm updates appear in the calendar.
Troubleshooting Common Issues
- “OAuth Error” or “Invalid Client”: Check that the Client ID and Secret are entered correctly, and confirm that Redirect URIs match exactly.
- “Insufficient Permissions”: Confirm you are logged in as a role level 6+ user, and ensure consent screen scopes were configured properly.
- “Events Not Syncing”: Check that auto-sync settings are enabled and integration shows as Connected. Try creating an event manually to test.
Part 5: Security Best Practices
For Company Admins
- Use a dedicated Google account for integration.
- Regularly review connected applications in your Google Account settings.
- Monitor calendar events for accuracy.
- Keep OAuth credentials secure — never share your Client Secret.
For Platform Admins
- Monitor OAuth usage across companies.
- Apply rate limits to API calls.
- Log integration activities for auditing.
- Ensure company data remains isolated.
Part 6: API Management (If Enabled)
Company API Access
- Location: Company Admin → API Management
- Features include:
- Generate API keys for third-party integrations.
- Monitor API usage and rate limits.
- Configure webhook endpoints for calendar events.
- Manage external application access.
Integration Endpoints
POST /api/trpc/calendar.integrations.createEvent POST /api/trpc/calendar.integrations.syncJob GET /api/trpc/calendar.integrations.getEvents
Part 7: Support and Maintenance
Regular Maintenance
- Monitor token expiration (Google tokens expire regularly).
- Check API quotas in Google Cloud Console.
- Review sync accuracy at least monthly.
- Update OAuth consent screen if app details change.