Connect your AI agent to Gmail
Gmail is Google’s email service, featuring spam protection, search functions, and seamless integration with other G Suite apps for productivity
Set it up in Melso
- 1In Melso, open Settings → Agent Apps and hit Connect on Gmail.
- 2Finish the OAUTH2 sign-in in the window that opens. Melso stores the connection, not your credentials.
- 3Open your agent, go to its Agent Apps tab, and allow Gmail.
- 4Give the agent a task. It calls Gmail itself when the work needs it.
What Gmail gives your agent
The tools, permissions, and events Gmail exposes — the same ones your agent can use once the app is authorized.
What you sign in with
Gmail connects with OAUTH2.
- Client id
- Client secret
Permissions
Tools Gmail exposes
Modify email labels
Adds and/or removes specified Gmail labels for a message; ensure `message_id` and all `label_ids` are valid (use 'listLabels' for custom label IDs).
Batch delete Gmail messages
Tool to permanently delete multiple Gmail messages in bulk, bypassing Trash with no recovery possible. Use when you need to efficiently remove large numbers of emails (e.g., retention enforcement, mailbox hygiene). Use GMAIL_MOVE_TO_TRASH instead when reversibility may be needed. Always obtain explicit user confirmation and verify a sample of message IDs before executing. High-volume calls may trigger 429 rateLimitExceeded or 403 userRateLimitExceeded errors; apply exponential backoff.
Batch modify Gmail messages
Modify labels on multiple Gmail messages in one efficient API call. Supports up to 1,000 messages per request for bulk operations like archiving, marking as read/unread, or applying custom labels. High-volume calls may return 429 rateLimitExceeded or 403 userRateLimitExceeded; apply exponential backoff.
Create email draft
Creates a Gmail email draft. While all fields are optional per the Gmail API, practical validation requires at least one of recipient_email, cc, or bcc and at least one of subject or body. Supports To/Cc/Bcc recipients, subject, plain/HTML body (ensure `is_html=True` for HTML), attachments, and threading. Returns a draft_id that must be used as-is with GMAIL_SEND_DRAFT — synthetic or stale IDs will fail. When creating a draft reply to an existing thread (thread_id provided), leave subject empty to stay in the same thread; setting a subject will create a NEW thread instead. HTTP 429 may occur on rapid creation/send sequences; apply exponential backoff.
Create Gmail filter
Tool to create a new Gmail filter with specified criteria and actions. Use when the user wants to automatically organize incoming messages based on sender, subject, size, or other criteria. Note: you can only create a maximum of 1,000 filters per account.
Create label
Creates a new label with a unique name in the specified user's Gmail account. Returns a labelId (e.g., 'Label_123') required for downstream tools like GMAIL_ADD_LABEL_TO_EMAIL, GMAIL_BATCH_MODIFY_MESSAGES, and GMAIL_MODIFY_THREAD_LABELS — those tools do not accept display names.
Create Prompt Post
Send a one-shot prompt to the Sanity Content Agent. Stateless one-shot prompt endpoint. No thread management or message persistence. Ideal for simple, single-turn interactions. Use when you need to send a single prompt and receive a response without maintaining conversation context.
Delete Draft
Permanently deletes a specific Gmail draft using its ID with no recovery possible; verify the correct `draft_id` and obtain explicit user confirmation before calling. Ensure the draft exists and the user has necessary permissions for the given `user_id`.
Events your agent can react to
Email Sent
Triggers when a Gmail message is sent by the authenticated user. It polls the 'SENT' label and emits metadata including sender, recipients, subject, timestamp, and thread ID.
New Gmail Message Received Trigger
Triggers when a new message is received in Gmail.
Use Gmail from the agent you already run
Melso runs the agent. You decide which of your authorized apps it may reach.
Compare nearby apps
Other Email connections your agents can use.
Connect to Outlook
Outlook is Microsoft's email and calendaring platform integrating contacts and scheduling, enabling users to manage communications and events in a unified workspace
Connect to Yandex
Yandex is a Russian internet services provider offering search, email, navigation, and other web-based solutions, often referred to as “Russia’s Google”
Connect to Zoho Mail
Zoho Mail is a secure and ad-free email hosting platform with collaboration tools, calendar integration, and extensive administrative controls
Connect to Agent Mail
AgentMail provides AI agents with their own email inboxes, enabling them to send, receive, and act upon emails for communication with services, people, and other agents.
Connect to BlueFox Email
BlueFox Email provides APIs for managing contacts and subscriber lists and sending transactional and triggered emails.
Connect to Bouncer
Bouncer is an email verification and validation service that helps ensure email deliverability by verifying email addresses through real-time and batch processing APIs.