Setting Up Google Workspace CLI (gog) for the CCA Alumni Network Project
How we integrated Google Calendar and Workspace tools with our AI agent using gog CLI
How we integrated Google Calendar and Workspace tools with our AI agent using gog CLI
The Challenge
Our CCA Alumni Network project needed seamless integration with Google Calendar and other Workspace tools. We wanted our AI assistant to manage events, check availability, and coordinate schedules without manual intervention. Enter gog — a powerful command-line interface for Google Workspace.
What is gog?
gog is a CLI tool that provides programmatic access to Gmail, Calendar, Drive, Contacts, Sheets, Docs, and more. Unlike traditional API integrations, gog handles OAuth authentication elegantly and works great for automation and agent workflows.
Our Setup Journey
Step 1: Install gog
We already had gog installed locally at ~/.local/bin/gog (version 0.9.0). If you need to install it:
brew install steipete/tap/gogcli
Step 2: Create OAuth Credentials
This was the trickiest part. Here's what we did:
- Google Cloud Console → Created a new project (
calendar-api-488803) - APIs & Services → OAuth consent screen
- Set up as "External" user type
- Configured app name and developer contact
- Set to "In production" (allows any Google account to authorize)
- Credentials → Create OAuth 2.0 Client ID
- Application type: Desktop app
- Downloaded the
client_secret_*.jsonfile
Pro tip: Choose "Desktop app" for CLI tools, not "Web application"!
Step 3: Enable Required APIs
Before the OAuth token works, you need to enable the APIs you want to use. We enabled:
- Google Calendar API
- Google Drive API
- Google Sheets API
- Google Docs API
- Google Tasks API
- Gmail API
- People API (for Contacts)
Each API has its own enable link:
https://console.developers.google.com/apis/api/[API-NAME].googleapis.com/overview?project=[YOUR-PROJECT-ID]
Step 4: OAuth Authorization Flow
The standard gog auth flow:
# 1. Store credentials
gog auth credentials /path/to/client_secret.json
# 2. Authorize account
gog auth add alumniproject3000@gmail.com --services calendar --force-consent
This opens a browser window where you:
- Sign in to your Google account
- See a warning "Google hasn't verified this app" (this is normal for personal projects)
- Click Advanced → Go to [your app] (unsafe)
- Grant the requested permissions
Step 5: Manual Token Exchange (When Automated Flow Fails)
We ran into timeouts with the automated flow, so we did a manual OAuth exchange:
# Extract the authorization code from the callback URL
code="4/0AfrIepD..."
# Exchange for tokens
curl -X POST https://oauth2.googleapis.com/token \
-d "code=$code" \
-d "client_id=$CLIENT_ID" \
-d "client_secret=$CLIENT_SECRET" \
-d "redirect_uri=http://127.0.0.1:XXXXX/oauth2/callback" \
-d "grant_type=authorization_code"
This returns an access_token and refresh_token that can be used directly with Google APIs.
Testing It Works
Once authenticated, testing calendar access:
curl -H "Authorization: Bearer $ACCESS_TOKEN" \
"https://www.googleapis.com/calendar/v3/users/me/calendarList"
If you see your calendars listed, you're in business!
What We Can Do Now
With gog fully configured for alumniproject3000@gmail.com, our AI agent can now:
- Create and manage calendar events
- Check availability and schedule meetings
- Search Gmail for project updates
- Access and update Google Sheets
- Read and export Google Docs
- Manage tasks and to-dos
- Access contact information
Key Takeaways
- Desktop app OAuth is the way to go for CLI tools.
- Enable APIs first before trying to use them (403 errors = API not enabled).
- Manual token exchange is a reliable fallback when automated flows timeout.
- "Unverified app" warnings are normal for personal/dev projects — just click through.
- Refresh tokens are gold — store them securely!
Next Steps
Now that we have gog working, we're integrating it with our OpenClaw AI assistant for fully automated event coordination, task management, and team collaboration. Stay tuned for updates on how we're using AI to keep the CCA Alumni Network connected!
Project: CCA Alumni Network | Stack: OpenClaw + gog + Google Workspace | Team: Donji, Shola, Yulan, David