This document explains how to set up and use the Google Calendar integration with your ADK Voice Assistant.
First, create a virtual environment:
# Create a virtual environment
python -m venv .venvActivate the virtual environment:
On Windows:
# Activate virtual environment on Windows
.venv\Scripts\activateOn macOS/Linux:
# Activate virtual environment on macOS/Linux
source .venv/bin/activateThen, install all required Python packages using pip:
# Install all dependencies
pip install -r requirements.txt- Create or use an existing Google AI Studio account
- Get your Gemini API key from the API Keys section
- Set the API key as an environment variable:
Create a .env file in the project root with:
GOOGLE_API_KEY=your_api_key_here
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Calendar API for your project:
- In the sidebar, navigate to "APIs & Services" > "Library"
- Search for "Google Calendar API" and enable it
- In the Google Cloud Console, navigate to "APIs & Services" > "Credentials"
- Click "Create Credentials" and select "OAuth client ID"
- For application type, select "Desktop application"
- Name your OAuth client (e.g., "ADK Voice Calendar Integration")
- Click "Create"
- Download the credentials JSON file
- Save the file as
credentials.jsonin the root directory of this project
Run the setup script to authenticate with Google Calendar:
python setup_calendar_auth.pyThis will:
- Start the OAuth 2.0 authorization flow
- Open your browser to authorize the application
- Save the access token securely for future use
- Test the connection to your Google Calendar
The Google Calendar integration supports working with multiple calendars. The OAuth flow will grant access to all calendars associated with your Google account. You can:
- List all available calendars using the voice command "What calendars do I have access to?"
- Specify which calendar to use for operations by name or ID
- Use your primary calendar by default if no calendar is specified
Examples:
- "Show me all my calendars"
- "Create a meeting in my Work calendar"
- "What's on my Family calendar this weekend?"
Once set up, you can interact with your Google Calendar through the voice assistant:
- "What's on my calendar today?"
- "Show me my schedule for next week"
- "Create a meeting with John tomorrow at 2 PM"
- "Schedule a doctor's appointment for next Friday at 10 AM"
- "Find a free time slot for a 30-minute meeting tomorrow"
- "Delete my 3 PM meeting today"
- "Reschedule my meeting with Sarah to Thursday at 11 AM"
- "Change the title of my dentist appointment to 'Dental Cleaning'"
After completing the setup, you can run the application using the following command:
# Start the ADK Voice Assistant with hot-reloading enabled
uvicorn main:app --reloadThis will start the application server, and you can interact with your voice assistant through the provided interface.
If you encounter authentication errors:
- Delete the token file at
~/.credentials/calendar_token.json - Run the setup script again
If you need additional calendar permissions:
- Delete the token file at
~/.credentials/calendar_token.json - Edit the
SCOPESvariable inapp/jarvis/tools/calendar_utils.py - Run the setup script again
Google Calendar API has usage quotas. If you hit quota limits:
- Check your Google Cloud Console
- Navigate to "APIs & Services" > "Dashboard"
- Select "Google Calendar API"
- View your quota usage and consider upgrading if necessary
If you encounter issues installing the required packages:
- Make sure you're using Python 3.8 or newer
- Try upgrading pip:
pip install --upgrade pip - Install packages individually if a specific package is causing problems
- The OAuth token is stored securely in your user directory
- Never share your
credentials.jsonfile or the generated token - The application only requests the minimum permissions needed for calendar operations
-
once in the local system authenticate using run the command
python setup_calendar_auth.py -
then run the following command to get the base64 encoded token:
python -c "import base64, json; print('CALENDAR_CREDENTIALS_BASE64=' + base64.b64encode(open('$HOME/.credentials/calendar_token.json').read().encode()).decode())"- copy the output and add it to your
.envfile