| name | google-workspace-setup |
| description | Properly set up Google Workspace OAuth2 authentication for Hermes agent, handling Python environment and module dependencies. |
| version | 1.0.0 |
Google Workspace Setup Skill
This skill provides a reliable method to set up Google Workspace OAuth2 authentication for the Hermes agent, addressing common issues with Python module imports and environment configuration.
Problem
The standard Google Workspace setup script (setup.py) fails with ModuleNotFoundError: No module named 'hermes_constants' when run directly because:
- The script depends on Hermes internal modules
- It needs to be run from the Hermes agent directory with proper Python path
- Virtual environment activation is required for dependencies
Solution
Always activate the Hermes virtual environment and run the setup script from the hermes-agent directory.
Prerequisites
- Google OAuth2 client secret JSON file (from Google Cloud Console)
- Hermes agent installed and accessible
Steps
Step 1: Prepare OAuth Credentials
- Go to https://console.cloud.google.com/apis/credentials
- Create/select a project
- Enable required APIs: Gmail, Calendar, Drive, Sheets, Docs, People API
- Create OAuth 2.0 Client ID (Desktop app type)
- Download the JSON file
Step 2: Copy Credentials to Hermes Directory
cp /path/to/downloaded/client_secret_*.json ~/.hermes/skills/productivity/google-workspace/google_client_secret.json
Step 3: Run Setup with Proper Environment
cd ~/.hermes/hermes-agent
source venv/bin/activate
python ~/.hermes/skills/productivity/google-workspace/scripts/setup.py --client-secret ~/.hermes/skills/productivity/google-workspace/google_client_secret.json
Step 4: Get Authorization URL
python ~/.hermes/skills/productivity/google-workspace/scripts/setup.py --auth-url
Step 5: Complete Authorization
- Open the URL from Step 4 in your browser
- Sign in with your Google account
- Grant the requested permissions
- After redirection (may show an error page - this is normal), copy the ENTIRE URL from the browser's address bar
Step 6: Exchange Authorization Code
python ~/.hermes/skills/productivity/google-workspace/scripts/setup.py --auth-code "PASTE_THE_ENTIRE_URL_FROM_STEP_5_HERE"
Step 7: Verify Authentication
python ~/.hermes/skills/productivity/google-workspace/scripts/setup.py --check
Verification
After successful setup, you can test Google Workspace access:
python ~/.hermes/skills/productivity/google-workspace/scripts/google_api.py gmail search "is:unread" --max 5
python ~/.hermes/skills/productivity/google-workspace/scripts/google_api.py calendar list
Notes
- Must maintain same terminal session: Steps 3-7 need to be run in the same terminal session where the venv is activated and you're in the hermes-agent directory
- Token storage: The OAuth token is saved automatically to
~/.hermes/google_token.json and refreshes automatically
- Re-authentication: To revoke and restart, use
--revoke flag then repeat from Step 3
- Troubleshooting:
- If you get
ModuleNotFoundError again, you likely left the hermes-agent directory or deactivated the venv
- If you get permission errors, ensure you enabled all required APIs in Google Cloud Console
- For Advanced Protection accounts, your Workspace admin needs to allowlist the OAuth client ID
Integration with Market Alpha Scout
Once Google Workspace is authenticated, the market_alpha_scout skill can successfully:
- Authenticate to stockbro.id via Google Workspace
- Scrape Daily Hot Stocks and Broker Summary data
- Combine with Google-based sentiment analysis for stock picks
Error Handling
Common errors and solutions:
ModuleNotFoundError: No module named 'hermes_constants' → Not in hermes-agent directory or venv not activated
FileNotFoundError for client secret → Check file path and permissions
invalid_grant → Token expired, redo authorization flow
403: Insufficient Permission → Missing API scopes, redo OAuth flow with all required APIs enabled