An intelligent email-to-calendar agent built with Mastra that analyzes Gmail messages for meeting requests and automatically creates Google Calendar events with all email thread participants.
This template provides an AI-powered assistant that:
- Monitors Gmail for meeting-related emails
- Intelligently extracts meeting details (date, time, location, participants)
- Automatically creates Google Calendar events
- Invites all email thread participants
- Handles authorization flows seamlessly through Arcade
- Smart Email Analysis: Uses the configured LLM to understand meeting context from email content
- Meeting Detection: Identifies time/date mentions, meeting keywords, and participant lists
- Automatic Calendar Integration: Creates events with extracted details
- Participant Management: Automatically invites everyone in the email thread
- Memory System: Maintains conversation context and learning
- Authorization Handling: Streamlined OAuth flow via Arcade tools
- Node.js >= 20.9.0
- Google account (for Gmail and Calendar access)
- Anthropic API key
- Arcade API key
-
Create a new project from this template:
npx create-mastra@latest --template meeting-scheduler cd meeting-scheduler pnpm install -
Configure environment variables:
cp .env.example .env
Edit
.envand add your API keys:ANTHROPIC_API_KEY=your_anthropic_api_key_here ARCADE_API_KEY=your_arcade_api_key_here -
Start the development server:
pnpm dev
-
Initial Authorization: When you first interact with the agent, it will provide authorization URLs for Gmail and Google Calendar access. Arcade handles the OAuth flow automatically.
-
Meeting Detection: The agent will analyze your Gmail messages looking for:
- Time and date mentions ("next Tuesday at 2pm", "December 15th at 10:00 AM")
- Meeting keywords ("meeting", "call", "discussion", "catch up", "sync")
- Location references (office addresses, meeting rooms, video links)
- Email threads with multiple participants
-
Calendar Event Creation: When meeting details are detected, the agent will:
- Extract relevant information from the email
- Create a calendar event with appropriate title
- Set the proposed date and time
- Invite all email thread participants
- Add email content as event description
ANTHROPIC_API_KEY: Your Anthropic API key for Claude model accessARCADE_API_KEY: Your Arcade API key for Gmail and Calendar tool access
Google OAuth authentication is handled automatically by Arcade - no manual setup required. When prompted, simply visit the provided authorization URLs to grant access.
src/
├── mastra/
│ ├── index.ts # Main Mastra configuration
│ └── agents/
│ └── meeting-scheduler.ts # Core agent implementation
├── package.json # Project dependencies and scripts
└── tsconfig.json # TypeScript configuration
- The agent uses Arcade tools to access Gmail and Google Calendar APIs
- Configured LLM analyzes email content for meeting indicators
- When meetings are detected, calendar events are created automatically
The agent handles Google service authentication through Arcade:
- First time usage triggers authorization request
- Agent provides clickable authorization URLs
- User grants permissions through Google OAuth
- Subsequent requests work automatically