Graphrt

Gmail

Search and read messages and threads, labels, drafts, attachments, and send with safely built MIME (OAuth or service account), agent sends need an opt-in and an optional recipient allowlist

Beta v0.1.0 Node.js 18 actions ToS risk low
Use in Graphrt Desktop

About

A Graphrt plugin for the Gmail API v1: search and read messages and threads, labels, drafts, attachments, and sending mail from the signed-in account. For plain SMTP/IMAP with any provider see email.

What it can do

  • Messages: get_profile, list_messages (Gmail search syntax, labels), get_message (full, metadata, minimal, raw), get_attachment (saved to a directory), send_message, modify_message (labels: read, star, archive), trash_message (node only)
  • Threads: list_threads, get_thread, modify_thread
  • Labels: list_labels, get_label, create_label
  • Drafts: list_drafts, get_draft, create_draft, send_draft (node only)
  • api_request: any other endpoint under /gmail/v1/users/me (e.g. /history, GET only for agents)

Actions

Each action is a step you can add to a workflow. Agents can also use most of them as tools.

  • Mailbox profile gmail-api.get_profile
  • List messages gmail-api.list_messages
  • Get message gmail-api.get_message
  • Save attachment gmail-api.get_attachment
  • Send email gmail-api.send_message
  • Change labels gmail-api.modify_message
  • Trash message gmail-api.trash_message
  • List threads gmail-api.list_threads
  • Get thread gmail-api.get_thread
  • Change thread labels gmail-api.modify_thread
Show all 18 actions
  • List labels gmail-api.list_labels
  • Get label gmail-api.get_label
  • Create label gmail-api.create_label
  • List drafts gmail-api.list_drafts
  • Get draft gmail-api.get_draft
  • Create draft gmail-api.create_draft
  • Send draft gmail-api.send_draft
  • Gmail API request gmail-api.api_request

Settings

Graphrt starts plugins with a clean environment. Only these values reach the plugin, and secrets stay out of logs.

  • GOOGLE_REFRESH_TOKEN
    OAuth refresh trio (recommended)
  • GOOGLE_ACCESS_TOKEN
    A ready access token (used only when no refresh trio or key file is set, expires after an hour)
  • GOOGLE_SERVICE_ACCOUNT_JSON
    Path to a service account key file, Gmail mailboxes generally need domain-wide delegation, which this plugin does not do (no sub), so prefer OAuth
  • GMAIL_TOOL_ALLOW_SEND
    1 lets agent tools send mail
  • GMAIL_TOOL_RECIPIENT_ALLOWLIST
    Comma-separated addresses or @domains agent tools may send to
  • GMAIL_ATTACHMENT_DIR
    Absolute directory where get_attachment saves files
  • GOOGLE_CLIENT_ID
  • GOOGLE_CLIENT_SECRET
  • GMAIL_API_TOOL_TOKEN_SOURCE

How to use it

In Graphrt Desktop

  1. Open Plugins and search for Gmail.
  2. Click Install and approve it.
  3. Follow the setup steps on the plugin's page, then paste the settings it needs.
  4. Describe a job that needs it, and the builder adds the steps.
Plugins in Graphrt Desktop

With the CLI

terminal
$ graphrt plugin install gmail-api
workflow.yaml
- id: send
  type: gmail-api.send_message
  to: ["ops@example.com"]
  subject: "Laporan harian ✓"
  text: "All jobs passed."
  html: "<p>All jobs <b>passed</b>.</p>"
- id: reply
  type: gmail-api.send_message
  to: ["ada@example.com"]
  subject: "Re: Invoice"
  text: "Paid, thanks."
  thread_id: "{{#start.thread_id#}}"
  in_reply_to: "{{#start.message_id_header#}}"     # the original's Message-ID header, e.g. <CAB...@mail.gmail.com>
- id: archive
  type: gmail-api.modify_message
  message_id: "{{#start.message_id#}}"
  remove_label_ids: [INBOX, UNREAD]
Plugins in the docs