# Gmail AI integration on Definable

> Gmail is Google’s email service, featuring spam protection, search functions, and seamless integration with other G Suite apps for productivity

## What this connects

Gmail is Google’s email service, featuring spam protection, search functions, and seamless integration with other G Suite apps for productivity

Vendor: https://mail.google.com

## Tools available

**61** tools available. First 12:

- `GMAIL_ADD_LABEL_TO_EMAIL` — 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).
- `GMAIL_BATCH_DELETE_MESSAGES` — 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.
- `GMAIL_BATCH_MODIFY_MESSAGES` — 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.
- `GMAIL_CREATE_EMAIL_DRAFT` — 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.
- `GMAIL_CREATE_FILTER` — 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.
- `GMAIL_CREATE_LABEL` — 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.
- `GMAIL_CREATE_PROMPT_POST` — 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.
- `GMAIL_DELETE_DRAFT` — 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`.
- `GMAIL_DELETE_FILTER` — Delete Gmail filter — Tool to permanently delete a Gmail filter by its ID. Use when you need to remove an existing email filtering rule.
- `GMAIL_DELETE_LABEL` — Delete label from account (permanent) — Permanently DELETES a user-created Gmail label from the account (not from a message). WARNING: This action DELETES the label definition itself, removing it from all messages. System labels (INBOX, SENT, UNREAD, etc.) cannot be deleted. To add/remove labels from specific messages, use GMAIL_ADD_LABEL_TO_EMAIL action instead.
- `GMAIL_DELETE_MESSAGE` — Delete message — Permanently deletes a specific email message by its ID from a Gmail mailbox; for `user_id`, use 'me' for the authenticated user or an email address to which the authenticated user has delegated access.
- `GMAIL_DELETE_THREAD` — Delete thread — Tool to immediately and permanently delete a specified thread and all its messages. This operation cannot be undone. Use threads.trash instead for reversible deletion.

## Auth

Auth schemes: `OAUTH2`. Managed by Definable: `OAUTH2` — no client credentials required from the user.

## How agents use Gmail

Inside a Definable workflow, Gmail is one of the tools the **Distributor specialist** can call. Example coordination patterns:

- **Researcher → Gmail** — the Researcher (GPT-5.5) pulls context from Gmail (records, threads, documents), synthesises findings, and briefs the rest of the team.
- **Writer → Distributor → Gmail** — the Writer (Claude Opus 4.7) drafts copy in brand voice, the Verifier passes it, then the Distributor writes the result into Gmail (create record, post message, draft email).
- **Designer / Engineer → Distributor → Gmail** — the Designer ships an asset or the Engineer ships a code change, the Distributor delivers it via Gmail (attach file, open PR comment, post status).

The Verifier checks every Gmail call. On rate limit, schema drift, or auth refresh it self-heals and retries — the workflow completes without manual intervention.

## Categories

- email — https://definable.ai/apps/category/email/

## Related

- HTML page: https://definable.ai/apps/gmail/
- Same category (email): https://definable.ai/apps/category/email/
- All integrations: https://definable.ai/apps/
- Workflow (multi-agent loop): https://definable.ai/workflow/
- Apps llms.txt index: https://definable.ai/llms-apps.txt
