|
通过托管的OAuth认证访问Mailchimp营销API。管理邮件营销中的受众、营销活动、模板、自动化、报告和订阅者。
bash
https://gateway.maton.ai/mailchimp/{native-api-path}
将{native-api-path}替换为实际的Mailchimp API端点路径(例如3.0/lists)。网关会将请求代理到您的Mailchimp数据中心,并自动注入您的OAuth令牌。
所有请求都需要在Authorization头中包含Maton API密钥:
Authorization: Bearer $MATONAPIKEY
环境变量: 将您的API密钥设置为MATONAPIKEY:
bash
export MATONAPIKEY=YOURAPIKEY
在https://ctrl.maton.ai管理您的Mailchimp OAuth连接。
bash
python <
req = urllib.request.Request(https://ctrl.maton.ai/connections?app=mailchimp&status=ACTIVE)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
bash
python <
data = json.dumps({app: mailchimp}).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 <
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: 21fd90f9-5935-43cd-b6c8-bde9d915ca80,
status: ACTIVE,
creation_time: 2025-12-08T07:20:53.488460Z,
lastupdatedtime: 2026-01-31T20:03:32.593153Z,
url: https://connect.maton.ai/?session_token=...,
app: mailchimp,
metadata: {}
}
}
在浏览器中打开返回的url以完成OAuth授权。
bash
python <
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
如果您有多个Mailchimp连接,请使用Maton-Connection头指定要使用的连接:
bash
python <
req = urllib.request.Request(https://gateway.maton.ai/mailchimp/3.0/lists)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Maton-Connection, 21fd90f9-5935-43cd-b6c8-bde9d915ca80)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
如果省略,网关将使用默认(最早)的活动连接。
在Mailchimp应用中,受众是常用术语,但API使用列表作为端点。
bash
GET /mailchimp/3.0/lists
查询参数:
示例:
bash
python <
req = urllib.request.Request(https://gateway.maton.ai/mailchimp/3.0/lists?count=10)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
json
{
lists: [
{
id: abc123def4,
name: Newsletter Subscribers,
contact: {
company: Acme Corp,
address1: 123 Main St
},
stats: {
member_count: 5000,
unsubscribe_count: 100,
open_rate: 0.25
}
}
],
total_items: 1
}
bash
GET /mailchimp/3.0/lists/{list_id}
示例:
bash
python <
req = urllib.request.Request(https://gateway.maton.ai/mailchimp/3.0/lists/abc123def4)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
bash
POST /mailchimp/3.0/lists
Content-Type: application/json
{
name: Newsletter,
contact: {
company: Acme Corp,
address1: 123 Main St,
city: New York,
state: NY,
zip: 10001,
country: US
},
permission_reminder: You signed up for our newsletter,
campaign_defaults: {
from_name: Acme Corp,
from_email: newsletter@acme.com,
subject: ,
language: en
},
emailtypeoption: true
}
bash
PATCH /mailchimp/3.0/lists/{list_id}
bash
DELETE /mailchimp/3.0/lists/{list_id}
成员是受众中的联系人。API使用小写电子邮件地址的MD5哈希作为订阅者标识符。
bash
GET /mailchimp/3.0/lists/{list_id}/members
查询参数:
示例:
bash
python <
req = urllib.request.Request(https://gateway.maton.ai/mailchimp/3.0/lists/abc123def4/members?status=subscribed&count=50)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
json
{
members: [
{
id: f4b7c8d9e0,
email_address: john@example.com,
status: subscribed,
merge_fields: {
FNAME: John,
LNAME: Doe
},
tags: [
{id: 1, name: VIP}
]
}
],
total_items: 500
}
bash
GET /mailchimp/3.
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 mailchimp-1776363016 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 mailchimp-1776363016 技能
skillhub install mailchimp-1776363016
文件大小: 6.78 KB | 发布时间: 2026-4-17 14:56