google-workspace
Original:🇺🇸 English
Translated
10 scripts
Connect to Gmail and Google Calendar via OAuth 2.0. Use when users want to search/read emails, create drafts, search calendar events, check availability, or schedule meetings. Triggers on queries about email, inbox, calendar, schedule, or meetings.
23installs
Sourceletta-ai/skills
Added on
NPX Install
npx skill4agent add letta-ai/skills google-workspaceTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Google Workspace Integration
Gmail and Google Calendar access via shared OAuth 2.0 authentication.
Prerequisites
- Python 3.10+ available
- Google Cloud project with Gmail API and Calendar API enabled
- OAuth 2.0 credentials () downloaded
credentials.json - Required packages: ,
google-api-python-client,google-auth-httplib2google-auth-oauthlib
OAuth Setup
Step 1: Create Google Cloud Project
- Go to https://console.cloud.google.com/
- Create a new project or select existing
- Navigate to APIs & Services → Library
- Enable both Gmail API and Google Calendar API
Step 2: Configure OAuth Consent Screen
- Go to APIs & Services → OAuth consent screen
- Select External user type
- Add scopes:
https://www.googleapis.com/auth/gmail.readonlyhttps://www.googleapis.com/auth/gmail.composehttps://www.googleapis.com/auth/gmail.modifyhttps://www.googleapis.com/auth/calendar.readonlyhttps://www.googleapis.com/auth/calendar.events
- Add user's email as a test user
Step 3: Create OAuth Credentials
- Go to APIs & Services → Credentials
- Click Create Credentials → OAuth client ID
- Select Desktop app as application type
- Download JSON and rename to
credentials.json
Step 4: Install Dependencies
bash
uv add google-api-python-client google-auth-httplib2 google-auth-oauthlibStep 5: First Authentication
Run any script - it will open a browser for OAuth consent. A is saved for future use.
token.jsonGmail Operations
Search Emails
bash
uv run python tools/google-workspace/scripts/search_emails.py "from:someone@example.com" --credentials ./credentials.jsonRead Email Content
bash
uv run python tools/google-workspace/scripts/read_email.py <message_id> --credentials ./credentials.jsonCreate Draft
bash
uv run python tools/google-workspace/scripts/create_draft.py \
--to "recipient@example.com" \
--subject "Subject line" \
--body "Email body" \
--credentials ./credentials.jsonFind Emails Needing Reply
bash
uv run python tools/google-workspace/scripts/needs_reply.py --credentials ./credentials.jsonCalendar Operations
List Calendars
bash
uv run python tools/google-workspace/scripts/list_calendars.py --credentials ./credentials.jsonSearch Events
bash
# Search by text
uv run python tools/google-workspace/scripts/search_events.py "meeting" --credentials ./credentials.json
# Search by date range
uv run python tools/google-workspace/scripts/search_events.py --start "2024-01-15" --end "2024-01-20" --credentials ./credentials.jsonCheck Availability
bash
uv run python tools/google-workspace/scripts/find_busy.py \
--start "2024-01-15T09:00:00" \
--end "2024-01-15T17:00:00" \
--credentials ./credentials.jsonCreate Event
bash
uv run python tools/google-workspace/scripts/create_event.py \
--summary "Team Meeting" \
--start "2024-01-15T10:00:00" \
--end "2024-01-15T11:00:00" \
--attendees "alice@example.com,bob@example.com" \
--credentials ./credentials.jsonOptions: , , ,
--description--location--timezone--calendarScripts Reference
Gmail:
- - Gmail authentication utilities
gmail_auth.py - - Search inbox with Gmail query syntax
search_emails.py - - Read email content by message ID
read_email.py - - Create draft emails
create_draft.py - - Find emails awaiting response
needs_reply.py
Calendar:
- - Calendar authentication utilities
calendar_auth.py - - List accessible calendars
list_calendars.py - - Search events by text/date
search_events.py - - Check free/busy periods
find_busy.py - - Create calendar events
create_event.py
Common Workflows
Schedule a Meeting
- Search calendar for availability:
search_events.py --start ... --end ... - Create event:
create_event.py --summary "..." --start ... --end ...
Reply to Important Emails
- Find emails needing reply:
needs_reply.py - Read specific email:
read_email.py <id> - Create draft response:
create_draft.py --to ... --subject "Re: ..."