|
通过托管 OAuth 连接直接访问第三方 API 的透传代理,由 Maton 提供。API 网关允许您直接调用原生 API 端点。
bash
https://gateway.maton.ai/{app}/{native-api-path}
将 {app} 替换为服务名称,将 {native-api-path} 替换为实际的 API 端点路径。
重要提示:URL 路径必须以连接的应用程序名称开头(例如 /google-mail/...)。此前缀告诉网关使用哪个应用程序连接。例如,原生 Gmail API 路径以 gmail/v1/ 开头,因此完整路径看起来像 /google-mail/gmail/v1/users/me/messages。
所有请求都需要在 Authorization 标头中包含 Maton API 密钥:
Authorization: Bearer $MATONAPIKEY
API 网关会自动为目标服务注入相应的 OAuth 令牌。
环境变量: 您可以将 API 密钥设置为 MATONAPIKEY 环境变量:
bash
export MATONAPIKEY=YOURAPIKEY
连接管理使用单独的基础 URL:https://ctrl.maton.ai
bash
python <
req = urllib.request.Request(https://ctrl.maton.ai/connections?app=slack&status=ACTIVE)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
查询参数(可选):
响应:
json
{
connections: [
{
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=5e9...,
app: slack,
method: OAUTH2,
metadata: {}
}
]
}
bash
python <
data = json.dumps({app: slack}).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=5e9...,
app: slack,
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
如果您有同一应用程序的多个连接,可以通过添加包含连接 ID 的 Maton-Connection 标头来指定要使用的连接:
bash
python <
data = json.dumps({channel: C0123456, text: 你好!}).encode()
req = urllib.request.Request(https://gateway.maton.ai/slack/api/chat.postMessage, data=data, method=POST)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Content-Type, application/json)
req.add_header(Maton-Connection, 21fd90f9-5935-43cd-b6c8-bde9d915ca80)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
如果省略,网关将使用该应用程序的默认(最旧)活动连接。
| 服务 | 应用名称 | 代理的基础 URL |
|---|---|---|
| ActiveCampaign | active-campaign | {account}.api-us1.com |
| Acuity Scheduling |
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 jef1test-1776198242 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 jef1test-1776198242 技能
skillhub install jef1test-1776198242
文件大小: 9.71 KB | 发布时间: 2026-4-17 15:07