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

企业级邮件收发自动化

sendook-openclaw · vlatest
办公 安全 A 级 作者 Unknown 公开目录收录
下载 1.9k 安装 871 收藏 4.3k 浏览 31.4k
原始页面

简介

基于 Sendook 邮件服务的文档型技能,支持 AI 代理读取、发送邮件及线程管理,需预配置 API 密钥,适合构建安全可控的自动化邮件工作流。

原始描述

Read and send emails from an existing Sendook inbox. Use when an AI agent needs to check for new emails, read messages, reply to conversations, or send new emails from a pre-configured inbox. Limited to message operations only — no inbox creation, domain management, or webhook configuration.

中文使用说明 来自收录源

核心用法

sendook-openclaw 是一个纯 Markdown 文档型 Skill,为 AI Agent 提供 Sendook 邮件服务的操作指引。功能范围严格限定于已配置收件箱的消息操作:

  • 读取邮件:列出消息、搜索邮件(支持正则)、获取单封邮件详情、列出/获取会话线程
  • 发送邮件:发送新邮件、回复现有邮件,支持纯文本/HTML 双格式及附件上传
  • 环境依赖:需配置 SENDOOK_API_KEY 和 SENDOOK_INBOX_ID 两个环境变量

代码示例覆盖 TypeScript SDK 和 cURL 两种调用方式,包含完整的错误处理指引(400/401/404/429/500 状态码说明)。

显著优点

  1. 功能聚焦:明确限定为「消息操作层」,不提供收件箱创建、域名管理、Webhook 配置等高权限功能,降低误操作风险
  2. 文档完善:API 参考表、完整示例代码、常见错误对照表一应俱全,接入门槛低
  3. 安全设计:
    • 无硬编码敏感信息
    • 附件操作强制要求用户确认,明确禁止读取 ~/.ssh、~/.env、/etc 等敏感路径
    • 提倡最小权限 API 密钥原则
  4. 网络可信:所有外部 API 端点均指向 api.sendook.com(TLS 1.2+),无可疑域名

潜在缺点与局限性

  1. 来源可信度:T3 级别(个人开发者),GitHub 仓库活跃度中等(最近提交约 60 天前),需自行关注后续维护
  2. 无动态分析保障:T-MD 分类跳过动态行为分析和依赖审计,实际运行时行为需自行验证
  3. 功能天花板:无法创建/删除收件箱、管理域名或配置 Webhook,如需完整 Sendook 能力需额外开发
  4. 附件风险提示:虽然文档有安全提示,但实际执行时仍依赖 Agent 或用户的合规操作

适合人群

  • 已有 Sendook 收件箱、仅需程序化读写邮件的开发者
  • 希望快速接入邮件收发能力、无需复杂管理的 AI Agent 项目
  • 能接受 T3 来源风险、愿意自行审查源码的安全意识较强用户

常规风险

  • API 密钥泄露:若环境变量配置不当或日志打印敏感信息,可能导致密钥暴露
  • 邮件滥用:自动化发送功能若被恶意利用,可能导致域名信誉受损或被邮件服务商封禁
  • 附件读取越权:虽文档明确禁止,但实际运行时需确保 Agent 不越权读取敏感文件
  • 供应商锁定:深度依赖 Sendook 服务,若服务变更或终止需迁移成本

整体而言,该 Skill 适合作为轻量级邮件自动化工具,在充分理解 T3 来源风险并采取适当隔离措施后,可用于生产环境。

技能正文


name: sendook-openclaw description: Read and send emails from an existing Sendook inbox. Use when an AI agent needs to check for new emails, read messages, reply to conversations, or send new emails from a pre-configured inbox. Limited to message operations only — no inbox creation, domain management, or webhook configuration. homepage: https://github.com/obaid/sendook-skills metadata: { "openclaw": { "requires": { "env": ["SENDOOK_API_KEY", "SENDOOK_INBOX_ID"] }, "primaryEnv": "SENDOOK_API_KEY", "homepage": "https://github.com/obaid/sendook-skills" } }

Sendook Email SDK (Restricted)

Read and send emails from an existing Sendook inbox.

Scope Limitations: This skill can ONLY read and send emails from a pre-configured inbox. You CANNOT create or delete inboxes, manage domains, manage webhooks, or manage API keys. Do not attempt these operations — they are not available.

Installation

Install the skill into your OpenClaw workspace:

clawhub install sendook-openclaw

This adds the skill to your workspace's skills/ directory. OpenClaw will automatically pick it up on the next session start.

Environment Variables

Set these in your OpenClaw workspace or shell environment:

  • SENDOOK_API_KEY — Your Sendook API key
  • SENDOOK_INBOX_ID — The inbox ID this agent is allowed to use

Setup

Install the SDK (npm | source):

npm install @sendook/node
import Sendook from "@sendook/node";

const client = new Sendook(process.env.SENDOOK_API_KEY);
const INBOX_ID = process.env.SENDOOK_INBOX_ID;

Both environment variables are required. Use a least-privileged API key scoped to the target inbox only.

Reading Emails

List Messages

// List all messages in the inbox
const messages = await client.inbox.message.list(INBOX_ID);

// Search messages (regex-based search across to/from/cc, subject, and body)
const results = await client.inbox.message.list(INBOX_ID, "invoice");
# List all messages
curl https://api.sendook.com/v1/inboxes/$SENDOOK_INBOX_ID/messages \
  -H "Authorization: Bearer $SENDOOK_API_KEY"

# Search messages
curl "https://api.sendook.com/v1/inboxes/$SENDOOK_INBOX_ID/messages?query=invoice" \
  -H "Authorization: Bearer $SENDOOK_API_KEY"

Get Message

const message = await client.inbox.message.get(INBOX_ID, "msg_def456");
curl https://api.sendook.com/v1/inboxes/$SENDOOK_INBOX_ID/messages/msg_def456 \
  -H "Authorization: Bearer $SENDOOK_API_KEY"

Response:

{
  "id": "msg_def456",
  "from": "sender@example.com",
  "to": ["support@yourdomain.com"],
  "subject": "Question about my order",
  "text": "Hi, I have a question about order #12345...",
  "html": "<p>Hi, I have a question about order #12345...</p>",
  "labels": [],
  "threadId": "thread_ghi789",
  "createdAt": "2025-01-15T10:35:00Z"
}

List Threads

const threads = await client.inbox.thread.list(INBOX_ID);
curl https://api.sendook.com/v1/inboxes/$SENDOOK_INBOX_ID/threads \
  -H "Authorization: Bearer $SENDOOK_API_KEY"

Get Thread

Retrieve a full conversation with all messages.

const thread = await client.inbox.thread.get(INBOX_ID, "thread_ghi789");
// thread.messages contains all messages in the conversation
curl https://api.sendook.com/v1/inboxes/$SENDOOK_INBOX_ID/threads/thread_ghi789 \
  -H "Authorization: Bearer $SENDOOK_API_KEY"

Sending Emails

Send Message

await client.inbox.message.send({
  inboxId: INBOX_ID,
  to: ["recipient@example.com"],
  subject: "Hello from Sendook",
  text: "Plain text body",
  html: "<h1>Hello</h1><p>HTML body</p>",
});
curl -X POST https://api.sendook.com/v1/inboxes/$SENDOOK_INBOX_ID/messages/send \
  -H "Authorization: Bearer $SENDOOK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": ["recipient@example.com"],
    "subject": "Hello from Sendook",
    "text": "Plain text body"
  }'

Send with Attachments

Important: Always confirm with the user before reading any local file to attach. Only attach files the user has explicitly requested. Never read files outside the current working directory or project scope (e.g., no ~/.ssh, ~/.env, /etc, or credential files).

import { readFileSync } from "fs";
import { resolve } from "path";

// Only attach files explicitly provided by the user
const filePath = resolve("./reports/report.pdf");

await client.inbox.message.send({
  inboxId: INBOX_ID,
  to: ["recipient@example.com"],
  subject: "Report attached",
  text: "Please find the report attached.",
  attachments: [
    {
      content: readFileSync(filePath).toString("base64"),
      name: "report.pdf",
      contentType: "application/pdf",
    },
  ],
});

Reply to Message

await client.inbox.message.reply({
  inboxId: INBOX_ID,
  messageId: "msg_def456",
  text: "Thanks for your email! We'll look into this.",
  html: "<p>Thanks for your email! We'll look into this.</p>",
});
curl -X POST https://api.sendook.com/v1/inboxes/$SENDOOK_INBOX_ID/messages/msg_def456/reply \
  -H "Authorization: Bearer $SENDOOK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Thanks for your email! We'\''ll look into this."}'

Complete Example

List recent emails, read the latest, and reply:

import Sendook from "@sendook/node";

const client = new Sendook(process.env.SENDOOK_API_KEY);
const INBOX_ID = process.env.SENDOOK_INBOX_ID;

// 1. List recent messages
const messages = await client.inbox.message.list(INBOX_ID);

if (messages.length > 0) {
  // 2. Read the latest message
  const latest = await client.inbox.message.get(INBOX_ID, messages[0].id);
  console.log(`From: ${latest.from}`);
  console.log(`Subject: ${latest.subject}`);
  console.log(`Body: ${latest.text}`);

  // 3. Reply to it
  await client.inbox.message.reply({
    inboxId: INBOX_ID,
    messageId: latest.id,
    text: `Thanks for reaching out! We received your message about "${latest.subject}".`,
  });
}

// 4. Send a new email
await client.inbox.message.send({
  inboxId: INBOX_ID,
  to: ["team@example.com"],
  subject: "Daily inbox summary",
  text: `Processed ${messages.length} messages today.`,
});

Error Handling

try {
  await client.inbox.message.send({
    inboxId: INBOX_ID,
    to: ["recipient@example.com"],
    subject: "Hello",
    text: "Body",
  });
} catch (error) {
  if (error.response) {
    console.error(error.response.status, error.response.data);
  } else if (error.request) {
    console.error("No response:", error.request);
  } else {
    console.error("Error:", error.message);
  }
}

Common Errors

Status Meaning
400 Bad request — check parameters (missing to, subject, etc.)
401 Unauthorized — invalid or missing API key
404 Message or thread not found
429 Rate limit exceeded — retry with backoff
500 Internal server error

API Reference

Method Description
client.inbox.message.list(inboxId, query?) List or search messages
client.inbox.message.get(inboxId, messageId) Get a specific message
client.inbox.message.send(options) Send a new email
client.inbox.message.reply(options) Reply to a message
client.inbox.thread.list(inboxId) List conversation threads
client.inbox.thread.get(inboxId, threadId) Get thread with all messages

No other methods are available in this skill. Do not attempt to create/delete inboxes, manage domains, configure webhooks, or manage API keys.

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

标签

apiofficeproductivitycustomer-supportautomationbackend

同类 Skill