Full Gmail API integration with managed OAuth โ read, send, search, label, and manage emails, threads, and drafts directly from your AI agent.
by
byungkyu
Gmail gives your AI agent full access to the Gmail API through managed OAuth authentication via the Maton gateway.
Read and send emails, manage threads and labels, create and send drafts, trash messages, and search your inbox using Gmail query operators โ all without manual OAuth token management.
Create a Google OAuth connection in the Maton control panel and authorize it in your browser.
Requests go through the Maton gateway at `https://gateway.maton.ai/google-mail/{native-api-path}` with tokens injected automatically.
Switch accounts by setting the Maton-Connection header to a specific OAuth connection.
Use standard Gmail API endpoints to read, send, label, draft, and search messages.
No manual token refresh or OAuth flow handling; the Maton gateway manages authentication automatically.
List, read, send, trash, and modify messages; manage threads, labels, and drafts.
Use Gmail search syntax like `is:unread`, `from:`, `subject:`, `has:attachment`, and date ranges.
Connect multiple Gmail accounts and switch between them using the Maton-Connection header.
Create, list, and delete OAuth connections through the Maton control panel API.
Create drafts and send them programmatically.
Have your AI agent scan unread emails and summarize or prioritize them.
Draft and send replies based on email content and context.
Find specific emails by sender, subject, date range, or attachment status.
Automatically organize emails by applying or removing labels.
Create email drafts for review before sending.
npx clawhub@latest install gmailRun in your terminal, or click the Install button at the top of this page for one-click setup.
Sign in to maton.ai, open the settings page, and copy your Maton API key.
Create a Gmail OAuth connection in the Maton control panel (ctrl.maton.ai), then open the authorization URL to complete OAuth.
Yes. Create multiple connections and pass the Maton-Connection header to select the account.
The gateway rate limits at roughly 10 requests per second per connection.
No. The Maton gateway injects the OAuth token automatically on each request.
All standard Gmail API endpoints are available through the Maton gateway URL pattern.