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.
{
"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.
Client ID 103948573625184736251
OAuth scopes https://www.googleapis.com/auth/gmail.modifyKeep 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.
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: {}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.
{
"body": "Sorry about the lamp, Jana. A replacement ships today."
}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.
{
"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": []
}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.
{
"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" }
}{
"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.
{
"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": []
}{
"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.
{
"trigger": "cron",
"schedule": "0 8 * * 1",
"triggered_at": "2026-10-12T08:00:00.000Z",
"prompt": "Write the weekly support report"
}{
"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
More connectors
Apache Kafka
Consume topics to trigger agents and produce results back to topics under the source message key.
Inbound · Outbound
AWS S3
Run an agent the moment a file lands in a bucket, with the file itself when you turn on Include Content.
Inbound
MQTT
Subscribe to MQTT 5 topics to trigger agents from devices and machines, and publish results back to a topic.
Inbound · Outbound
PostgreSQL
Use LISTEN/NOTIFY to trigger an agent from new rows, without polling or a CDC pipeline.
Inbound
Stripe
Run an agent on invoice.payment_failed, customer.subscription.updated or any other Stripe event. connic verifies webhook signatures.
Inbound
WhatsApp
Answer WhatsApp messages to your business number with an agent, files included. Reply within 24 hours or reach people with approved templates.
Inbound · Outbound