|
通过托管OAuth认证访问Klaviyo API。管理用于电子邮件营销和客户互动的用户档案、列表、细分、营销活动、流程、事件、指标、模板、目录和Webhook。
bash
https://gateway.maton.ai/klaviyo/{native-api-path}
将{native-api-path}替换为实际的Klaviyo API端点路径。网关将请求代理到a.klaviyo.com并自动注入您的OAuth令牌。
所有请求都需要在Authorization头中包含Maton API密钥:
Authorization: Bearer $MATONAPIKEY
环境变量: 将您的API密钥设置为MATONAPIKEY:
bash
export MATONAPIKEY=YOURAPIKEY
Klaviyo使用基于日期的API版本管理。在所有请求中包含revision头:
revision: 2026-01-15
在https://ctrl.maton.ai管理您的Klaviyo OAuth连接。
bash
python <
req = urllib.request.Request(https://ctrl.maton.ai/connections?app=klaviyo&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: klaviyo}).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: klaviyo,
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
如果您有多个Klaviyo连接,请使用Maton-Connection头指定要使用的连接:
bash
python <
req = urllib.request.Request(https://gateway.maton.ai/klaviyo/api/profiles)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(revision, 2026-01-15)
req.add_header(Maton-Connection, 21fd90f9-5935-43cd-b6c8-bde9d915ca80)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
如果省略,网关将使用默认(最旧的)活动连接。
管理客户数据和同意。
bash
GET /klaviyo/api/profiles
查询参数:
示例:
bash
python <
req = urllib.request.Request(https://gateway.maton.ai/klaviyo/api/profiles?fields[profile]=email,firstname,lastname&page[size]=10)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(revision, 2026-01-15)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
json
{
data: [
{
type: profile,
id: 01GDDKASAP8TKDDA2GRZDSVP4H,
attributes: {
email: alice@example.com,
first_name: Alice,
last_name: Johnson
}
}
],
links: {
self: https://a.klaviyo.com/api/profiles,
next: https://a.klaviyo.com/api/profiles?page[cursor]=...
}
}
bash
GET /klaviyo/api/profiles/{profile_id}
示例:
bash
python <
req = urllib.request.Request(https://gateway.maton.ai/klaviyo/api/profiles/01GDDKASAP8TKDDA2GRZDSVP4H)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(revision, 2026-01-15)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
bash
POST /klaviyo/api/profiles
Content-Type: application/json
{
data: {
type: profile,
attributes: {
email: newuser@example.com,
first_name: John,
last_name: Doe,
phone_number: +15551234567,
properties: {
custom_field: value
}
}
}
}
示例:
bash
python <
data = json.dumps({data: {type: profile, attributes: {email: newuser@example.com, firstname: John, lastname: Doe}}}).encode()
req = urllib.request.Request(https://gateway.maton.ai/klaviyo/api/profiles, data=data, method=POST)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Content-Type, application/json)
req.add_header(revision, 2026-01-15)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
bash
PATCH /klaviyo/api/profiles/{profile_id}
示例:
bash
python <
data = json.dumps({data: {type: profile, id: 01GDDKASAP8TKDDA2GRZDSVP4H, attributes: {first_name: Jane}}}).encode()
req = urllib.request.Request(https://gateway.maton.ai/klaviyo/api/profiles/01GDD
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 klaviyo-1776363008 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 klaviyo-1776363008 技能
skillhub install klaviyo-1776363008
文件大小: 7.88 KB | 发布时间: 2026-4-17 14:37