微算力 · API 导航与自营网关
API 接入 EN
未登录登录
📬

AI 邮件监控实时推送到 Telegram

Mail Agent · v0.1.2
效率 安全 B 级 作者 nanaco666 公开目录收录
967 下载 0 安装 3.6k 收藏 13 浏览

简介

OpenClaw 邮件代理,通过 Google Pub/Sub 实时监控 Gmail,AI 智能筛选重要邮件并推送至 Telegram,适合需要即时掌握关键邮件的技术用户。

原始描述

Set up AI-powered Gmail monitoring in OpenClaw. Watches inbox via Google Pub/Sub and pushes important emails to Telegram. Use when the user wants to install...

通过你的 Agent 添加

安装目录:mail-agent/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/mail-agent/
Codex CLI~/.codex/skills/mail-agent/
DeepSeek Harness~/.agents/skills/mail-agent/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

技能正文


name: mail-agent description: Set up AI-powered Gmail monitoring in OpenClaw. Watches inbox via Google Pub/Sub and pushes important emails to Telegram. Use when the user wants to install mail-agent, set up email notifications, configure Gmail monitoring, or troubleshoot why email alerts aren't arriving.

Sets up mail-agent — an AI Gmail monitor that runs inside OpenClaw and delivers important emails to your Telegram.

When invoked, walk the user through every step below in order. Check each prerequisite before proceeding. Do not skip steps.


Step 1 — Check gog

gog auth list

If no accounts are listed, stop and tell the user to set up gog first:

gog auth credentials /path/to/client_secret.json
gog auth add you@gmail.com --services gmail

Note which Gmail account is being watched (GOG_ACCOUNT or the default).


Step 2 — Check Google Cloud

gcloud auth application-default print-access-token 2>&1 | head -1

If this fails (not logged in):

gcloud auth application-default login

Check if a suitable GCP project exists:

gcloud projects list

If no project exists, create one:

gcloud projects create mail-agent-YOUR_NAME --name "Mail Agent"
gcloud config set project mail-agent-YOUR_NAME

If a project exists, set it:

gcloud config set project YOUR_PROJECT_ID

Note the project ID — needed for plugin config.


Step 3 — Enable APIs

gcloud services enable gmail.googleapis.com pubsub.googleapis.com

Step 4 — Create Pub/Sub topic and subscription

gcloud pubsub topics create mail-agent-inbox
gcloud pubsub subscriptions create mail-agent-inbox-sub --topic=mail-agent-inbox

Grant Gmail permission to publish to the topic:

gcloud pubsub topics add-iam-policy-binding mail-agent-inbox \
  --member="serviceAccount:gmail-api-push@system.gserviceaccount.com" \
  --role="roles/pubsub.publisher"

Step 5 — Install the plugin

openclaw plugins install https://github.com/nanaco666/openclaw-mail-agent/archive/refs/tags/v0.2.0.tar.gz

Step 6 — Configure

Set required values (replace placeholders):

openclaw plugins config mail-agent --set chatId=YOUR_TELEGRAM_CHAT_ID
openclaw plugins config mail-agent --set gcpProject=YOUR_GCP_PROJECT_ID
openclaw plugins config mail-agent --set pubsubSubscription=mail-agent-inbox-sub

Set LLM for email classification (recommended — skip to use pass-through):

openclaw plugins config mail-agent --set llmApiKey=sk-...
openclaw plugins config mail-agent --set llmModel=gpt-4o-mini

To find your Telegram chat ID: message @userinfobot on Telegram.


Step 7 — Restart OpenClaw

openclaw gateway restart

Wait a few seconds, then check logs:

openclaw gateway logs | grep mail-agent

Expected output:

mail-agent: watch registered, historyId=...
mail-agent: watching inbox

If you see watch registration failed, re-check Step 3 and Step 4.


Step 8 — Test

Send a test email to the watched Gmail account with urgent content, e.g.:

Subject: Urgent: server is down Body: Production database crashed, users can't log in.

Wait up to 60 seconds. A notification should arrive in Telegram.

If nothing arrives after 2 minutes:

openclaw gateway logs | grep mail-agent

Common issues:

  • telegram runtime not available → restart OpenClaw gateway
  • watch registration failed → APIs not enabled or wrong project
  • subscription error → subscription name mismatch, check Step 4
  • No logs at all → plugin not loaded, check openclaw plugins list

Reconfigure / update settings

openclaw plugins config mail-agent --set KEY=VALUE
openclaw gateway restart

Uninstall

openclaw plugins uninstall mail-agent
openclaw gateway restart

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

email-monitoringgmailtelegramgoogle-cloudpub-subnotificationopenclaw-pluginai-filtering

同类 Skill