Overview
Connect your agents to Google Calendar and Gmail for intelligent scheduling and email automation. Agents can check availability, schedule meetings, send emails, and manage your Google Workspace on your behalf. This integration uses OAuth 2.0 for secure authentication. Users authorize access once, and MagOneAI handles token management and refresh automatically. All credentials are stored in HashiCorp Vault.OAuth setup for Google Workspace
Before agents can access Google services, you need to configure OAuth and users need to authorize access.Configure Google OAuth credentials
In the Admin Portal, navigate to Integrations → Google Workspace. Enter your Google OAuth client ID and client secret. These are created in the Google Cloud Console for your project. The platform stores them securely in HashiCorp Vault.
Users authorize access
When a user first uses a Google tool, they’re redirected to Google’s OAuth consent screen. They authorize MagOneAI to access their calendar and email on their behalf.
Platform manages token storage and refresh
After authorization, MagOneAI stores the access token and refresh token in Vault. The platform automatically refreshes tokens before they expire — users never see credential errors.
OAuth tokens are stored securely in HashiCorp Vault. The platform handles token refresh automatically — users authenticate once and agents have ongoing access.
Google Calendar tools
Give your agents access to calendar management capabilities. Agents can read availability, create meetings, and manage events.List events
Retrieve calendar events for a specific date range. Parameters:calendar_id(optional) — defaults to user’s primary calendarstart_time— ISO 8601 datetime for range startend_time— ISO 8601 datetime for range endmax_results(optional) — maximum number of events to return
Create event
Create a new calendar event with title, time, attendees, and optional details. Parameters:calendar_id(optional) — defaults to user’s primary calendarsummary— event titlestart_time— ISO 8601 datetime for event startend_time— ISO 8601 datetime for event endattendees(optional) — list of email addressesdescription(optional) — event descriptionlocation(optional) — meeting location or video conference link
Update event
Modify an existing calendar event. Parameters:calendar_id(optional) — defaults to user’s primary calendarevent_id— ID of the event to updatesummary(optional) — new event titlestart_time(optional) — new start timeend_time(optional) — new end timeattendees(optional) — updated attendee listdescription(optional) — new descriptionlocation(optional) — new location
Delete event
Remove a calendar event. Parameters:calendar_id(optional) — defaults to user’s primary calendarevent_id— ID of the event to delete
Check availability
Find free and busy times for one or more attendees. Parameters:attendees— list of email addresses to checkstart_time— ISO 8601 datetime for range startend_time— ISO 8601 datetime for range end
Gmail tools
Enable agents to send, read, search, and manage emails on behalf of users.Send email
Compose and send an email with subject, body, recipients, and optional attachments. Parameters:to— list of recipient email addressessubject— email subject linebody— email body content (plain text or HTML)cc(optional) — list of CC recipientsbcc(optional) — list of BCC recipientsattachments(optional) — list of file paths or URLs to attach
Read email
Retrieve the content of a specific email by message ID. Parameters:message_id— Gmail message IDformat(optional) — response format (full,metadata,minimal)
Search emails
Find emails matching specific search criteria using Gmail’s search syntax. Parameters:query— Gmail search query (e.g., “from:[email protected] subject:invoice”)max_results(optional) — maximum number of results to return
List emails
Retrieve recent emails from inbox or specific labels. Parameters:label_ids(optional) — list of label IDs (defaults to INBOX)max_results(optional) — maximum number of emails to returninclude_spam_trash(optional) — whether to include spam and trash
Reply to email
Send a reply to an existing email thread. Parameters:message_id— ID of the message to reply tobody— reply body contentreply_all(optional) — whether to reply to all recipients (defaults to false)
Usage in workflows
Google tools can be used in both Agent nodes (for intelligent, flexible execution) and Tool nodes (for deterministic execution).Agent node example
System prompt:- Use
check_availabilityto find when John and Sarah are both free - Select an appropriate time slot
- Use
create_eventto schedule the meeting - Use
send_emailto notify attendees with meeting details
Tool node example
For deterministic email sending, use a Tool node: Tool: Send email Parameters:to:["[email protected]"]subject:"Weekly Report - {{date}}"body:{{report_content}}
Security and permissions
OAuth scopes
The Google Workspace integration requests these OAuth scopes:https://www.googleapis.com/auth/calendar— full calendar accesshttps://www.googleapis.com/auth/gmail.send— send emails on user’s behalfhttps://www.googleapis.com/auth/gmail.readonly— read emailshttps://www.googleapis.com/auth/gmail.modify— modify emails (labels, read status)
Credential storage
All OAuth tokens are stored in HashiCorp Vault with:- Encryption at rest using AES-256
- User-scoped access controls
- Automatic key rotation
- Audit logging for all access
Token refresh
Access tokens expire after 1 hour. MagOneAI automatically:- Detects when a token is about to expire
- Uses the refresh token to obtain a new access token
- Updates the stored token in Vault
- Retries the failed tool call with the new token
Troubleshooting
User authorization fails
User authorization fails
Calendar events not appearing
Calendar events not appearing
Symptoms: Agent says events were created but they don’t appear in Google Calendar.Solutions:
- Verify the agent is using the correct
calendar_id(defaults to primary) - Check that the user’s OAuth token has calendar scope
- Confirm timezone handling — ensure times are in ISO 8601 format with timezone
Emails not sending
Emails not sending
Symptoms: Send email tool returns success but email doesn’t arrive.Solutions:
- Check recipient email addresses are valid
- Verify the user’s OAuth token has gmail.send scope
- Look for emails in the user’s Sent folder to confirm they were sent
- Check recipient spam folders
Rate limiting errors
Rate limiting errors
Symptoms: Tools fail with “quota exceeded” or rate limit errors.Solutions:
- Google Calendar and Gmail have rate limits per user per day
- Reduce the frequency of tool calls if hitting limits
- Consider caching calendar data instead of repeated queries
- Request higher quotas from Google if needed for your use case