> ## Documentation Index
> Fetch the complete documentation index at: https://atmet.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Gmail Integration: Automate Email Workflows in Atmet

> Connect Gmail to Atmet to trigger workflows on new emails, send automated replies, manage drafts, and keep your inbox organized without manual effort.

Gmail is one of the most powerful integrations in Atmet. By connecting your Google account, you give your AI agents the ability to monitor your inbox for specific messages, send and draft emails on your behalf, organize threads with labels, and handle the full lifecycle of email communication — all without manual intervention. Whether you're triaging customer support requests, following up on unpaid invoices, or routing leads from a contact form, the Gmail integration puts your inbox on autopilot.

## Prerequisites

Before connecting Gmail, make sure you have:

* A Google account with Gmail enabled
* The ability to grant third-party OAuth access (some Google Workspace administrators restrict this — check with your IT team if the authorization screen doesn't appear)
* For label-based triggers: at least one label already created in Gmail

***

## Connecting Gmail

<Steps>
  <Step title="Open Integrations">
    In the Atmet sidebar, navigate to **Integrations** and find **Gmail** in the list.
  </Step>

  <Step title="Click Connect">
    Click the **Connect** button on the Gmail card. A Google authorization window will open.
  </Step>

  <Step title="Choose your Google account">
    Select the Google account you want to connect. If you manage multiple inboxes, repeat this process to add each one as a separate connection.
  </Step>

  <Step title="Grant permissions">
    Review the requested Gmail permissions and click **Allow**. Atmet requests only the scopes needed to support the triggers and actions listed below.
  </Step>

  <Step title="Confirm the connection">
    You'll be redirected back to Atmet. A green **Connected** badge confirms that your Gmail account is ready to use in workflows.
  </Step>
</Steps>

<Note>
  You can connect multiple Gmail accounts to the same Atmet workspace. Each account appears as a separate connection you can assign independently to different workflows.
</Note>

***

## Triggers

Triggers tell Atmet when to start a workflow. Gmail supports two triggers.

<Accordion title="New Gmail message received (GMAIL_NEW_GMAIL_MESSAGE)">
  Fires whenever a new message arrives in your Gmail inbox. You can narrow the trigger with the following filters:

  | Parameter          | Description                                                                                                  |
  | ------------------ | ------------------------------------------------------------------------------------------------------------ |
  | `userId`           | The Gmail address to monitor (defaults to the authenticated account).                                        |
  | `labelIds`         | Limit the trigger to messages carrying specific labels (e.g., `INBOX`, `UNREAD`, or a custom label).         |
  | `query`            | A Gmail search query string (e.g., `from:invoices@acme.com has:attachment`) to match only relevant messages. |
  | `Polling interval` | How frequently Atmet checks for new messages. Lower intervals give faster response times.                    |

  **Use this trigger when** you want to react to inbound emails — customer inquiries, form submission notifications, invoice receipts, and similar.
</Accordion>

<Accordion title="Gmail message sent (GMAIL_EMAIL_SENT_TRIGGER)">
  Fires whenever the authenticated user sends a message from Gmail. This trigger does not require additional filters.

  **Use this trigger when** you want to log outbound communications, start a follow-up sequence after a sales email, or update a CRM record when a reply is sent.
</Accordion>

***

## Actions

Actions are steps your workflow executes inside Gmail. The Gmail integration provides a comprehensive set of actions covering every stage of the email lifecycle.

<Accordion title="Reading and fetching emails">
  | Action                         | What it does                                                                      |
  | ------------------------------ | --------------------------------------------------------------------------------- |
  | **Fetch emails**               | Returns a list of messages matching optional filters (label, query, max results). |
  | **Fetch message by ID**        | Retrieves the full content of a single message using its Gmail message ID.        |
  | **Fetch message by thread ID** | Returns all messages belonging to a specific email thread.                        |
  | **Get attachment**             | Downloads an attachment from a message by its attachment ID.                      |
  | **List Gmail history**         | Returns a history of changes to the mailbox since a given history ID.             |
  | **Get profile**                | Returns basic profile information for the authenticated Gmail account.            |
</Accordion>

<Accordion title="Sending and replying">
  | Action              | What it does                                                                                            |
  | ------------------- | ------------------------------------------------------------------------------------------------------- |
  | **Send email**      | Composes and sends a new email to one or more recipients. Supports HTML body, CC, BCC, and attachments. |
  | **Reply to thread** | Sends a reply within an existing thread, preserving conversation context.                               |
  | **Forward message** | Forwards an existing message to a new recipient.                                                        |
  | **Import message**  | Imports a raw RFC 2822 message into the mailbox without sending it.                                     |
</Accordion>

<Accordion title="Drafts management">
  | Action                 | What it does                               |
  | ---------------------- | ------------------------------------------ |
  | **Create email draft** | Creates a new draft without sending it.    |
  | **Update draft**       | Replaces the content of an existing draft. |
  | **Get draft**          | Retrieves a single draft by its draft ID.  |
  | **List drafts**        | Returns all drafts in the mailbox.         |
  | **Send draft**         | Sends an existing draft immediately.       |
  | **Delete draft**       | Permanently removes a draft.               |
</Accordion>

<Accordion title="Organizing and labeling">
  | Action                    | What it does                                                 |
  | ------------------------- | ------------------------------------------------------------ |
  | **Modify email labels**   | Adds or removes labels on a single message.                  |
  | **Batch modify messages** | Applies label changes to multiple messages in one operation. |
  | **Modify thread labels**  | Adds or removes labels on every message in a thread.         |
  | **Move message to trash** | Moves a message to the Trash folder (recoverable).           |
  | **Trash thread**          | Moves an entire thread to Trash.                             |
  | **Delete message**        | Permanently deletes a message (not recoverable).             |
  | **Delete thread**         | Permanently deletes an entire thread.                        |
</Accordion>

<Accordion title="Threads and labels management">
  | Action           | What it does                                                         |
  | ---------------- | -------------------------------------------------------------------- |
  | **List threads** | Returns threads matching optional search filters.                    |
  | **List labels**  | Returns all labels defined in the mailbox.                           |
  | **Get label**    | Retrieves metadata for a single label by ID.                         |
  | **Create label** | Creates a new label in the mailbox.                                  |
  | **Update label** | Renames or changes the color of an existing label.                   |
  | **Patch label**  | Partially updates a label's properties.                              |
  | **Delete label** | Removes a label from the mailbox (does not delete labeled messages). |
</Accordion>

***

## Workflow ideas

<CardGroup cols={2}>
  <Card title="Customer support triage" icon="headset">
    Trigger on new messages with a `support@` label. Use an AI step to classify urgency, then apply a priority label and assign the thread to the right team member in your project management tool.
  </Card>

  <Card title="Invoice processing" icon="file-invoice">
    Trigger on emails matching `from:billing has:attachment`. Extract invoice data with an AI parser, create a row in Google Sheets, and send a confirmation reply to the sender.
  </Card>

  <Card title="Lead follow-up sequence" icon="user-plus">
    Trigger on the **message sent** event when an email goes to a new prospect. Wait 3 days, check if a reply exists, and if not, draft a polite follow-up and send it automatically.
  </Card>

  <Card title="Email-to-Notion inbox" icon="inbox">
    Trigger on new messages tagged with a specific label. Parse the subject and body, then create a new Notion page in your task database so important emails never get lost.
  </Card>
</CardGroup>

***

## Limitations and notes

<Warning>
  Gmail's API imposes daily quota limits on read and send operations. High-volume workflows (thousands of emails per day) may hit these limits. Monitor usage in the Google Cloud Console if you run large-scale automations.
</Warning>

<Note>
  The **polling interval** on the new message trigger affects how quickly Atmet detects incoming emails. Shorter intervals consume more API quota. For most use cases, a 5-minute interval is a good balance between responsiveness and quota usage.
</Note>

<Tip>
  Use Gmail's powerful query syntax in the `query` filter — operators like `from:`, `to:`, `subject:`, `has:attachment`, `after:`, and `label:` let you target exactly the messages that should start your workflow, reducing noise.
</Tip>
