Overview
What it does
Gmail integration connects AI tools directly to your Gmail account, enabling natural language interactions with emails, drafts, labels, and contacts.Key Features:
- Send and receive emails
- Create and manage drafts
- Organize with labels
- Search and filter messages
- Manage conversation threads
- Access contacts and profiles
- Handle attachments
- Reply to threads
Use Cases
Email Management:
- Automatically respond to common inquiries
- Organize inbox with smart labeling
- Search for specific emails or threads
- Archive or trash old messages
- Draft personalized email responses
- Send scheduled notifications
- Create templated email campaigns
- Reply to conversation threads
- Forward important emails to Slack
- Extract data from email content
- Create CRM entries from emails
- Generate reports from email activity
Quick Start
1
Connect Your Google Account
NimbleBrain Studio uses OAuth2 to securely connect to your Gmail account.
- Navigate to Connections in the sidebar
- Click Browse Catalog
- Search for “Gmail”
- Click Install
- Click Connect and authorize with your Google account
- Grant the requested permissions for Gmail access
2
Verify Connection
Once connected, test the integration:Other test prompts:
- “List my recent email drafts”
- “Show all labels in my Gmail”
- “Get my Gmail profile information”
Available Tools
The Gmail connection provides 20+ tools organized into the following categories:Email Management
Email Operations
Email Operations
Fetch, read, and manage email messages.
Example Usage:
| Tool | Description |
|---|---|
GMAIL_FETCH_EMAILS | Retrieve emails with filtering, pagination, and full content options |
GMAIL_FETCH_MESSAGE_BY_MESSAGE_ID | Get a specific email by ID (minimal, full, raw, or metadata format) |
GMAIL_FETCH_MESSAGE_BY_THREAD_ID | Get all messages from a conversation thread |
GMAIL_DELETE_MESSAGE | Permanently delete an email message |
GMAIL_MOVE_TO_TRASH | Move an email to trash (recoverable) |
Use
MOVE_TO_TRASH for recoverable deletion; DELETE_MESSAGE permanently removes emails.Draft Operations
Draft Management
Draft Management
Create, list, and manage email drafts.
Example Usage:
| Tool | Description |
|---|---|
GMAIL_CREATE_EMAIL_DRAFT | Create a draft with recipients, subject, body (plain/HTML), and attachments |
GMAIL_LIST_DRAFTS | List all drafts with optional detailed content |
GMAIL_DELETE_DRAFT | Permanently remove a draft |
Thread Management
Thread Operations
Thread Operations
Manage email conversation threads.
Example Usage:
| Tool | Description |
|---|---|
GMAIL_LIST_THREADS | List conversation threads with filtering and pagination |
GMAIL_MODIFY_THREAD_LABELS | Add or remove labels from entire threads |
GMAIL_REPLY_TO_THREAD | Send a reply within an existing conversation |
Thread operations affect all messages in a conversation simultaneously.
Label Organization
Label Operations
Label Operations
Create and manage Gmail labels for organization.
Example Usage:
| Tool | Description |
|---|---|
GMAIL_CREATE_LABEL | Create custom labels with name, color, and visibility settings |
GMAIL_LIST_LABELS | List all system and user-created labels |
GMAIL_MODIFY_EMAIL_LABELS | Apply or remove labels from individual messages |
GMAIL_PATCH_LABEL | Update label properties (name, visibility, color) |
GMAIL_REMOVE_LABEL | Delete user-created labels |
Contacts & Profile
Contact Operations
Contact Operations
Access contacts and profile information.
Example Usage:
| Tool | Description |
|---|---|
GMAIL_GET_CONTACTS | Fetch contacts from Google account with pagination |
GMAIL_GET_PEOPLE | Get individual contact details or interaction history |
GMAIL_GET_PROFILE | Get account profile info (email, message count, history ID) |
Attachments
Attachment Operations
Attachment Operations
Handle email attachments.
Example Usage:
| Tool | Description |
|---|---|
GMAIL_GET_ATTACHMENT | Download attachments by attachment and message ID |
Example Workflows
- Inbox Management
- Draft Response
- Email Search
- Thread Cleanup
- Contact Lookup
Scenario: Organize and prioritize your inboxPrompt:What happens:
- Searches for unread emails matching criteria
- Applies the Priority label
- Returns a summary of found emails
Authentication
OAuth2 Authentication: This connection uses OAuth2 for secure authentication.
How It Works
When you connect Gmail in NimbleBrain Studio:- You’ll be redirected to Google’s authorization page
- Log in with your Google account
- Review and grant permissions
- You’re automatically redirected back to Studio
Required Scopes
The integration requests the following Gmail scopes: Email Scopes:gmail.readonly- Read email messages and settingsgmail.modify- Read, send, delete, and manage labelsgmail.compose- Create and send new emailsgmail.send- Send email on your behalf
contacts.readonly- Read contactscontacts.other.readonly- Read “other contacts”
userinfo.email- View email addressuserinfo.profile- View basic profile info
Rate Limits
Gmail API enforces quota limits:| Limit Type | Restriction |
|---|---|
| Daily sending | 500 emails/day (consumer), 2,000/day (Workspace) |
| Per-user rate | 250 quota units per user per second |
| Batch requests | 100 requests per batch |
messages.list- 5 unitsmessages.get- 5 unitsmessages.send- 100 unitsdrafts.create- 10 unitslabels.list- 1 unit
Studio automatically handles rate limiting with exponential backoff for retries.
Troubleshooting
Connection Failed
Connection Failed
Issue: OAuth authorization didn’t completeSolutions:
- Ensure you’re logged into the correct Google account
- Try a different browser or incognito mode
- Check popup blockers aren’t interfering
- Verify your Google account is active
- For Workspace accounts, check admin policies
Permission Denied
Permission Denied
Issue: Insufficient privileges errorSolutions:
- Reconnect to grant additional scopes
- For Workspace, ensure app is approved by admin
- Check if Gmail API is enabled in Google Cloud Console
- Verify account isn’t restricted
Email Not Found
Email Not Found
Issue: Cannot find specified emailSolutions:
- Verify the message ID is correct
- Email may have been deleted or moved
- Check trash and spam folders
- Try searching with different criteria
Send Failed
Send Failed
Issue: Cannot send emailSolutions:
- Check daily sending quota hasn’t been exceeded
- Verify recipient addresses are valid
- Ensure compose scope is authorized
- Check for attachment size limits (25MB)
Label Operations Failed
Label Operations Failed
Issue: Cannot create or modify labelsSolutions:
- System labels cannot be modified
- Label names must be unique
- Check for special characters in label name
- Verify modify scope is authorized
Rate Limit Exceeded
Rate Limit Exceeded
Issue: Too many requests errorSolutions:
- Wait for rate limit to reset
- Reduce frequency of requests
- Batch operations when possible
- Studio automatically handles retries
Best Practices
Email Organization
- Use labels consistently
- Create filters for auto-labeling
- Archive instead of delete when possible
- Use threads for related conversations
- Keep inbox manageable
Security
- Review connected apps regularly
- Use specific scopes, not full access
- Don’t store sensitive data in drafts
- Monitor for unusual activity
- Revoke access when not needed
Performance
- Use filters to limit search results
- Batch operations when possible
- Cache frequently accessed data
- Use pagination for large lists
- Fetch only needed message parts
Communication
- Use drafts for review before sending
- Reply in threads for context
- Include clear subject lines
- Test templates before bulk use
- Monitor delivery status
Links and Resources
Gmail API Reference
Official Gmail API documentation
Gmail Help Center
Gmail support and troubleshooting
Google Cloud Console
Manage API quotas and credentials
Need help? Join the NimbleBrain Discord or email [email protected]