简介
ManyChat
原始描述
ManyChat API integration with managed authentication. Manage subscribers, tags, custom fields, and send messages through Facebook Messenger. Use this skill w...
通过你的 Agent 添加
安装目录:manychat/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: manychat
description: |
ManyChat API integration with managed authentication. Manage subscribers, tags, custom fields, and send messages through Facebook Messenger.
Use this skill when users want to manage ManyChat subscribers, send messages, add/remove tags, or work with custom fields and bot automation.
For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
compatibility: Requires network access and valid Maton API key
metadata:
author: maton
version: "1.0"
clawdbot:
emoji: 🧠
requires:
env:
- MATON_API_KEY
ManyChat
Access the ManyChat API with managed authentication. Manage subscribers, tags, custom fields, flows, and send messages through chat automation.
Quick Start
# Get page info
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/manychat/fb/page/getInfo')
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/manychat/{native-api-path}
# Get page info
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/manychat/fb/page/getInfo')
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/manychat/{native-api-path}
Replace {native-api-path} with the actual ManyChat API endpoint path. The gateway proxies requests to api.manychat.com and automatically injects your API 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 ManyChat 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=manychat&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': 'manychat'}).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=manychat&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': 'manychat'}).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": "21fd90f9-5935-43cd-b6c8-bde9d915ca80",
"status": "ACTIVE",
"creation_time": "2025-12-08T07:20:53.488460Z",
"last_updated_time": "2026-01-31T20:03:32.593153Z",
"url": "https://connect.maton.ai/?session_token=...",
"app": "manychat",
"metadata": {}
}
}
Complete the connection by providing your ManyChat API key through the connection URL.
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 ManyChat 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/manychat/fb/page/getInfo')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '21fd90f9-5935-43cd-b6c8-bde9d915ca80')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
If omitted, the gateway uses the default (oldest) active connection.
API Reference
Page Operations
Get Page Info
GET /manychat/fb/page/getInfo
GET /manychat/fb/page/getInfo
Rate limit: 100 queries per second
Response:
{
"status": "success",
"data": {
"id": 123456789,
"name": "Page Name",
"category": "Business",
"avatar_link": "https://...",
"username": "pagename",
"about": "About text",
"description": "Page description",
"is_pro": true,
"timezone": "America/New_York"
}
}
Tag Operations
List Tags
GET /manychat/fb/page/getTags
Rate limit: 100 queries per second
Response:
{
"status": "success",
"data": [
{"id": 1, "name": "VIP"},
{"id": 2, "name": "Customer"}
]
}
Create Tag
POST /manychat/fb/page/createTag
Content-Type: application/json
{
"name": "New Tag"
}
POST /manychat/fb/page/createTag
Content-Type: application/json
{
"name": "New Tag"
}
Rate limit: 10 queries per second
Remove Tag from Page
POST /manychat/fb/page/removeTag
Content-Type: application/json
{
"tag_id": 123
}
POST /manychat/fb/page/removeTag
Content-Type: application/json
{
"tag_id": 123
}
Rate limit: 10 queries per second. Removes tag from page and all subscribers.
Remove Tag by Name
POST /manychat/fb/page/removeTagByName
Content-Type: application/json
{
"tag_name": "Old Tag"
}
POST /manychat/fb/page/removeTagByName
Content-Type: application/json
{
"tag_name": "Old Tag"
}
Rate limit: 10 queries per second
Custom Field Operations
List Custom Fields
GET /manychat/fb/page/getCustomFields
Rate limit: 100 queries per second
Response:
{
"status": "success",
"data": [
{"id": 1, "name": "phone_number", "type": "text"},
{"id": 2, "name": "purchase_count", "type": "number"}
]
}
Create Custom Field
POST /manychat/fb/page/createCustomField
Content-Type: application/json
{
"caption": "Phone Number",
"type": "text",
"description": "Customer phone number"
}
POST /manychat/fb/page/createCustomField
Content-Type: application/json
{
"caption": "Phone Number",
"type": "text",
"description": "Customer phone number"
}
Rate limit: 10 queries per second
Field Types: text, number, date, datetime, boolean
Bot Field Operations
List Bot Fields
GET /manychat/fb/page/getBotFields
Rate limit: 100 queries per second
Create Bot Field
POST /manychat/fb/page/createBotField
Content-Type: application/json
{
"name": "counter",
"type": "number",
"description": "Global counter",
"value": 0
}
POST /manychat/fb/page/createBotField
Content-Type: application/json
{
"name": "counter",
"type": "number",
"description": "Global counter",
"value": 0
}
Rate limit: 10 queries per second
Set Bot Field
POST /manychat/fb/page/setBotField
Content-Type: application/json
{
"field_id": 123,
"field_value": 42
}
POST /manychat/fb/page/setBotField
Content-Type: application/json
{
"field_id": 123,
"field_value": 42
}
Rate limit: 10 queries per second
Set Bot Field by Name
POST /manychat/fb/page/setBotFieldByName
Content-Type: application/json
{
"field_name": "counter",
"field_value": 42
}
POST /manychat/fb/page/setBotFieldByName
Content-Type: application/json
{
"field_name": "counter",
"field_value": 42
}
Rate limit: 10 queries per second
Set Multiple Bot Fields
POST /manychat/fb/page/setBotFields
Content-Type: application/json
{
"fields": [
{"field_id": 123, "field_value": "value1"},
{"field_name": "field2", "field_value": "value2"}
]
}
POST /manychat/fb/page/setBotFields
Content-Type: application/json
{
"fields": [
{"field_id": 123, "field_value": "value1"},
{"field_name": "field2", "field_value": "value2"}
]
}
Rate limit: 10 queries per second. Maximum 20 fields per request.
Flow Operations
List Flows
GET /manychat/fb/page/getFlows
Rate limit: 10 queries per second
Response:
{
"status": "success",
"data": {
"flows": [
{"ns": "content123456", "name": "Welcome Flow", "folder_id": 1}
],
"folders": [
{"id": 1, "name": "Main Folder"}
]
}
}
Growth Tools
List Growth Tools
GET /manychat/fb/page/getGrowthTools
Rate limit: 100 queries per second
OTN Topics
List OTN Topics
GET /manychat/fb/page/getOtnTopics
Rate limit: 100 queries per second
Subscriber Operations
Get Subscriber Info
GET /manychat/fb/subscriber/getInfo?subscriber_id=123456789
Rate limit: 10 queries per second
Response:
{
"status": "success",
"data": {
"id": 123456789,
"name": "John Doe",
"first_name": "John",
"last_name": "Doe",
"gender": "male",
"profile_pic": "https://...",
"subscribed": "2025-01-15T10:30:00Z",
"last_interaction": "2025-02-01T14:20:00Z",
"tags": [{"id": 1, "name": "VIP"}],
"custom_fields": [{"id": 1, "name": "phone", "value": "+1234567890"}]
}
}
Find Subscriber by Name
GET /manychat/fb/subscriber/findByName?name=John%20Doe
GET /manychat/fb/subscriber/findByName?name=John%20Doe
Rate limit: 10 queries per second. Maximum 100 results.
Find Subscriber by Custom Field
GET /manychat/fb/subscriber/findByCustomField?field_id=123&field_value=value
GET /manychat/fb/subscriber/findByCustomField?field_id=123&field_value=value
Rate limit: 10 queries per second. Works with Text and Number fields. Maximum 100 results.
Find Subscriber by System Field
GET /manychat/fb/subscriber/findBySystemField?email=john@example.com
GET /manychat/fb/subscriber/findBySystemField?phone=+1234567890
GET /manychat/fb/subscriber/findBySystemField?email=john@example.com
GET /manychat/fb/subscriber/findBySystemField?phone=+1234567890
Rate limit: 50 queries per second. Set either email OR phone parameter.
Get Subscriber by User Ref
GET /manychat/fb/subscriber/getInfoByUserRef?user_ref=123456
Create Subscriber
POST /manychat/fb/subscriber/createSubscriber
Content-Type: application/json
{
"first_name": "John",
"last_name": "Doe",
"phone": "+1234567890",
"email": "john@example.com",
"gender": "male",
"has_opt_in_sms": true,
"has_opt_in_email": true,
"consent_phrase": "I agree to receive messages"
}
GET /manychat/fb/subscriber/getInfoByUserRef?user_ref=123456
POST /manychat/fb/subscriber/createSubscriber
Content-Type: application/json
{
"first_name": "John",
"last_name": "Doe",
"phone": "+1234567890",
"email": "john@example.com",
"gender": "male",
"has_opt_in_sms": true,
"has_opt_in_email": true,
"consent_phrase": "I agree to receive messages"
}
Rate limit: 10 queries per second
Note: Importing subscribers with phone or email requires special permissions from ManyChat. Contact ManyChat support to enable this feature for your account.
Update Subscriber
POST /manychat/fb/subscriber/updateSubscriber
Content-Type: application/json
{
"subscriber_id": 123456789,
"first_name": "John",
"last_name": "Smith",
"phone": "+1234567890",
"email": "john.smith@example.com"
}
POST /manychat/fb/subscriber/updateSubscriber
Content-Type: application/json
{
"subscriber_id": 123456789,
"first_name": "John",
"last_name": "Smith",
"phone": "+1234567890",
"email": "john.smith@example.com"
}
Rate limit: 10 queries per second
Add Tag to Subscriber
POST /manychat/fb/subscriber/addTag
Content-Type: application/json
{
"subscriber_id": 123456789,
"tag_id": 1
}
POST /manychat/fb/subscriber/addTag
Content-Type: application/json
{
"subscriber_id": 123456789,
"tag_id": 1
}
Rate limit: 10 queries per second
Add Tag by Name
POST /manychat/fb/subscriber/addTagByName
Content-Type: application/json
{
"subscriber_id": 123456789,
"tag_name": "VIP"
}
POST /manychat/fb/subscriber/addTagByName
Content-Type: application/json
{
"subscriber_id": 123456789,
"tag_name": "VIP"
}
Rate limit: 10 queries per second
Remove Tag from Subscriber
POST /manychat/fb/subscriber/removeTag
Content-Type: application/json
{
"subscriber_id": 123456789,
"tag_id": 1
}
POST /manychat/fb/subscriber/removeTag
Content-Type: application/json
{
"subscriber_id": 123456789,
"tag_id": 1
}
Rate limit: 10 queries per second
Remove Tag by Name
POST /manychat/fb/subscriber/removeTagByName
Content-Type: application/json
{
"subscriber_id": 123456789,
"tag_name": "VIP"
}
POST /manychat/fb/subscriber/removeTagByName
Content-Type: application/json
{
"subscriber_id": 123456789,
"tag_name": "VIP"
}
Rate limit: 10 queries per second
Set Custom Field
POST /manychat/fb/subscriber/setCustomField
Content-Type: application/json
{
"subscriber_id": 123456789,
"field_id": 1,
"field_value": "+1234567890"
}
POST /manychat/fb/subscriber/setCustomField
Content-Type: application/json
{
"subscriber_id": 123456789,
"field_id": 1,
"field_value": "+1234567890"
}
Rate limit: 10 queries per second
Set Custom Field by Name
POST /manychat/fb/subscriber/setCustomFieldByName
Content-Type: application/json
{
"subscriber_id": 123456789,
"field_name": "phone_number",
"field_value": "+1234567890"
}
POST /manychat/fb/subscriber/setCustomFieldByName
Content-Type: application/json
{
"subscriber_id": 123456789,
"field_name": "phone_number",
"field_value": "+1234567890"
}
Rate limit: 10 queries per second
Set Multiple Custom Fields
POST /manychat/fb/subscriber/setCustomFields
Content-Type: application/json
{
"subscriber_id": 123456789,
"fields": [
{"field_id": 1, "field_value": "value1"},
{"field_name": "field2", "field_value": "value2"}
]
}
POST /manychat/fb/subscriber/setCustomFields
Content-Type: application/json
{
"subscriber_id": 123456789,
"fields": [
{"field_id": 1, "field_value": "value1"},
{"field_name": "field2", "field_value": "value2"}
]
}
Rate limit: 10 queries per second. Maximum 20 fields per request.
Verify Subscriber by Signed Request
POST /manychat/fb/subscriber/verifyBySignedRequest
Content-Type: application/json
{
"subscriber_id": 123456789,
"signed_request": "signed_request_token"
}
POST /manychat/fb/subscriber/verifyBySignedRequest
Content-Type: application/json
{
"subscriber_id": 123456789,
"signed_request": "signed_request_token"
}
Rate limit: 10 queries per second
Sending Operations
Send Content
POST /manychat/fb/sending/sendContent
Content-Type: application/json
{
"subscriber_id": 123456789,
"data": {
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "Hello! How can I help you today?"
}
]
}
},
"message_tag": "CONFIRMED_EVENT_UPDATE"
}
Rate limit: 25 queries per second
Message Tags: Required for sending outside the 24-hour messaging window
CONFIRMED_EVENT_UPDATEPOST_PURCHASE_UPDATEACCOUNT_UPDATE
OTN (One-Time Notification):
{
"subscriber_id": 123456789,
"data": {...},
"otn_topic_name": "Price Drop Alert"
}
Send Content by User Ref
POST /manychat/fb/sending/sendContentByUserRef
Content-Type: application/json
{
"user_ref": 123456,
"data": {
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "Welcome!"
}
]
}
}
}
POST /manychat/fb/sending/sendContentByUserRef
Content-Type: application/json
{
"user_ref": 123456,
"data": {
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "Welcome!"
}
]
}
}
}
Rate limit: 25 queries per second
Send Flow
POST /manychat/fb/sending/sendFlow
Content-Type: application/json
{
"subscriber_id": 123456789,
"flow_ns": "content123456"
}
POST /manychat/fb/sending/sendFlow
Content-Type: application/json
{
"subscriber_id": 123456789,
"flow_ns": "content123456"
}
Rate limit: 20 queries per second, maximum 100 per subscriber per hour
Message Content Format
ManyChat uses a structured content format for sending messages:
Text Message
{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "Your message here"
}
]
}
}
Image Message
{
"version": "v2",
"content": {
"messages": [
{
"type": "image",
"url": "https://example.com/image.jpg"
}
]
}
}
Quick Replies
{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "Choose an option:",
"quick_replies": [
{"type": "node", "caption": "Option 1", "target": "content123"},
{"type": "node", "caption": "Option 2", "target": "content456"}
]
}
]
}
}
Buttons
{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "Click a button:",
"buttons": [
{"type": "url", "caption": "Visit Website", "url": "https://example.com"},
{"type": "flow", "caption": "Start Flow", "target": "content123"}
]
}
]
}
}
Code Examples
JavaScript
// Get page info
const response = await fetch(
'https://gateway.maton.ai/manychat/fb/page/getInfo',
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
const data = await response.json();
// Send a message
const sendResponse = await fetch(
'https://gateway.maton.ai/manychat/fb/sending/sendContent',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
subscriber_id: 123456789,
data: {
version: 'v2',
content: {
messages: [{ type: 'text', text: 'Hello!' }]
}
}
})
}
);
Python
import os
import requests
# Get page info
response = requests.get(
'https://gateway.maton.ai/manychat/fb/page/getInfo',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
)
data = response.json()
# Send a message
send_response = requests.post(
'https://gateway.maton.ai/manychat/fb/sending/sendContent',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'},
json={
'subscriber_id': 123456789,
'data': {
'version': 'v2',
'content': {
'messages': [{'type': 'text', 'text': 'Hello!'}]
}
}
}
)
Notes
- Subscriber IDs are unique within your ManyChat page
- Flow namespaces (flow_ns) are used to identify specific automation flows
- The
message_tag parameter is required when sending messages outside the 24-hour messaging window
- OTN (One-Time Notification) allows sending one message per topic subscription
- Most POST endpoints return
{"status": "success"} on success
- IMPORTANT: When using curl commands, use
curl -g when URLs contain brackets to disable glob parsing
- 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 ManyChat connection
401
Invalid or missing Maton API key
429
Rate limited
4xx/5xx
Passthrough error from ManyChat API
ManyChat Error Codes
Code
Meaning
2011
Subscriber not found
2012
User ref not found
3011
Invalid message content
3021
Message tag required
3031
OTN topic not found
Troubleshooting: API Key Issues
- Check that the
MATON_API_KEY environment 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
Troubleshooting: Invalid App Name
- Ensure your URL path starts with
manychat. For example:
- Correct:
https://gateway.maton.ai/manychat/fb/page/getInfo
- Incorrect:
https://gateway.maton.ai/fb/page/getInfo
Resources
{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "Your message here"
}
]
}
}
{
"version": "v2",
"content": {
"messages": [
{
"type": "image",
"url": "https://example.com/image.jpg"
}
]
}
}
Quick Replies
{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "Choose an option:",
"quick_replies": [
{"type": "node", "caption": "Option 1", "target": "content123"},
{"type": "node", "caption": "Option 2", "target": "content456"}
]
}
]
}
}
Buttons
{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "Click a button:",
"buttons": [
{"type": "url", "caption": "Visit Website", "url": "https://example.com"},
{"type": "flow", "caption": "Start Flow", "target": "content123"}
]
}
]
}
}
Code Examples
JavaScript
// Get page info
const response = await fetch(
'https://gateway.maton.ai/manychat/fb/page/getInfo',
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
const data = await response.json();
// Send a message
const sendResponse = await fetch(
'https://gateway.maton.ai/manychat/fb/sending/sendContent',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
subscriber_id: 123456789,
data: {
version: 'v2',
content: {
messages: [{ type: 'text', text: 'Hello!' }]
}
}
})
}
);
Python
import os
import requests
# Get page info
response = requests.get(
'https://gateway.maton.ai/manychat/fb/page/getInfo',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
)
data = response.json()
# Send a message
send_response = requests.post(
'https://gateway.maton.ai/manychat/fb/sending/sendContent',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'},
json={
'subscriber_id': 123456789,
'data': {
'version': 'v2',
'content': {
'messages': [{'type': 'text', 'text': 'Hello!'}]
}
}
}
)
Notes
- Subscriber IDs are unique within your ManyChat page
- Flow namespaces (flow_ns) are used to identify specific automation flows
- The
message_tag parameter is required when sending messages outside the 24-hour messaging window
- OTN (One-Time Notification) allows sending one message per topic subscription
- Most POST endpoints return
{"status": "success"} on success
- IMPORTANT: When using curl commands, use
curl -g when URLs contain brackets to disable glob parsing
- 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 ManyChat connection
401
Invalid or missing Maton API key
429
Rate limited
4xx/5xx
Passthrough error from ManyChat API
ManyChat Error Codes
Code
Meaning
2011
Subscriber not found
2012
User ref not found
3011
Invalid message content
3021
Message tag required
3031
OTN topic not found
Troubleshooting: API Key Issues
- Check that the
MATON_API_KEY environment 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
Troubleshooting: Invalid App Name
- Ensure your URL path starts with
manychat. For example:
- Correct:
https://gateway.maton.ai/manychat/fb/page/getInfo
- Incorrect:
https://gateway.maton.ai/fb/page/getInfo
Resources
{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "Choose an option:",
"quick_replies": [
{"type": "node", "caption": "Option 1", "target": "content123"},
{"type": "node", "caption": "Option 2", "target": "content456"}
]
}
]
}
}
{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "Click a button:",
"buttons": [
{"type": "url", "caption": "Visit Website", "url": "https://example.com"},
{"type": "flow", "caption": "Start Flow", "target": "content123"}
]
}
]
}
}
Code Examples
JavaScript
// Get page info
const response = await fetch(
'https://gateway.maton.ai/manychat/fb/page/getInfo',
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
const data = await response.json();
// Send a message
const sendResponse = await fetch(
'https://gateway.maton.ai/manychat/fb/sending/sendContent',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
subscriber_id: 123456789,
data: {
version: 'v2',
content: {
messages: [{ type: 'text', text: 'Hello!' }]
}
}
})
}
);
Python
import os
import requests
# Get page info
response = requests.get(
'https://gateway.maton.ai/manychat/fb/page/getInfo',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
)
data = response.json()
# Send a message
send_response = requests.post(
'https://gateway.maton.ai/manychat/fb/sending/sendContent',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'},
json={
'subscriber_id': 123456789,
'data': {
'version': 'v2',
'content': {
'messages': [{'type': 'text', 'text': 'Hello!'}]
}
}
}
)
Notes
- Subscriber IDs are unique within your ManyChat page
- Flow namespaces (flow_ns) are used to identify specific automation flows
- The
message_tag parameter is required when sending messages outside the 24-hour messaging window
- OTN (One-Time Notification) allows sending one message per topic subscription
- Most POST endpoints return
{"status": "success"} on success
- IMPORTANT: When using curl commands, use
curl -g when URLs contain brackets to disable glob parsing
- 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 ManyChat connection
401
Invalid or missing Maton API key
429
Rate limited
4xx/5xx
Passthrough error from ManyChat API
ManyChat Error Codes
Code
Meaning
2011
Subscriber not found
2012
User ref not found
3011
Invalid message content
3021
Message tag required
3031
OTN topic not found
Troubleshooting: API Key Issues
- Check that the
MATON_API_KEY environment 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
Troubleshooting: Invalid App Name
- Ensure your URL path starts with
manychat. For example:
- Correct:
https://gateway.maton.ai/manychat/fb/page/getInfo
- Incorrect:
https://gateway.maton.ai/fb/page/getInfo
Resources
import os
import requests
# Get page info
response = requests.get(
'https://gateway.maton.ai/manychat/fb/page/getInfo',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
)
data = response.json()
# Send a message
send_response = requests.post(
'https://gateway.maton.ai/manychat/fb/sending/sendContent',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'},
json={
'subscriber_id': 123456789,
'data': {
'version': 'v2',
'content': {
'messages': [{'type': 'text', 'text': 'Hello!'}]
}
}
}
)
- Subscriber IDs are unique within your ManyChat page
- Flow namespaces (flow_ns) are used to identify specific automation flows
- The
message_tagparameter is required when sending messages outside the 24-hour messaging window - OTN (One-Time Notification) allows sending one message per topic subscription
- Most POST endpoints return
{"status": "success"}on success - IMPORTANT: When using curl commands, use
curl -gwhen URLs contain brackets to disable glob parsing - 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 ManyChat connection
401
Invalid or missing Maton API key
429
Rate limited
4xx/5xx
Passthrough error from ManyChat API
ManyChat Error Codes
| Status | Meaning |
|---|---|
| 400 | Missing ManyChat connection |
| 401 | Invalid or missing Maton API key |
| 429 | Rate limited |
| 4xx/5xx | Passthrough error from ManyChat API |
| Code | Meaning |
|---|---|
| 2011 | Subscriber not found |
| 2012 | User ref not found |
| 3011 | Invalid message content |
| 3021 | Message tag required |
| 3031 | OTN topic not found |
Troubleshooting: API Key Issues
MATON_API_KEY environment variable is set:echo $MATON_API_KEY
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
- Ensure your URL path starts with
manychat. For example:
- Correct:
https://gateway.maton.ai/manychat/fb/page/getInfo - Incorrect:
https://gateway.maton.ai/fb/page/getInfo
Resources
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。