Buffer
관리형 인증을 통해 Buffer GraphQL API에 접근합니다. Instagram, Facebook, Twitter, LinkedIn, TikTok 등 여러 플랫폼에 소셜 미디어 게시물을 예약하고 관리합니다.
빠른 시작
# 계정 정보 및 조직 조회
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": "query { account { id email organizations { id name } } }"
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
기본 URL
https://gateway.maton.ai/buffer/
Buffer는 단일 GraphQL 엔드포인트를 사용합니다. 모든 쿼리와 뮤테이션은 POST 요청으로 이 엔드포인트로 전송됩니다.
인증
모든 요청은 Authorization 헤더에 Maton API 키가 필요합니다:
Authorization: Bearer $MATON_API_KEY
환경 변수: API 키를 MATON_API_KEY로 설정하세요:
export MATON_API_KEY="YOUR_API_KEY"
API 키 얻기
- maton.ai에서 계정을 만들거나 로그인하세요.
- maton.ai/settings로 이동하세요.
- API 키를 복사하세요.
연결 관리
Buffer 연결은 https://ctrl.maton.ai에서 관리하세요.
연결 목록 조회
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=buffer&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': 'buffer'}).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
연결 조회
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
응답:
{
"connection": {
"connection_id": "a71282a3-52be-473d-9273-22b4546dc146",
"status": "ACTIVE",
"creation_time": "2026-03-12T00:18:28.327860Z",
"last_updated_time": "2026-03-12T00:18:42.818009Z",
"url": "https://connect.maton.ai/?session_token=...",
"app": "buffer",
"metadata": {},
"method": "API_KEY"
}
}
연결 삭제
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
연결 지정
Buffer 연결이 여러 개인 경우, Maton-Connection 헤더를 사용하여 사용할 연결을 지정하세요:
python <<'EOF'
import urllib.request, os, json
data = json.dumps({"query": "query { account { id } }"}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
req.add_header('Maton-Connection', 'a71282a3-52be-473d-9273-22b4546dc146')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
생략하면 게이트웨이는 기본(가장 오래된) 활성 연결을 사용합니다.
API 참조
계정 조회
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
query {
account {
id
email
name
avatar
timezone
createdAt
preferences {
timeFormat
startOfWeek
}
}
}
"""
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
응답:
{
"data": {
"account": {
"id": "69846f7479b75e6487fa3482",
"email": "[email protected]",
"name": "John Doe",
"avatar": "https://...",
"timezone": "America/New_York",
"createdAt": "2024-01-15T10:30:00Z",
"preferences": {
"timeFormat": "12h",
"startOfWeek": "sunday"
}
}
}
}
조직 조회
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
query {
account {
organizations {
id
name
channels {
id
name
service
avatar
isDisconnected
}
}
}
}
"""
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
응답:
{
"data": {
"account": {
"organizations": [
{
"id": "69846f7479b75e6487fa3484",
"name": "My Organization",
"channels": [
{
"id": "channel123",
"name": "My Twitter",
"service": "twitter",
"avatar": "https://...",
"isDisconnected": false
}
]
}
]
}
}
}
채널 조회
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
query GetChannels($organizationId: OrganizationId!) {
channels(organizationId: $organizationId) {
id
name
service
displayName
avatar
timezone
isDisconnected
isQueuePaused
postingSchedule {
days
times
}
}
}
""",
"variables": {
"organizationId": "69846f7479b75e6487fa3484"
}
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
단일 채널 조회
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
query GetChannel($channelId: ChannelId!) {
channel(channelId: $channelId) {
id
name
service
displayName
avatar
timezone
postingSchedule {
days
times
}
postingGoal {
postsPerWeek
progress
}
}
}
""",
"variables": {
"channelId": "channel123"
}
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
게시물 목록 조회
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
query GetPosts($channelId: ChannelId!, $status: PostStatus, $first: Int) {
posts(channelId: $channelId, status: $status, first: $first) {
edges {
node {
id
text
status
createdAt
dueAt
sentAt
channelService
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
""",
"variables": {
"channelId": "channel123",
"status": "scheduled",
"first": 10
}
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
게시물 상태 값:
draft- 임시 저장됨scheduled- 게시 예약됨sent- 게시됨failed- 게시 실패
단일 게시물 조회
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
query GetPost($postId: PostId!) {
post(id: $postId) {
id
text
status
createdAt
dueAt
sentAt
author {
name
email
}
channel {
id
name
service
}
assets {
id
url
type
}
}
}
""",
"variables": {
"postId": "post123"
}
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
게시물 생성
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
mutation CreatePost($input: CreatePostInput!) {
createPost(input: $input) {
... on Post {
id
text
status
dueAt
}
... on InvalidInputError {
message
}
... on UnauthorizedError {
message
}
}
}
""",
"variables": {
"input": {
"channelId": "channel123",
"text": "Hello from Buffer API!",
"schedulingType": "scheduled",
"dueAt": "2026-03-15T14:00:00Z",
"mode": "queue"
}
}
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
CreatePostInput 필드:
channelId(필수): 대상 채널 IDtext: 게시물 내용schedulingType(필수): "scheduled", "draft", 또는 "now"dueAt: 예약 게시물의 ISO 8601 날짜/시간mode(필수): "queue" 또는 "share"assets: 미디어 첨부 파일tagIds: 콘텐츠 태그metadata: 플랫폼별 옵션 (플랫폼 메타데이터 섹션 참조)ideaId: 기존 아이디어에 연결draftId: 기존 초안에서 생성source: 게시물 출처aiAssisted: AI가 콘텐츠 생성을 도왔는지 여부saveToDraft: 예약 대신 초안으로 저장
Instagram 메타데이터로 게시물 생성
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
mutation CreatePost($input: CreatePostInput!) {
createPost(input: $input) {
... on Post { id text status }
... on InvalidInputError { message }
}
}
""",
"variables": {
"input": {
"channelId": "instagram_channel_id",
"text": "Check out our latest post! #photography",
"schedulingType": "scheduled",
"dueAt": "2026-03-15T14:00:00Z",
"mode": "queue",
"metadata": {
"instagram": {
"type": "post",
"firstComment": "Follow us for more!",
"shouldShareToFeed": True
}
}
}
}
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
Twitter 스레드 생성
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
mutation CreatePost($input: CreatePostInput!) {
createPost(input: $input) {
... on Post { id text status }
... on InvalidInputError { message }
}
}
""",
"variables": {
"input": {
"channelId": "twitter_channel_id",
"text": "First tweet in thread",
"schedulingType": "scheduled",
"dueAt": "2026-03-15T14:00:00Z",
"mode": "queue",
"metadata": {
"twitter": {
"thread": [
{"text": "Second tweet in thread"},
{"text": "Third tweet in thread"}
]
}
}
}
}
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
링크가 포함된 LinkedIn 게시물 생성
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
mutation CreatePost($input: CreatePostInput!) {
createPost(input: $input) {
... on Post { id text status }
... on InvalidInputError { message }
}
}
""",
"variables": {
"input": {
"channelId": "linkedin_channel_id",
"text": "Check out this article!",
"schedulingType": "scheduled",
"dueAt": "2026-03-15T14:00:00Z",
"mode": "queue",
"metadata": {
"linkedin": {
"link": {
"url": "https://example.com/article",
"title": "Amazing Article Title",
"description": "Brief description of the article"
}
}
}
}
}
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
업데이트 게시물
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
mutation UpdatePost($input: UpdatePostInput!) {
updatePost(input: $input) {
... on Post { id text status dueAt }
... on InvalidInputError { message }
... on UnauthorizedError { message }
}
}
""",
"variables": {
"input": {
"postId": "post123",
"text": "Updated post content",
"dueAt": "2026-03-16T14:00:00Z"
}
}
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
게시물 삭제
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
mutation DeletePost($input: DeletePostInput!) {
deletePost(input: $input) {
... on DeletePostResult { success }
... on InvalidInputError { message }
... on UnauthorizedError { message }
}
}
""",
"variables": {
"input": {
"postId": "post123"
}
}
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
아이디어 관리
아이디어 목록 조회
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
query GetIdeas($channelId: ChannelId!, $first: Int) {
ideas(channelId: $channelId, first: $first) {
edges {
node {
id
text
createdAt
updatedAt
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
""",
"variables": {
"channelId": "channel123",
"first": 20
}
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
아이디어 생성
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
mutation CreateIdea($input: CreateIdeaInput!) {
createIdea(input: $input) {
... on Idea { id text createdAt }
... on InvalidInputError { message }
... on UnauthorizedError { message }
}
}
""",
"variables": {
"input": {
"channelId": "channel123",
"text": "Blog post about AI"
}
}
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
아이디어 업데이트
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
mutation UpdateIdea($input: UpdateIdeaInput!) {
updateIdea(input: $input) {
... on Idea { id text }
... on InvalidInputError { message }
... on UnauthorizedError { message }
}
}
""",
"variables": {
"input": {
"ideaId": "idea123",
"text": "Updated idea content"
}
}
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
초안 관리
초안 목록 조회
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
query GetDrafts($channelId: ChannelId!, $first: Int) {
drafts(channelId: $channelId, first: $first) {
edges {
node {
id
text
createdAt
updatedAt
dueAt
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
""",
"variables": {
"channelId": "channel123",
"first": 10
}
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
게시물에 태그 추가
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
mutation AddTags($input: AddTagsInput!) {
addTags(input: $input) {
... on AddTagsResult { success }
... on InvalidInputError { message }
... on UnauthorizedError { message }
}
}
""",
"variables": {
"input": {
"postId": "post123",
"tagIds": ["tag1", "tag2"]
}
}
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/buffer/', 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
플랫폼 메타데이터
{
"instagram": {
"type": "post",
"firstComment": "First comment text",
"shouldShareToFeed": true
}
}
{
"twitter": {
"thread": [
{"text": "Tweet 1"},
{"text": "Tweet 2"}
]
}
}
{
"linkedin": {
"link": {
"url": "https://example.com",
"title": "Page Title",
"description": "Page description"
}
}
}
오류 처리
모든 뮤테이션 호출은 성공 시 유니온 타입을 반환하고 오류가 발생하면 해당 오류 객체를 반환합니다. 항상 InvalidInputError, UnauthorizedError 및 기타 오류 유형을 처리하세요.
지원
자세한 내용은 maton.ai를 방문하세요.