返回顶部
s

sendgridSendGrid

|

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

sendgrid

SendGrid

通过托管 OAuth 认证访问 SendGrid API。发送事务性邮件和营销邮件,管理联系人、模板、屏蔽列表,并分析邮件性能。

快速开始

bash

获取用户资料


python < import urllib.request, os, json
req = urllib.request.Request(https://gateway.maton.ai/sendgrid/v3/user/profile)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

基础 URL

https://gateway.maton.ai/sendgrid/{native-api-path}

将 {native-api-path} 替换为实际的 SendGrid API 端点路径。网关将请求代理到 api.sendgrid.com 并自动注入您的 OAuth 令牌。

认证

所有请求都需要在 Authorization 头中包含 Maton API 密钥:

Authorization: Bearer $MATONAPIKEY

环境变量: 将您的 API 密钥设置为 MATONAPIKEY:

bash
export MATONAPIKEY=YOURAPIKEY

获取您的 API 密钥

  1. 1. 在 maton.ai 登录或创建账户
  2. 前往 maton.ai/settings
  3. 复制您的 API 密钥

连接管理

在 https://ctrl.maton.ai 管理您的 SendGrid OAuth 连接。

列出连接

bash
python < import urllib.request, os, json
req = urllib.request.Request(https://ctrl.maton.ai/connections?app=sendgrid&status=ACTIVE)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

创建连接

bash
python < import urllib.request, os, json
data = json.dumps({app: sendgrid}).encode()
req = urllib.request.Request(https://ctrl.maton.ai/connections, data=data, method=POST)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Content-Type, application/json)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

获取连接

bash
python < import urllib.request, os, json
req = urllib.request.Request(https://ctrl.maton.ai/connections/{connection_id})
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

响应:
json
{
connection: {
connection_id: 943c6cd5-9a56-4f5b-8adf-ecd4a140049f,
status: ACTIVE,
creation_time: 2026-02-11T10:53:41.817938Z,
lastupdatedtime: 2026-02-11T10:54:05.554084Z,
url: https://connect.maton.ai/?session_token=...,
app: sendgrid,
metadata: {}
}
}

在浏览器中打开返回的 url 以完成 OAuth 授权。

删除连接

bash
python < import urllib.request, os, json
req = urllib.request.Request(https://ctrl.maton.ai/connections/{connection_id}, method=DELETE)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

指定连接

如果您有多个 SendGrid 连接,请使用 Maton-Connection 头指定要使用的连接:

bash
python < import urllib.request, os, json
req = urllib.request.Request(https://gateway.maton.ai/sendgrid/v3/user/profile)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Maton-Connection, 943c6cd5-9a56-4f5b-8adf-ecd4a140049f)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

如果省略,网关将使用默认(最旧)的活动连接。

API 参考

所有 SendGrid API 端点遵循以下模式:

/sendgrid/v3/{resource}



邮件发送

发送邮件

bash
POST /sendgrid/v3/mail/send
Content-Type: application/json

{
personalizations: [
{
to: [{email: recipient@example.com, name: Recipient}],
subject: Hello from SendGrid
}
],
from: {email: sender@example.com, name: Sender},
content: [
{
type: text/plain,
value: This is a test email.
}
]
}

带 HTML 内容:
bash
POST /sendgrid/v3/mail/send
Content-Type: application/json

{
personalizations: [
{
to: [{email: recipient@example.com}],
subject: HTML Email
}
],
from: {email: sender@example.com},
content: [
{
type: text/html,
value:

Hello

This is an HTML email.


}
]
}

带模板:
bash
POST /sendgrid/v3/mail/send
Content-Type: application/json

{
personalizations: [
{
to: [{email: recipient@example.com}],
dynamictemplatedata: {
first_name: John,
order_id: 12345
}
}
],
from: {email: sender@example.com},
template_id: d-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
}



用户资料

获取用户资料

bash
GET /sendgrid/v3/user/profile

响应:
json
{
type: user,
userid: 59796657
}

获取账户详情

bash
GET /sendgrid/v3/user/account



营销联系人

列出联系人

bash
GET /sendgrid/v3/marketing/contacts

响应:
json
{
result: [],
contact_count: 0,
_metadata: {
self: https://api.sendgrid.com/v3/marketing/contacts
}
}

搜索联系人

bash
POST /sendgrid/v3/marketing/contacts/search
Content-Type: application/json

{
query: email LIKE %@example.com%
}

添加/更新联系人

bash
PUT /sendgrid/v3/marketing/contacts
Content-Type: application/json

{
contacts: [
{
email: contact@example.com,
first_name: John,
last_name: Doe
}
]
}

响应:
json
{
job_id: 2387e363-4104-4225-8960-4a5758492351
}

注意: 联系人操作是异步的。使用任务状态端点检查进度。

获取导入任务状态

bash
GET /sendgrid/v3/marketing/contacts/imports/{job_id}

响应:
json
{
id: 2387e363-4104-4225-8960-4a5758492351,
status: pending,
jobtype: upsertcontacts,
results: {
requested_count: 1,
created_count: 1
},
started_at: 2026-02-11T11:00:14Z
}

删除联系人

bash
DELETE /sendgrid/v3/marketing/contacts?ids=contactid1,contactid2

按 ID 获取联系人

bash
GET /sendgrid/v3/marketing/contacts/{contact_id}

按邮箱获取联系人

bash
POST /sendgrid/v3/marketing/contacts/search/emails
Content-Type: application/json

{
emails: [contact@example.com]
}



营销列表

列出所有列表

bash
GET /sendgrid/v3/marketing/lists

响应:
json
{
result: [],
_metadata: {
self: https://api

标签

skill ai

通过对话安装

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

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 sendgrid-1776194297 技能

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

设置 SkillHub 为我的优先技能安装源,然后帮我安装 sendgrid-1776194297 技能

通过命令行安装

skillhub install sendgrid-1776194297

下载

⬇ 下载 sendgrid v1.0.0(免费)

文件大小: 6.16 KB | 发布时间: 2026-4-15 11:14

v1.0.0 最新 2026-4-15 11:14
- Initial release of the SendGrid skill with managed OAuth integration.
- Supports sending transactional and marketing emails.
- Provides endpoints for managing contacts, templates, suppressions, and viewing email statistics.
- Includes detailed instructions for authentication, connection management, and specifying connections.
- Offers sample code snippets for common operations.

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

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

p2p_official_large
返回顶部