返回顶部
i

invoice-collector发票收集器

Collect invoices/receipts from Gmail and send a summary email with attachments. Automatically downloads PDF attachments or takes screenshots of emails without PDFs. Use when user wants to gather invoices, receipts, or billing emails and forward them to another address. Requires gogcli (gog) to be configured with Gmail access.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.2.0
安全检测
已通过
759
下载量
免费
免费
2
收藏
概述
安装方式
版本历史

invoice-collector

发票收集器

从Gmail收集发票,并将其作为包含所有附件的摘要邮件发送。

安全注意事项

Puppeteer --no-sandbox 标志

此技能在启动Puppeteer/Chromium时使用--no-sandbox。这在许多环境中是必需的

  • - WSL(适用于Linux的Windows子系统):Chrome沙箱需要WSL1/WSL2中不可用的内核功能
  • Docker容器:除非使用--privileged或特定的seccomp配置文件运行
  • CI/CD环境:大多数运行器不支持Chrome的沙箱

风险:禁用沙箱意味着如果渲染了恶意HTML邮件,它可能在浏览器上下文之外执行代码。

缓解措施:此技能仅渲染来自您自己Gmail收件箱的邮件。风险仅限于您已收到的邮件。如果担心,请在处理前查看邮件或在隔离环境中运行。

通过 curl | tar 安装

gogcli安装示例使用curl -sL ... | tar xz,这是一种常见模式,但如果源被入侵,则存在供应链风险。

更安全的替代方案(验证校验和):
bash

下载并验证


curl -sLO https://github.com/steipete/gogcli/releases/latest/download/gogclilinuxamd64.tar.gz
curl -sLO https://github.com/steipete/gogcli/releases/latest/download/checksums.txt
sha256sum -c checksums.txt --ignore-missing
tar xzf gogclilinuxamd64.tar.gz
mv gog ~/.local/bin/

macOS用户:使用brew install steipete/tap/gogcli,它会自动处理验证。



前提条件与设置

1. 安装gogcli

bash

Linux(下载二进制文件)


curl -sL https://github.com/steipete/gogcli/releases/latest/download/gogclilinuxamd64.tar.gz | tar xz
mv gog ~/.local/bin/

macOS

brew install steipete/tap/gogcli

2. 设置Google OAuth

  1. 1. 前往Google Cloud Console
  2. 创建项目 → 启用Gmail API
  3. 创建OAuth凭据(桌面应用)
  4. 下载JSON

bash
gog auth credentials ~/path/to/client_secret.json
gog auth add your@gmail.com

3. 安装Puppeteer(用于邮件截图)

bash
cd /tmp && npm install puppeteer

4. 安装日文字体(可选,用于日文邮件)

bash
sudo apt install fonts-noto-cjk



使用方法

通用发票搜索

搜索任何发票/收据,无需指定特定发件人:

bash
export GOG_ACCOUNT=user@gmail.com
export GOGKEYRINGPASSWORD=your-password

搜索日期范围内的所有发票

gog gmail search (invoice OR receipt OR 請求書 OR 領収書 OR billing OR payment) after:2026/01/01 before:2026/02/01

按特定条件搜索

gog gmail search subject:(invoice OR receipt) has:attachment after:2026/01/01

工作流程

  1. 1. 搜索 - 查找发票邮件
  2. 下载 - 获取PDF或截图邮件
  3. 汇总 - 创建包含金额的摘要
  4. 发送 - 将邮件发送到目标地址并附带附件

步骤1:搜索发票

bash

上个月的所有发票


LAST_MONTH=$(date -d 1 month ago +%Y/%m/01)
THIS_MONTH=$(date +%Y/%m/01)
gog gmail search (invoice OR receipt OR 請求書 OR 領収書) after:$LASTMONTH before:$THISMONTH --json

步骤2:处理每封邮件

bash
mkdir -p /tmp/invoices

对于带有PDF附件的邮件:
bash

获取邮件详情


MSGID=id_here>
EMAILJSON=$(gog gmail read $MSGID --json)

查找PDF附件

ATTACHINFO=$(echo $EMAILJSON | jq -r .thread.messages[0].payload.parts[]? | select(.filename | test(\\.pdf$; i)) | \(.body.attachmentId)|\(.filename) | head -1) ATTACHID=$(echo $ATTACHINFO | cut -d| -f1) FILENAME=$(echo $ATTACH_INFO | cut -d| -f2)

下载

gog gmail attachment $MSGID $ATTACHID --out /tmp/invoices/$FILENAME

对于没有PDF的邮件(截图):
bash
MSGID=id_here>

提取HTML

gog gmail read $MSG_ID --json | node -e const fs = require(fs); let data = ; process.stdin.on(data, chunk => data += chunk); process.stdin.on(end, () => { const json = JSON.parse(data); const msg = json.thread.messages[0]; let html = ; const findHtml = (p) => { if (p.mimeType === text/html && p.body?.data) { html = Buffer.from(p.body.data, base64).toString(utf-8); } if (p.parts) p.parts.forEach(findHtml); }; (msg.payload.parts || []).forEach(findHtml); if (!html && msg.payload.body?.data) { html = Buffer.from(msg.payload.body.data, base64).toString(utf-8); } fs.writeFileSync(/tmp/invoices/email.html, html || No content); });

截图

node -e const puppeteer = require(puppeteer); const fs = require(fs); (async () => { const browser = await puppeteer.launch({ headless: new, args: [--no-sandbox] }); const page = await browser.newPage(); await page.setViewport({ width: 800, height: 1200 }); await page.setContent(fs.readFileSync(/tmp/invoices/email.html, utf-8), { waitUntil: networkidle0 }); await page.screenshot({ path: /tmp/invoices/receipt.png, fullPage: true }); await browser.close(); })();

步骤3:提取发票信息

解析邮件以获取发件人、日期、金额:
bash

从邮件获取基本信息


gog gmail read $MSG_ID --json | jq {
from: .thread.messages[0].payload.headers[] | select(.name==From) | .value,
subject: .thread.messages[0].payload.headers[] | select(.name==Subject) | .value,
date: .thread.messages[0].payload.headers[] | select(.name==Date) | .value
}

步骤4:发送摘要邮件

bash
gog gmail send \
--to recipient@example.com \
--subject 【$(date +%Y年%m月)】請求書まとめ \
--body 請求書・領収書を添付します。

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 請求書まとめ
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

【添付ファイル】

  1. 1. Invoice-001.pdf - Service A
  2. Receipt.png - Service B (メールスクショ)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

このメールは自動生成されました。
\
--attach /tmp/invoices/Invoice-001.pdf \
--attach /tmp/invoices/Receipt.png



示例提示

通用:

  • - 先月の請求書を全部集めてまとめて送って
  • invoiceで検索して今月届いた請求書をkeiri@company.comに転送して
  • has:attachment receipt で検索して請求書集めて

特定:

  • - AnthropicとVercelとAWSの請求書を集めて
  • from:stripe の請求書を過去3ヶ月分まとめて



提示

  • - 日期格式:gog搜索使用YYYY/MM/DD
  • PDF优先:始终优先选择PDF附件而非截图
  • 日文字体:正确渲染日文邮件所需
  • 清理:发送后执行rm -rf /tmp/invoices
  • 定时任务:设置月度cron作业进行定期收集

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 invoice-collector-1776420060 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 invoice-collector-1776420060 技能

通过命令行安装

skillhub install invoice-collector-1776420060

下载

⬇ 下载 invoice-collector v1.2.0(免费)

文件大小: 6.08 KB | 发布时间: 2026-4-17 19:30

v1.2.0 最新 2026-4-17 19:30
Added Security Considerations section explaining --no-sandbox requirement and safer installation alternatives

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large