企业级邮件营销安全网关
简介
基于 Maton 网关的 Brevo API 集成方案,支持邮件营销、事务性邮件、联系人管理及 CRM 功能,采用托管 OAuth 实现安全认证。
原始描述
Brevo (formerly Sendinblue) email marketing API for managing contacts, lists, sending transactional emails, and campaigns. Use when importing contacts, sending emails, managing subscriptions, or working with email automation.
通过你的 Agent 添加
安装目录:brevo/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
Brevo(原 Sendinblue)是一款企业级邮件营销与 CRM 平台,本 Skill 通过 Maton 网关 提供托管 OAuth 接入,无需直接管理 Brevo API 密钥。核心功能覆盖四大模块:
- 联系人管理 —— 创建/更新/删除联系人,管理列表与分组,支持自定义属性
- 事务邮件 —— 发送单封或批量邮件,支持模板渲染、附件、定时发送
- 营销战役 —— 创建经典/触发式邮件活动,管理草稿与发送状态
- 模板引擎 —— 预置 HTML 模板,使用
{{params.name}}语法进行变量替换
快速接入示例
import os, requests
headers = {'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
# 发送事务邮件
requests.post(
'https://gateway.maton.ai/brevo/v3/smtp/email',
headers=headers,
json={
'sender': {'name': 'Acme', 'email': 'noreply@acme.com'},
'to': [{'email': 'user@example.com'}],
'subject': 'Welcome!',
'htmlContent': '<h1>Hello!</h1>'
}
)
OAuth 连接管理
- 在
https://ctrl.maton.ai 创建/查看 Brevo 连接
- 通过返回的
url 完成浏览器授权
- 多账户场景使用
Maton-Connection 头部指定连接 ID
显著优点
- 零配置 OAuth:无需自建 OAuth 回调服务器,Maton 托管完成授权流程
- 统一网关:单点
gateway.maton.ai 代理所有 Brevo v3 API,路径结构与官方保持一致
- 多语言示例:提供 Python (urllib/requests)、JavaScript (fetch)、bash 等即拷即用代码
- 完整功能覆盖:涵盖账户、联系人、列表、文件夹、属性、事务邮件、模板、战役、发件人、黑名单等全量接口
- 批量操作友好:支持通过
emails 数组批量增删列表成员,分页参数透明
潜在缺点与局限性
维度
说明
网关依赖
流量经过 Maton 第三方代理,非直连 Brevo 官方 api.brevo.com,存在额外的信任边界与延迟
单点密钥
所有功能依赖单一 MATON_API_KEY,密钥泄露即导致全功能暴露
速率限制
受 Brevo 官方限制(免费版 300 次/分钟),网关层可能叠加额外限流
模板锁定
模板参数语法 {{params.name}} 为 Brevo 专有,迁移成本高
调试受限
网关层可能隐藏原始 HTTP 响应细节,错误排查需依赖网关日志
适合人群
- 快速原型团队:希望 5 分钟内跑通邮件发送,不愿处理 OAuth 配置
- 低代码运营:市场/运营人员通过脚本自动化邮件列表管理
- 多账户管理:需要同时操作多个 Brevo 子账户,通过 Connection ID 隔离
- 轻量集成场景:CRM 数据同步、用户欢迎邮件、定期报告推送等非高频关键业务
import os, requests
headers = {'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
# 发送事务邮件
requests.post(
'https://gateway.maton.ai/brevo/v3/smtp/email',
headers=headers,
json={
'sender': {'name': 'Acme', 'email': 'noreply@acme.com'},
'to': [{'email': 'user@example.com'}],
'subject': 'Welcome!',
'htmlContent': '<h1>Hello!</h1>'
}
)
- 在
https://ctrl.maton.ai创建/查看 Brevo 连接 - 通过返回的
url完成浏览器授权 - 多账户场景使用
Maton-Connection头部指定连接 ID
显著优点
- 零配置 OAuth:无需自建 OAuth 回调服务器,Maton 托管完成授权流程
- 统一网关:单点
gateway.maton.ai 代理所有 Brevo v3 API,路径结构与官方保持一致
- 多语言示例:提供 Python (urllib/requests)、JavaScript (fetch)、bash 等即拷即用代码
- 完整功能覆盖:涵盖账户、联系人、列表、文件夹、属性、事务邮件、模板、战役、发件人、黑名单等全量接口
- 批量操作友好:支持通过
emails 数组批量增删列表成员,分页参数透明
潜在缺点与局限性
维度
说明
网关依赖
流量经过 Maton 第三方代理,非直连 Brevo 官方 api.brevo.com,存在额外的信任边界与延迟
单点密钥
所有功能依赖单一 MATON_API_KEY,密钥泄露即导致全功能暴露
速率限制
受 Brevo 官方限制(免费版 300 次/分钟),网关层可能叠加额外限流
模板锁定
模板参数语法 {{params.name}} 为 Brevo 专有,迁移成本高
调试受限
网关层可能隐藏原始 HTTP 响应细节,错误排查需依赖网关日志
适合人群
- 快速原型团队:希望 5 分钟内跑通邮件发送,不愿处理 OAuth 配置
- 低代码运营:市场/运营人员通过脚本自动化邮件列表管理
- 多账户管理:需要同时操作多个 Brevo 子账户,通过 Connection ID 隔离
- 轻量集成场景:CRM 数据同步、用户欢迎邮件、定期报告推送等非高频关键业务
gateway.maton.ai 代理所有 Brevo v3 API,路径结构与官方保持一致emails 数组批量增删列表成员,分页参数透明| 维度 | 说明 |
|---|---|
| 网关依赖 | 流量经过 Maton 第三方代理,非直连 Brevo 官方 api.brevo.com,存在额外的信任边界与延迟 |
| 单点密钥 | 所有功能依赖单一 MATON_API_KEY,密钥泄露即导致全功能暴露 |
| 速率限制 | 受 Brevo 官方限制(免费版 300 次/分钟),网关层可能叠加额外限流 |
| 模板锁定 | 模板参数语法 {{params.name}} 为 Brevo 专有,迁移成本高 |
| 调试受限 | 网关层可能隐藏原始 HTTP 响应细节,错误排查需依赖网关日志 |
适合人群
- 快速原型团队:希望 5 分钟内跑通邮件发送,不愿处理 OAuth 配置
- 低代码运营:市场/运营人员通过脚本自动化邮件列表管理
- 多账户管理:需要同时操作多个 Brevo 子账户,通过 Connection ID 隔离
- 轻量集成场景:CRM 数据同步、用户欢迎邮件、定期报告推送等非高频关键业务
不适用场景:
- 金融级数据隔离要求(需直连官方 API)
- 超大规模发送(日均百万级,需专用 IP 与发送池)
- 深度自定义 SMTP 行为(网关抽象层限制底层控制)
常规风险
- 第三方网关风险:Maton 服务若遭受攻击或变更策略,可能导致服务中断或数据暴露。建议定期审查
maton.ai 隐私政策。
- OAuth 授权范围:通过
connect.maton.ai 授权时,确认授权范围最小化,避免过度授予账户管理权限。
- 环境变量泄露:
MATON_API_KEY 若被提交至 GitHub 或打印在日志中,将导致未授权访问。建议使用专用密钥管理工具。
- 发送信誉风险:高频邮件发送若未配置退订与 bounce 处理,可能导致域名/IP 被 Brevo 列入黑名单。
- 数据驻留合规:联系人数据经 Maton 网关中转,需确认是否符合 GDPR、CCPA 等数据跨境传输要求。
maton.ai 隐私政策。connect.maton.ai 授权时,确认授权范围最小化,避免过度授予账户管理权限。MATON_API_KEY 若被提交至 GitHub 或打印在日志中,将导致未授权访问。建议使用专用密钥管理工具。安全认证:S 级(纯 Markdown 文档,无危险代码,依赖外部网关需用户自行评估信任链)
技能正文
name: brevo
description: |
Brevo API integration with managed OAuth. Email marketing, transactional emails, SMS, contacts, and CRM.
Use this skill when users want to send emails, manage contacts, create campaigns, or work with Brevo lists and templates.
For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
Requires network access and valid Maton API key.
metadata:
author: maton
version: "1.0"
clawdbot:
emoji: 🧠
requires:
env:
- MATON_API_KEY
Brevo
Access the Brevo API with managed OAuth authentication. Send transactional emails, manage contacts and lists, create email campaigns, and work with templates.
Quick Start
# Get account info
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/brevo/v3/account')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Base URL
https://gateway.maton.ai/brevo/v3/{resource}
# Get account info
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/brevo/v3/account')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
https://gateway.maton.ai/brevo/v3/{resource}
The gateway proxies requests to api.brevo.com and automatically injects your OAuth token.
Authentication
All requests require the Maton API key in the Authorization header:
Authorization: Bearer $MATON_API_KEY
Environment Variable: Set your API key as MATON_API_KEY:
export MATON_API_KEY="YOUR_API_KEY"
Getting Your API Key
- Sign in or create an account at maton.ai
- Go to maton.ai/settings
- Copy your API key
Connection Management
Manage your Brevo OAuth connections at https://ctrl.maton.ai.
List Connections
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=brevo&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Create Connection
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'brevo'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Get Connection
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=brevo&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'brevo'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Get Connection
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Response:
{
"connection": {
"connection_id": "b04dd695-d056-433b-baf9-0fb4eb3bde9e",
"status": "ACTIVE",
"creation_time": "2026-02-09T19:51:00.932629Z",
"last_updated_time": "2026-02-09T19:51:30.123456Z",
"url": "https://connect.maton.ai/?session_token=...",
"app": "brevo",
"metadata": {}
}
}
Open the returned url in a browser to complete OAuth authorization.
Delete Connection
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Specifying Connection
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
If you have multiple Brevo connections, specify which one to use with the Maton-Connection header:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/brevo/v3/account')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', 'b04dd695-d056-433b-baf9-0fb4eb3bde9e')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
If omitted, the gateway uses the default (oldest) active connection.
API Reference
Account
Get Account Info
GET /brevo/v3/account
GET /brevo/v3/account
Response:
{
"email": "user@example.com",
"firstName": "John",
"lastName": "Doe",
"companyName": "Acme Inc",
"relay": {
"enabled": true,
"data": {
"userName": "user@smtp-brevo.com",
"relay": "smtp-relay.brevo.com",
"port": 587
}
}
}
Contacts
List Contacts
GET /brevo/v3/contacts
Query Parameters:
limit- Number of results per page (default: 50, max: 500)offset- Index of first result (0-based)modifiedSince- Filter by modification date (ISO 8601)
Response:
{
"contacts": [
{
"id": 1,
"email": "contact@example.com",
"emailBlacklisted": false,
"smsBlacklisted": false,
"createdAt": "2026-02-09T20:33:59.705+01:00",
"modifiedAt": "2026-02-09T20:35:19.529+01:00",
"listIds": [2],
"attributes": {
"FIRSTNAME": "John",
"LASTNAME": "Doe"
}
}
],
"count": 1
}
Get Contact
GET /brevo/v3/contacts/{identifier}
GET /brevo/v3/contacts/{identifier}
The identifier can be email address, phone number, or contact ID.
Query Parameters:
identifierType- Type of identifier:email_id,phone_id,contact_id,ext_id
Create Contact
POST /brevo/v3/contacts
Content-Type: application/json
{
"email": "newcontact@example.com",
"attributes": {
"FIRSTNAME": "Jane",
"LASTNAME": "Smith"
},
"listIds": [2],
"updateEnabled": false
}
POST /brevo/v3/contacts
Content-Type: application/json
{
"email": "newcontact@example.com",
"attributes": {
"FIRSTNAME": "Jane",
"LASTNAME": "Smith"
},
"listIds": [2],
"updateEnabled": false
}
Response:
{
"id": 2
}
Set updateEnabled: true to update the contact if it already exists.
Update Contact
PUT /brevo/v3/contacts/{identifier}
Content-Type: application/json
{
"attributes": {
"FIRSTNAME": "Updated",
"LASTNAME": "Name"
}
}
PUT /brevo/v3/contacts/{identifier}
Content-Type: application/json
{
"attributes": {
"FIRSTNAME": "Updated",
"LASTNAME": "Name"
}
}
Returns 204 No Content on success.
Delete Contact
DELETE /brevo/v3/contacts/{identifier}
DELETE /brevo/v3/contacts/{identifier}
Returns 204 No Content on success.
Get Contact Campaign Stats
GET /brevo/v3/contacts/{identifier}/campaignStats
Lists
List All Lists
GET /brevo/v3/contacts/lists
GET /brevo/v3/contacts/{identifier}/campaignStats
List All Lists
GET /brevo/v3/contacts/lists
Response:
{
"lists": [
{
"id": 2,
"name": "Newsletter Subscribers",
"folderId": 1,
"uniqueSubscribers": 150,
"totalBlacklisted": 2,
"totalSubscribers": 148
}
],
"count": 1
}
Get List
GET /brevo/v3/contacts/lists/{listId}
Create List
POST /brevo/v3/contacts/lists
Content-Type: application/json
{
"name": "New List",
"folderId": 1
}
GET /brevo/v3/contacts/lists/{listId}
POST /brevo/v3/contacts/lists
Content-Type: application/json
{
"name": "New List",
"folderId": 1
}
Response:
{
"id": 3
}
Update List
PUT /brevo/v3/contacts/lists/{listId}
Content-Type: application/json
{
"name": "Updated List Name"
}
PUT /brevo/v3/contacts/lists/{listId}
Content-Type: application/json
{
"name": "Updated List Name"
}
Returns 204 No Content on success.
Delete List
DELETE /brevo/v3/contacts/lists/{listId}
DELETE /brevo/v3/contacts/lists/{listId}
Returns 204 No Content on success.
Get Contacts in List
GET /brevo/v3/contacts/lists/{listId}/contacts
Add Contacts to List
POST /brevo/v3/contacts/lists/{listId}/contacts/add
Content-Type: application/json
{
"emails": ["contact1@example.com", "contact2@example.com"]
}
Remove Contacts from List
POST /brevo/v3/contacts/lists/{listId}/contacts/remove
Content-Type: application/json
{
"emails": ["contact1@example.com"]
}
Folders
List Folders
GET /brevo/v3/contacts/folders
GET /brevo/v3/contacts/lists/{listId}/contacts
POST /brevo/v3/contacts/lists/{listId}/contacts/add
Content-Type: application/json
{
"emails": ["contact1@example.com", "contact2@example.com"]
}
Remove Contacts from List
POST /brevo/v3/contacts/lists/{listId}/contacts/remove
Content-Type: application/json
{
"emails": ["contact1@example.com"]
}
Folders
List Folders
GET /brevo/v3/contacts/folders
POST /brevo/v3/contacts/lists/{listId}/contacts/remove
Content-Type: application/json
{
"emails": ["contact1@example.com"]
}
List Folders
GET /brevo/v3/contacts/folders
Response:
{
"folders": [
{
"id": 1,
"name": "Marketing",
"uniqueSubscribers": 500,
"totalSubscribers": 480,
"totalBlacklisted": 20
}
],
"count": 1
}
Get Folder
GET /brevo/v3/contacts/folders/{folderId}
Create Folder
POST /brevo/v3/contacts/folders
Content-Type: application/json
{
"name": "New Folder"
}
GET /brevo/v3/contacts/folders/{folderId}
POST /brevo/v3/contacts/folders
Content-Type: application/json
{
"name": "New Folder"
}
Response:
{
"id": 4
}
Update Folder
PUT /brevo/v3/contacts/folders/{folderId}
Content-Type: application/json
{
"name": "Renamed Folder"
}
PUT /brevo/v3/contacts/folders/{folderId}
Content-Type: application/json
{
"name": "Renamed Folder"
}
Returns 204 No Content on success.
Delete Folder
DELETE /brevo/v3/contacts/folders/{folderId}
DELETE /brevo/v3/contacts/folders/{folderId}
Deletes folder and all lists within it. Returns 204 No Content on success.
Get Lists in Folder
GET /brevo/v3/contacts/folders/{folderId}/lists
Attributes
List Attributes
GET /brevo/v3/contacts/attributes
GET /brevo/v3/contacts/folders/{folderId}/lists
List Attributes
GET /brevo/v3/contacts/attributes
Response:
{
"attributes": [
{
"name": "FIRSTNAME",
"category": "normal",
"type": "text"
},
{
"name": "LASTNAME",
"category": "normal",
"type": "text"
}
]
}
Create Attribute
POST /brevo/v3/contacts/attributes/{category}/{attributeName}
Content-Type: application/json
{
"type": "text"
}
POST /brevo/v3/contacts/attributes/{category}/{attributeName}
Content-Type: application/json
{
"type": "text"
}
Categories: normal, transactional, category, calculated, global
Update Attribute
PUT /brevo/v3/contacts/attributes/{category}/{attributeName}
Content-Type: application/json
{
"value": "new value"
}
Delete Attribute
DELETE /brevo/v3/contacts/attributes/{category}/{attributeName}
Transactional Emails
Send Email
POST /brevo/v3/smtp/email
Content-Type: application/json
{
"sender": {
"name": "John Doe",
"email": "john@example.com"
},
"to": [
{
"email": "recipient@example.com",
"name": "Jane Smith"
}
],
"subject": "Welcome!",
"htmlContent": "<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>"
}
PUT /brevo/v3/contacts/attributes/{category}/{attributeName}
Content-Type: application/json
{
"value": "new value"
}
DELETE /brevo/v3/contacts/attributes/{category}/{attributeName}
Transactional Emails
Send Email
POST /brevo/v3/smtp/email
Content-Type: application/json
{
"sender": {
"name": "John Doe",
"email": "john@example.com"
},
"to": [
{
"email": "recipient@example.com",
"name": "Jane Smith"
}
],
"subject": "Welcome!",
"htmlContent": "<html><body><h1>Hello!</h1><p>Welcome to our service.</p></body></html>"
}
Response:
{
"messageId": "<202602092329.12910305853@smtp-relay.mailin.fr>"
}
Optional Parameters:
cc- Carbon copy recipientsbcc- Blind carbon copy recipientsreplyTo- Reply-to addresstextContent- Plain text versiontemplateId- Use a template instead of htmlContentparams- Template parametersattachment- File attachmentsheaders- Custom headerstags- Email tags for trackingscheduledAt- Schedule for later (ISO 8601)
Get Transactional Emails
GET /brevo/v3/smtp/emails
GET /brevo/v3/smtp/emails
Query Parameters:
email- Filter by recipient emailtemplateId- Filter by templatemessageId- Filter by message IDstartDate- Start date (YYYY-MM-DD)endDate- End date (YYYY-MM-DD)limit- Results per pageoffset- Starting index
Delete Scheduled Email
DELETE /brevo/v3/smtp/email/{identifier}
DELETE /brevo/v3/smtp/email/{identifier}
The identifier can be a messageId or batchId.
Get Email Statistics
GET /brevo/v3/smtp/statistics/events
GET /brevo/v3/smtp/statistics/events
Query Parameters:
limit- Results per pageoffset- Starting indexstartDate- Start dateendDate- End dateemail- Filter by recipientevent- Filter by event type:delivered,opened,clicked,bounced, etc.
Email Templates
List Templates
GET /brevo/v3/smtp/templates
Response:
{
"count": 1,
"templates": [
{
"id": 1,
"name": "Welcome Email",
"subject": "Welcome {{params.name}}!",
"isActive": true,
"sender": {
"name": "Company",
"email": "noreply@company.com"
},
"htmlContent": "<html>...</html>",
"createdAt": "2026-02-09 23:29:38",
"modifiedAt": "2026-02-09 23:29:38"
}
]
}
Get Template
GET /brevo/v3/smtp/templates/{templateId}
Create Template
POST /brevo/v3/smtp/templates
Content-Type: application/json
{
"sender": {
"name": "Company",
"email": "noreply@company.com"
},
"templateName": "Welcome Email",
"subject": "Welcome {{params.name}}!",
"htmlContent": "<html><body><h1>Hello {{params.name}}!</h1></body></html>"
}
GET /brevo/v3/smtp/templates/{templateId}
POST /brevo/v3/smtp/templates
Content-Type: application/json
{
"sender": {
"name": "Company",
"email": "noreply@company.com"
},
"templateName": "Welcome Email",
"subject": "Welcome {{params.name}}!",
"htmlContent": "<html><body><h1>Hello {{params.name}}!</h1></body></html>"
}
Response:
{
"id": 1
}
Update Template
PUT /brevo/v3/smtp/templates/{templateId}
Content-Type: application/json
{
"templateName": "Updated Template Name",
"subject": "New Subject"
}
PUT /brevo/v3/smtp/templates/{templateId}
Content-Type: application/json
{
"templateName": "Updated Template Name",
"subject": "New Subject"
}
Returns 204 No Content on success.
Delete Template
DELETE /brevo/v3/smtp/templates/{templateId}
DELETE /brevo/v3/smtp/templates/{templateId}
Returns 204 No Content on success.
Send Test Email
POST /brevo/v3/smtp/templates/{templateId}/sendTest
Content-Type: application/json
{
"emailTo": ["test@example.com"]
}
Email Campaigns
List Campaigns
GET /brevo/v3/emailCampaigns
POST /brevo/v3/smtp/templates/{templateId}/sendTest
Content-Type: application/json
{
"emailTo": ["test@example.com"]
}
List Campaigns
GET /brevo/v3/emailCampaigns
Query Parameters:
type- Filter by type:classic,triggerstatus- Filter by status:draft,sent,archive,queued,suspended,in_processlimit- Results per pageoffset- Starting index
Response:
{
"count": 1,
"campaigns": [
{
"id": 2,
"name": "Monthly Newsletter",
"subject": "Our March Update",
"type": "classic",
"status": "draft",
"sender": {
"name": "Company",
"email": "news@company.com"
},
"createdAt": "2026-02-09T23:29:39.000Z"
}
]
}
Get Campaign
GET /brevo/v3/emailCampaigns/{campaignId}
Create Campaign
POST /brevo/v3/emailCampaigns
Content-Type: application/json
{
"name": "March Newsletter",
"subject": "Our March Update",
"sender": {
"name": "Company",
"email": "news@company.com"
},
"htmlContent": "<html><body><h1>March News</h1></body></html>",
"recipients": {
"listIds": [2]
}
}
GET /brevo/v3/emailCampaigns/{campaignId}
POST /brevo/v3/emailCampaigns
Content-Type: application/json
{
"name": "March Newsletter",
"subject": "Our March Update",
"sender": {
"name": "Company",
"email": "news@company.com"
},
"htmlContent": "<html><body><h1>March News</h1></body></html>",
"recipients": {
"listIds": [2]
}
}
Response:
{
"id": 2
}
Update Campaign
PUT /brevo/v3/emailCampaigns/{campaignId}
Content-Type: application/json
{
"name": "Updated Campaign Name",
"subject": "Updated Subject"
}
PUT /brevo/v3/emailCampaigns/{campaignId}
Content-Type: application/json
{
"name": "Updated Campaign Name",
"subject": "Updated Subject"
}
Returns 204 No Content on success.
Delete Campaign
DELETE /brevo/v3/emailCampaigns/{campaignId}
DELETE /brevo/v3/emailCampaigns/{campaignId}
Returns 204 No Content on success.
Send Campaign Now
POST /brevo/v3/emailCampaigns/{campaignId}/sendNow
Send Test Email
POST /brevo/v3/emailCampaigns/{campaignId}/sendTest
Content-Type: application/json
{
"emailTo": ["test@example.com"]
}
Update Campaign Status
PUT /brevo/v3/emailCampaigns/{campaignId}/status
Content-Type: application/json
{
"status": "suspended"
}
Senders
List Senders
GET /brevo/v3/senders
POST /brevo/v3/emailCampaigns/{campaignId}/sendNow
POST /brevo/v3/emailCampaigns/{campaignId}/sendTest
Content-Type: application/json
{
"emailTo": ["test@example.com"]
}
Update Campaign Status
PUT /brevo/v3/emailCampaigns/{campaignId}/status
Content-Type: application/json
{
"status": "suspended"
}
Senders
List Senders
GET /brevo/v3/senders
PUT /brevo/v3/emailCampaigns/{campaignId}/status
Content-Type: application/json
{
"status": "suspended"
}
List Senders
GET /brevo/v3/senders
Response:
{
"senders": [
{
"id": 1,
"name": "Company",
"email": "noreply@company.com",
"active": true,
"ips": []
}
]
}
Get Sender
GET /brevo/v3/senders/{senderId}
Create Sender
POST /brevo/v3/senders
Content-Type: application/json
{
"name": "Marketing",
"email": "marketing@company.com"
}
Update Sender
PUT /brevo/v3/senders/{senderId}
Content-Type: application/json
{
"name": "Updated Name"
}
Delete Sender
DELETE /brevo/v3/senders/{senderId}
Blocked Contacts
List Blocked Contacts
GET /brevo/v3/smtp/blockedContacts
Unblock Contact
DELETE /brevo/v3/smtp/blockedContacts/{email}
Blocked Domains
List Blocked Domains
GET /brevo/v3/smtp/blockedDomains
Add Blocked Domain
POST /brevo/v3/smtp/blockedDomains
Content-Type: application/json
{
"domain": "spam-domain.com"
}
Remove Blocked Domain
DELETE /brevo/v3/smtp/blockedDomains/{domain}
Pagination
GET /brevo/v3/senders/{senderId}
POST /brevo/v3/senders
Content-Type: application/json
{
"name": "Marketing",
"email": "marketing@company.com"
}
Update Sender
PUT /brevo/v3/senders/{senderId}
Content-Type: application/json
{
"name": "Updated Name"
}
Delete Sender
DELETE /brevo/v3/senders/{senderId}
Blocked Contacts
List Blocked Contacts
GET /brevo/v3/smtp/blockedContacts
Unblock Contact
DELETE /brevo/v3/smtp/blockedContacts/{email}
Blocked Domains
List Blocked Domains
GET /brevo/v3/smtp/blockedDomains
Add Blocked Domain
POST /brevo/v3/smtp/blockedDomains
Content-Type: application/json
{
"domain": "spam-domain.com"
}
Remove Blocked Domain
DELETE /brevo/v3/smtp/blockedDomains/{domain}
Pagination
PUT /brevo/v3/senders/{senderId}
Content-Type: application/json
{
"name": "Updated Name"
}
DELETE /brevo/v3/senders/{senderId}
Blocked Contacts
List Blocked Contacts
GET /brevo/v3/smtp/blockedContacts
Unblock Contact
DELETE /brevo/v3/smtp/blockedContacts/{email}
Blocked Domains
List Blocked Domains
GET /brevo/v3/smtp/blockedDomains
Add Blocked Domain
POST /brevo/v3/smtp/blockedDomains
Content-Type: application/json
{
"domain": "spam-domain.com"
}
Remove Blocked Domain
DELETE /brevo/v3/smtp/blockedDomains/{domain}
Pagination
DELETE /brevo/v3/smtp/blockedContacts/{email}
List Blocked Domains
GET /brevo/v3/smtp/blockedDomains
POST /brevo/v3/smtp/blockedDomains
Content-Type: application/json
{
"domain": "spam-domain.com"
}
Remove Blocked Domain
DELETE /brevo/v3/smtp/blockedDomains/{domain}
Pagination
DELETE /brevo/v3/smtp/blockedDomains/{domain}
Brevo uses offset-based pagination:
GET /brevo/v3/contacts?limit=50&offset=0
Parameters:
limit- Number of results per page (varies by endpoint, typically max 500)offset- Starting index (0-based)
Response includes count:
{
"contacts": [...],
"count": 150
}
To get the next page, increment offset by limit:
- Page 1:
offset=0&limit=50 - Page 2:
offset=50&limit=50 - Page 3:
offset=100&limit=50
Code Examples
JavaScript
const response = await fetch(
'https://gateway.maton.ai/brevo/v3/contacts',
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
const data = await response.json();
console.log(data.contacts);
Python
import os
import requests
response = requests.get(
'https://gateway.maton.ai/brevo/v3/contacts',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
)
data = response.json()
print(data['contacts'])
Python (Send Email)
import os
import requests
response = requests.post(
'https://gateway.maton.ai/brevo/v3/smtp/email',
headers={
'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}',
'Content-Type': 'application/json'
},
json={
'sender': {'name': 'John', 'email': 'john@example.com'},
'to': [{'email': 'recipient@example.com', 'name': 'Jane'}],
'subject': 'Hello!',
'htmlContent': '<html><body><h1>Hi Jane!</h1></body></html>'
}
)
result = response.json()
print(f"Sent! Message ID: {result['messageId']}")
Python (Create Contact and Add to List)
import os
import requests
headers = {
'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}',
'Content-Type': 'application/json'
}
# Create contact
response = requests.post(
'https://gateway.maton.ai/brevo/v3/contacts',
headers=headers,
json={
'email': 'newuser@example.com',
'attributes': {'FIRSTNAME': 'New', 'LASTNAME': 'User'},
'listIds': [2]
}
)
contact = response.json()
print(f"Created contact ID: {contact['id']}")
Notes
- All endpoints require the
/v3/ prefix in the path
- Attribute names must be in UPPERCASE
- Contact identifiers can be email, phone, or ID
- Sender email addresses must be verified in Brevo
- Template parameters use
{{params.name}} syntax
- PUT and DELETE operations return 204 No Content on success
- Rate limits: 300 calls/minute on free plans, higher on paid plans
- IMPORTANT: When piping curl output to
jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments
Error Handling
Status
Meaning
400
Missing Brevo connection or bad request
401
Invalid or missing Maton API key
404
Resource not found
429
Rate limited
4xx/5xx
Passthrough error from Brevo API
import os
import requests
response = requests.get(
'https://gateway.maton.ai/brevo/v3/contacts',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
)
data = response.json()
print(data['contacts'])
import os
import requests
response = requests.post(
'https://gateway.maton.ai/brevo/v3/smtp/email',
headers={
'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}',
'Content-Type': 'application/json'
},
json={
'sender': {'name': 'John', 'email': 'john@example.com'},
'to': [{'email': 'recipient@example.com', 'name': 'Jane'}],
'subject': 'Hello!',
'htmlContent': '<html><body><h1>Hi Jane!</h1></body></html>'
}
)
result = response.json()
print(f"Sent! Message ID: {result['messageId']}")
Python (Create Contact and Add to List)
import os
import requests
headers = {
'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}',
'Content-Type': 'application/json'
}
# Create contact
response = requests.post(
'https://gateway.maton.ai/brevo/v3/contacts',
headers=headers,
json={
'email': 'newuser@example.com',
'attributes': {'FIRSTNAME': 'New', 'LASTNAME': 'User'},
'listIds': [2]
}
)
contact = response.json()
print(f"Created contact ID: {contact['id']}")
Notes
- All endpoints require the
/v3/ prefix in the path
- Attribute names must be in UPPERCASE
- Contact identifiers can be email, phone, or ID
- Sender email addresses must be verified in Brevo
- Template parameters use
{{params.name}} syntax
- PUT and DELETE operations return 204 No Content on success
- Rate limits: 300 calls/minute on free plans, higher on paid plans
- IMPORTANT: When piping curl output to
jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments
Error Handling
Status
Meaning
400
Missing Brevo connection or bad request
401
Invalid or missing Maton API key
404
Resource not found
429
Rate limited
4xx/5xx
Passthrough error from Brevo API
import os
import requests
headers = {
'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}',
'Content-Type': 'application/json'
}
# Create contact
response = requests.post(
'https://gateway.maton.ai/brevo/v3/contacts',
headers=headers,
json={
'email': 'newuser@example.com',
'attributes': {'FIRSTNAME': 'New', 'LASTNAME': 'User'},
'listIds': [2]
}
)
contact = response.json()
print(f"Created contact ID: {contact['id']}")
- All endpoints require the
/v3/prefix in the path - Attribute names must be in UPPERCASE
- Contact identifiers can be email, phone, or ID
- Sender email addresses must be verified in Brevo
- Template parameters use
{{params.name}}syntax - PUT and DELETE operations return 204 No Content on success
- Rate limits: 300 calls/minute on free plans, higher on paid plans
- IMPORTANT: When piping curl output to
jqor other commands, environment variables like$MATON_API_KEYmay not expand correctly in some shell environments
Error Handling
Status
Meaning
400
Missing Brevo connection or bad request
401
Invalid or missing Maton API key
404
Resource not found
429
Rate limited
4xx/5xx
Passthrough error from Brevo API
| Status | Meaning |
|---|---|
| 400 | Missing Brevo connection or bad request |
| 401 | Invalid or missing Maton API key |
| 404 | Resource not found |
| 429 | Rate limited |
| 4xx/5xx | Passthrough error from Brevo API |
Rate limit headers in response:
x-sib-ratelimit-limit- Request limitx-sib-ratelimit-remaining- Remaining requestsx-sib-ratelimit-reset- Reset time
Troubleshooting: Invalid API Key
When you receive an "Invalid API key" error, ALWAYS follow these steps before concluding there is an issue:
- Check that the
MATON_API_KEYenvironment variable is set:
echo $MATON_API_KEY
- Verify the API key is valid by listing connections:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Resources
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。