跳到主要内容
哒哒星球DADA PLANET

Skill · 已公开版本

recipe-label-and-archive-emails · Gmail 邮件打标签并归档

通过 gws 命令行搜索匹配的 Gmail 邮件,为其添加指定标签并从收件箱移除,从而保持收件箱整洁。

先看看示例

作者提供的示例,实际效果取决于你的输入和使用工具。

输入

搜索来自 notifications@service.com 的邮件,统一打上通知标签并从收件箱归档。

输出

预期交付:已添加标签并移除 INBOX 标签的邮件,执行结果以表格或 JSON 返回。(编辑说明,非实际运行结果)

方法说明

---
name: recipe-label-and-archive-emails
description: "Apply Gmail labels to matching messages and archive them to keep your inbox clean."
metadata:
  version: 0.22.5
  openclaw:
    category: "recipe"
    domain: "productivity"
    requires:
      bins:
        - gws
      skills:
        - gws-gmail
---

# Label and Archive Gmail Threads

> **PREREQUISITE:** Load the following skills to execute this recipe: `gws-gmail`

Apply Gmail labels to matching messages and archive them to keep your inbox clean.

## Steps

1. Search for matching emails: `gws gmail users messages list --params '{"userId": "me", "q": "from:notifications@service.com"}' --format table`
2. Apply a label: `gws gmail users messages modify --params '{"userId": "me", "id": "MESSAGE_ID"}' --json '{"addLabelIds": ["LABEL_ID"]}'`
3. Archive (remove from inbox): `gws gmail users messages modify --params '{"userId": "me", "id": "MESSAGE_ID"}' --json '{"removeLabelIds": ["INBOX"]}'`