Skip to main content
connic

Gmail

Run an agent on every new email in a Google Workspace mailbox, attachments included, and reply in the same thread from that mailbox.

Modes
Inbound, Outbound
Set up in
Dashboard or connectors/*.yaml
Documentation
Gmail docs
Publisher
By connic

Every new email starts a run

connic follows one label of the mailbox and gives each new message to every linked agent, in the same fields as the Email connector.

Parsed fields
Sender, subject, Message-ID, text and HTML bodies and attachments arrive as separate fields, with the Gmail thread ID next to them. An agent built for the Email connector reads them unchanged.
Any label
Watch INBOX, STARRED or a label of your own, such as Support/Orders. A Gmail filter that labels incoming email decides what the agent sees.
Read flags
connic marks each message as read once every linked agent received it, so Gmail shows what the agent picked up. Turn it off to leave the flags alone.
gmail-payload.json
{
  "from": "Jana Weber <jana@example.com>",
  "from_address": "jana@example.com",
  "to": "Acme Support <support@example.com>",
  "subject": "Order ord_8812 arrived damaged",
  "date": "Tue, 13 Oct 2026 07:12:04 +0000",
  "message_id": "<CAH7xR2kTq9w@mail.gmail.com>",
  "body_text": "Hi, the lamp in my order arrived broken.",
  "body_html": "<div>Hi, the lamp in my order arrived broken.</div>",
  "has_attachments": true,
  "attachments": [
    {
      "filename": "lamp.jpg",
      "content_type": "image/jpeg",
      "size_bytes": 182044,
      "content": "/9j/4AAQSkZJRgABAQ...",
      "encoding": "base64"
    }
  ],
  "_gmail": {
    "connector_id": "550e8400-e29b-41d4-a716-446655440000",
    "mailbox": "support@example.com",
    "label": "INBOX",
    "message_id": "192a7c3e5b8d4f10",
    "thread_id": "192a7c3e5b8d4f10",
    "timestamp": "2026-10-13T07:12:31.204518"
  }
}

Your own service account

connic signs in as a service account in your Google Cloud project. Your super admin authorizes it for one Gmail scope, and you can delete its key at any time.

No mailbox password
The JSON key of your service account lives in an encrypted Connection. Delete the key in the Google Cloud console, and connic can't sign in again.
One Gmail scope
gmail.modify reads new email, marks it as read and sends replies and notifications.
Gmail and Google Sheets
The same Google Workspace Connection serves Google Sheets connectors, so one service account covers mail and spreadsheets.
Google Admin console · Domain-wide delegation
Client ID      103948573625184736251
OAuth scopes   https://www.googleapis.com/auth/gmail.modify

Keep the mailbox next to your agents

Declare the connector in connectors/. The service account key lives in a Connection that the file names, so secrets stay out of your code and each environment can watch its own mailbox.

connectors/support-inbox.yaml
type: gmail
mode: inbound
name: Support inbox
connection: acme-google
config:
  mailbox: support@example.com
  label: Support/Orders
agents:
  - support-triage
environments:
  Staging:
    config:
      mailbox: support-test@example.com
  Production: {}
create: connectors/support-inbox.yaml (gmail)

Replies stay in the thread

An outbound Gmail connector turns the agent's output into an email from the same mailbox. For a run that an incoming email started, that email is a reply in the original thread.

Real replies
The reply goes to the sender in the same Gmail thread and lands in the mailbox's Sent folder, like one your team wrote.
Text or JSON
Plain output becomes the body. JSON can set to, cc, bcc, subject, html_body and reply_to. Send after every run, as a tool the model calls, or from middleware.
New emails too
With to in the output or default recipients on the connector, the agent sends a new email instead, such as a summary to your team.
output.json
{
  "body": "Sorry about the lamp, Jana. A replacement ships today."
}
Sent
From: support@example.com
To: Jana Weber <jana@example.com>
Subject: Re: Order ord_8812 arrived damaged

Sorry about the lamp, Jana. A replacement ships today.

Where Gmail fits

Pick a setup to see what arrives, which agent runs and what goes out.

Customers write to your support address, and the agent answers in the same thread.

Support mailbox
Inbound Gmail
support-triage
Reply in the thread
gmail-payload.json
{
  "from_address": "sam@example.com",
  "subject": "Change delivery address for ord_9035",
  "body_text": "Please ship it to my office instead.",
  "has_attachments": false,
  "attachments": []
}
Sent
From: support@example.com
To: sam@example.com
Subject: Re: Change delivery address for ord_9035

Done. Order ord_9035 now ships to your office.

A Gmail filter labels supplier invoices, and accounts payable gets the extracted totals by email.

Invoices label
Inbound Gmail
invoice-extractor
Summary to accounts payable
gmail-payload.json
{
  "from_address": "billing@supplier.example",
  "subject": "Invoice INV-2041",
  "has_attachments": true,
  "attachments": [
    {
      "filename": "INV-2041.pdf",
      "content_type": "application/pdf",
      "size_bytes": 48213,
      "content": "JVBERi0xLjcKJeLjz9MK...",
      "encoding": "base64"
    }
  ],
  "_gmail": { "label": "Invoices" }
}
output.json
{
  "to": "ap@example.com",
  "subject": "INV-2041: 3 items, EUR 1,284.50",
  "body": "Due Nov 12. Line items and VAT add up to the total."
}

The agent handles routine requests and calls an email tool to hand the rest to your team.

Support mailbox
Inbound Gmail
support-agent
Handoff to your team
gmail-payload.json
{
  "from_address": "lea@example.com",
  "subject": "Refund for a cancelled booking",
  "body_text": "I cancelled booking B-5521 within 24 hours.",
  "has_attachments": false,
  "attachments": []
}
tool-call.json
{
  "to": "support-leads@example.com",
  "subject": "Refund decision needed: booking B-5521",
  "body": "Lea cancelled within 24 hours and asks for a full refund."
}

A schedule starts the agent every Monday, and the report goes out from your Google Workspace mailbox.

Mondays at 08:00
Cron Scheduler
weekly-report
Report by email
cron-payload.json
{
  "trigger": "cron",
  "schedule": "0 8 * * 1",
  "triggered_at": "2026-10-12T08:00:00.000Z",
  "prompt": "Write the weekly support report"
}
output.json
{
  "to": ["lead@example.com", "ops@example.com"],
  "subject": "Support report, week 41",
  "body": "412 tickets, median first reply 38 minutes.",
  "html_body": "<h2>Week 41</h2><p>412 tickets, median first..."
}

Gmail FAQ

No. connic signs in to Google as your own service account with its key, and acts as the mailbox through domain-wide delegation. No user password or consent screen is involved.

Domain-wide delegation lets the service account act as every user of your domain for the Gmail scope; Google can't limit it to some users. connic only acts as the mailbox named on each connector. The docs show the setup.

No. It starts with the email that arrives after its first check, so linking an agent to a full inbox doesn't start a run for every old message.

Yes. When an inbound Gmail connector started the run, the outbound connector on the same mailbox replies to that email in the same Gmail thread, unless the output sets its own recipients.

No. The connector works with Google Workspace mailboxes. For a personal Gmail account, use the Email connector over IMAP and SMTP with an app password.