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

Skill · 已公开版本

recipe-create-gmail-filter · 创建 Gmail 自动筛选规则

通过 gws 命令行创建 Gmail 过滤器,对来自指定发件人的邮件自动添加标签、加星或分类,并可选择从收件箱移除。

先看看示例

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

输入

为 receipts@example.com 的邮件创建过滤器:先新建 Receipts 标签,再设置条件匹配该发件人,动作添加标签并从收件箱移除,最后列出过滤器确认。

输出

预期交付:已创建的 Gmail 标签与过滤器,以及过滤器列表的验证结果。(编辑说明,非实际运行结果)

方法说明

---
name: recipe-create-gmail-filter
description: "Create a Gmail filter to automatically label, star, or categorize incoming messages."
metadata:
  version: 0.22.5
  openclaw:
    category: "recipe"
    domain: "productivity"
    requires:
      bins:
        - gws
      skills:
        - gws-gmail
---

# Create a Gmail Filter

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

Create a Gmail filter to automatically label, star, or categorize incoming messages.

## Steps

1. List existing labels: `gws gmail users labels list --params '{"userId": "me"}' --format table`
2. Create a new label: `gws gmail users labels create --params '{"userId": "me"}' --json '{"name": "Receipts"}'`
3. Create a filter: `gws gmail users settings filters create --params '{"userId": "me"}' --json '{"criteria": {"from": "receipts@example.com"}, "action": {"addLabelIds": ["LABEL_ID"], "removeLabelIds": ["INBOX"]}}'`
4. Verify filter: `gws gmail users settings filters list --params '{"userId": "me"}' --format table`