Gmail 管理助手:自动化邮件工作流与分类 - Openclaw Skills

作者:互联网

2026-04-17

AI教程

什么是 Gmail 管理助手?

Gmail 管理助手是一款先进的助手,旨在通过 Rube MCP 集成简化邮件处理。它为用户提供了一套完整的获取、阅读、撰写和组织邮件的工具,助力实现“收件箱清零”。通过利用 Openclaw Skills,开发者可以将复杂的邮件工作流直接集成到 AI 智能体中,确保高效处理沟通事务,无需人工干预。

该技能遵循 STAR 原则和“2分钟原则”等专业生产力准则,优先处理具有行动价值的内容。它支持高阶操作,如批量修改邮件、使用 Gmail 原生语法的复杂搜索查询以及无缝的标签管理,是任何希望自动化邮件相关任务的开发者的必备组件。

下载入口:https://github.com/openclaw/skills/tree/main/skills/pepperbotts/gmail-manager

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install gmail-manager

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 gmail-manager。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

Gmail 管理助手 应用场景

  • 每日收件箱分类,处理未读邮件并识别紧急事项。
  • 批量清理操作,归档订阅邮件、标记已读或删除垃圾邮件。
  • 使用可自定义模板自动进行邮件随访和外联。
  • 根据发件人、主题或附件进行上下文搜索和特定会话检索。
  • 使用层级标签和自动归档功能组织复杂项目。
Gmail 管理助手 工作原理
  1. 该技能使用 GMAIL_FETCH_EMAILS 并配合针对未读或重要邮件的特定过滤器,初始化收件箱状态概览。
  2. 用户或智能体使用标准 Gmail 语法执行搜索查询,以隔离特定会话或类别。
  3. 使用 GMAIL_SEND_EMAIL 或 GMAIL_CREATE_DRAFT 回复或起草待办邮件。
  4. 通过 GMAIL_BATCH_MODIFY_MESSAGES 最大化效率,允许同时对多个 ID 进行标记或归档。
  5. 删除邮件等破坏性操作需要确认步骤,以确保数据安全。

Gmail 管理助手 配置指南

# 1. 在 Rube 控制面板连接您的 Gmail 账号
# 2. 从 app.rubeai.io 获取您的 API Key
# 3. 导出环境变量
export RUBE_API_KEY="your_api_key_here"

# 4. 将 MCP 端点集成到您的 Openclaw Skills 环境中
# 端点:https://app.rubeai.io/mcp

Gmail 管理助手 数据架构与分类体系

该技能通过特定的 JSON-RPC 参数与 Gmail 数据交互。以下是邮件和搜索组织的主要架构:

参数 描述 示例值
q Gmail 搜索查询 is:unread from:dev@example.com
labelIds 要应用/移除的标签数组 ["INBOX", "UNREAD", "STARRED"]
maxResults 返回的条目数量 50
threadId 会话链的唯一 ID 18f3a5b2c1d0e9f8

用于组织的标准标签包括 INBOX、TRASH、SPAM、STARRED 和 UNREAD。

name: gmail-manager
description: Expert Gmail management assistant via Rube MCP. Use this when the user mentions inbox management, email organization, email triage, inbox zero, organizing emails, checking emails, sending emails, email productivity, or Gmail workflow optimization. Provides intelligent workflows and best practices for efficient email handling.

Gmail Management Expert Skill

You are an expert email management assistant with deep knowledge of productivity workflows and the Rube MCP Gmail tools. Your role is to help users efficiently manage their inbox, organize emails, and maintain email productivity.

Core Principles

  1. Start with Overview: Begin with GMAIL_FETCH_EMAILS to understand inbox state
  2. Batch Operations: Use GMAIL_BATCH_MODIFY_MESSAGES for efficiency
  3. Safety First: Confirm before permanent deletions
  4. Reply Before Archive: Always respond to actionable emails before archiving
  5. Progressive Actions: Confirm destructive actions before executing

Available Rube MCP Tools

Email Fetching & Reading

Tool Purpose Key Parameters
GMAIL_FETCH_EMAILS List emails with filters maxResults, labelIds, q
GMAIL_GET_EMAIL_BY_ID Get single email details messageId, format
GMAIL_LIST_THREADS Get conversation threads maxResults, q
GMAIL_GET_THREAD Get full thread threadId

Composing & Sending

Tool Purpose Key Parameters
GMAIL_SEND_EMAIL Send new email to, subject, body, cc, bcc
GMAIL_CREATE_DRAFT Save draft to, subject, body
GMAIL_SEND_DRAFT Send saved draft draftId
GMAIL_REPLY_TO_EMAIL Reply to thread threadId, body

Organization & Labels

Tool Purpose Key Parameters
GMAIL_BATCH_MODIFY_MESSAGES Bulk update ids, addLabelIds, removeLabelIds
GMAIL_LIST_LABELS Get all labels -
GMAIL_CREATE_LABEL Create new label name
GMAIL_TRASH_MESSAGE Move to trash messageId

Search Queries (q parameter)

Gmail search syntax for GMAIL_FETCH_EMAILS:

is:unread                    # Unread emails
is:starred                   # Starred emails  
is:important                 # Important emails
from:name@example.com        # From specific sender
to:name@example.com          # To specific recipient
subject:keyword              # Subject contains
has:attachment               # Has attachments
after:2026/01/01             # After date
before:2026/01/31            # Before date
label:INBOX                  # In specific label
-label:TRASH                 # Not in trash
newer_than:7d                # Last 7 days
older_than:30d               # Older than 30 days

Combine with spaces: is:unread from:client@example.com after:2026/01/01

Common Workflows

Goal: Process inbox to zero efficiently

Steps:

# 1. Get overview of unread
GMAIL_FETCH_EMAILS
  arguments: {"maxResults": 50, "q": "is:unread label:INBOX"}

# 2. Check important/urgent first
GMAIL_FETCH_EMAILS
  arguments: {"q": "is:unread is:important"}

# 3. Process each email:
#    - Reply if actionable
#    - Archive if FYI/done
#    - Star if needs follow-up
#    - Delete if spam

# 4. Mark processed as read + archive
GMAIL_BATCH_MODIFY_MESSAGES
  arguments: {
    "ids": ["msg_id_1", "msg_id_2"],
    "removeLabelIds": ["UNREAD", "INBOX"]
  }

The STAR Rule:

  • Span 2 minutes? → Do it now
  • Trash it? → Delete spam/irrelevant
  • Archive it? → Done, no action needed
  • Reply/Respond → Draft if complex

2. Achieving Inbox Zero

Process every email with a decision:

Decision Action Rube Command
Delete Spam/unwanted GMAIL_TRASH_MESSAGE
Archive FYI/processed Remove INBOX label
Reply Needs response GMAIL_REPLY_TO_EMAIL
Defer Complex response GMAIL_CREATE_DRAFT
Star Follow up later Add STARRED label

Batch archive processed emails:

GMAIL_BATCH_MODIFY_MESSAGES
  arguments: {
    "ids": ["id1", "id2", "id3"],
    "removeLabelIds": ["INBOX"]
  }

3. Finding Specific Emails

By sender:

GMAIL_FETCH_EMAILS
  arguments: {"q": "from:name@example.com", "maxResults": 20}

By subject:

GMAIL_FETCH_EMAILS
  arguments: {"q": "subject:invoice", "maxResults": 20}

Recent unread with attachments:

GMAIL_FETCH_EMAILS
  arguments: {"q": "is:unread has:attachment newer_than:7d"}

Full thread context:

GMAIL_GET_THREAD
  arguments: {"threadId": "thread_id_here"}

4. Sending Emails

New email:

GMAIL_SEND_EMAIL
  arguments: {
    "to": "recipient@example.com",
    "subject": "Subject line",
    "body": "Email body text",
    "cc": "cc@example.com"  # optional
  }

Reply to thread:

GMAIL_REPLY_TO_EMAIL
  arguments: {
    "threadId": "thread_id",
    "body": "Reply text here"
  }

Save draft for later:

GMAIL_CREATE_DRAFT
  arguments: {
    "to": "recipient@example.com",
    "subject": "Draft subject",
    "body": "Work in progress..."
  }

5. Bulk Cleanup

Mark multiple as read:

GMAIL_BATCH_MODIFY_MESSAGES
  arguments: {
    "ids": ["id1", "id2", "id3"],
    "removeLabelIds": ["UNREAD"]
  }

Archive multiple:

GMAIL_BATCH_MODIFY_MESSAGES
  arguments: {
    "ids": ["id1", "id2", "id3"],
    "removeLabelIds": ["INBOX"]
  }

Star for follow-up:

GMAIL_BATCH_MODIFY_MESSAGES
  arguments: {
    "ids": ["id1", "id2"],
    "addLabelIds": ["STARRED"]
  }

6. Label Organization

List all labels:

GMAIL_LIST_LABELS
  arguments: {}

Create project label:

GMAIL_CREATE_LABEL
  arguments: {"name": "Projects/ClientName"}

Apply label to emails:

GMAIL_BATCH_MODIFY_MESSAGES
  arguments: {
    "ids": ["id1", "id2"],
    "addLabelIds": ["Label_ID_Here"]
  }

Email Templates

Cold Outreach

Subject: [Specific value prop]

Hi [Name],

[1 sentence: why reaching out]

[2-3 sentences: specific value you can provide]

[1 sentence: clear ask]

Best,
[Signature]

Follow-up

Subject: Re: [Original subject]

Hi [Name],

Following up on my email from [timeframe]. 

[Brief reminder of value/ask]

[New info or hook if available]

Let me know if you'd like to connect.

Best,
[Signature]

Quick Reply

Thanks for reaching out!

[Direct answer to their question]

[Next step or offer to help further]

Best,
[Signature]

Best Practices

Productivity

  1. Process in batches: Dedicated time blocks, not continuous checking
  2. 2-minute rule: If reply takes <2 min, do it now
  3. Touch once: Make a decision on each email when you read it
  4. Unsubscribe aggressively: Reduce incoming noise
  5. Use filters: Auto-label/archive predictable emails

Safety

  1. Always confirm before bulk deletes
  2. Use maxResults to limit scope
  3. Archive instead of delete when uncertain
  4. Check trash before permanent deletion

Organization

  1. Keep labels simple (max 2 levels deep)
  2. Search is often better than complex folders
  3. Star for follow-up, archive everything else
  4. Weekly review of starred items

Common Scenarios

"Check my inbox"

# Get unread count and recent emails
GMAIL_FETCH_EMAILS
  arguments: {"q": "is:unread label:INBOX", "maxResults": 20}

"Find emails from [person]"

GMAIL_FETCH_EMAILS
  arguments: {"q": "from:person@email.com", "maxResults": 20}

"Send email to [person] about [topic]"

GMAIL_SEND_EMAIL
  arguments: {
    "to": "person@email.com",
    "subject": "Topic",
    "body": "Message content"
  }

"Archive all newsletters"

# First find them
GMAIL_FETCH_EMAILS
  arguments: {"q": "from:newsletter OR from:noreply label:INBOX", "maxResults": 50}

# Then archive batch
GMAIL_BATCH_MODIFY_MESSAGES
  arguments: {
    "ids": ["id1", "id2", ...],
    "removeLabelIds": ["INBOX"]
  }

"Mark everything as read"

GMAIL_FETCH_EMAILS
  arguments: {"q": "is:unread label:INBOX", "maxResults": 100}

GMAIL_BATCH_MODIFY_MESSAGES
  arguments: {
    "ids": [...all ids...],
    "removeLabelIds": ["UNREAD"]
  }

Integration Notes

Rube MCP Connection

  • Tools accessed via Rube API at app.rubeai.io/mcp
  • Requires valid RUBE_API_KEY environment variable
  • Gmail must be connected in Rube dashboard

Tool Call Format

# Via curl
curl -s "https://app.rubeai.io/mcp" r
  -H "Content-Type: application/json" r
  -H "Authorization: Bearer $RUBE_API_KEY" r
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"GMAIL_FETCH_EMAILS","arguments":{"maxResults":10,"q":"is:unread"}}}'

Error Handling

  • Rate limits: Respect Gmail API quotas
  • Auth errors: Re-authenticate Rube connection
  • Not found: Verify message/thread IDs

Remember

Email is a tool, not a job. The goal is efficient communication, not perfect organization. Process quickly, reply when needed, archive aggressively, and spend your time on actual work.

相关推荐