Buffer
Greife auf die Buffer GraphQL API mit verwalteter Authentifizierung zu. Plane und verwalte Social-Media-Beiträge auf Instagram, Facebook, Twitter, LinkedIn, TikTok und weiteren Plattformen.
Schnellstart
# Kontoinformationen mit Organisationen abrufen
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
Basis-URL
https://gateway.maton.ai/buffer/
Buffer verwendet einen einzigen GraphQL-Endpunkt. Alle Abfragen und Mutationen werden als POST-Anfragen an diesen Endpunkt gesendet.
Authentifizierung
Alle Anfragen benötigen den Maton-API-Key im Authorization-Header:
Authorization: Bearer $MATON_API_KEY
Umgebungsvariable: Setze deinen API-Key als MATON_API_KEY:
export MATON_API_KEY="DEIN_API_KEY"
So erhältst du deinen API-Key
- Melde dich an oder erstelle ein Konto auf maton.ai
- Gehe zu maton.ai/settings
- Kopiere deinen API-Key
Verbindungsverwaltung
Verwalte deine Buffer-Verbindungen unter https://ctrl.maton.ai.
Verbindungen auflisten
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
Verbindung erstellen
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
Verbindung abrufen
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
Antwort:
{
"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"
}
}
Verbindung löschen
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
Verbindung angeben
Wenn du mehrere Buffer-Verbindungen hast, gib mit dem Maton-Connection-Header an, welche verwendet werden soll:
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
Wenn weggelassen, verwendet das Gateway die standardmäßige (älteste) aktive Verbindung.
API-Referenz
Konto abrufen
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
Antwort:
{
"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"
}
}
}
}
Organisationen abrufen
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
Antwort:
{
"data": {
"account": {
"organizations": [
{
"id": "69846f7479b75e6487fa3484",
"name": "Meine Organisation",
"channels": [
{
"id": "channel123",
"name": "Mein Twitter",
"service": "twitter",
"avatar": "https://...",
"isDisconnected": false
}
]
}
]
}
}
}
Kanäle abrufen
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
Einzelnen Kanal abrufen
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
Beiträge auflisten
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
Beitragsstatus-Werte:
draft- Als Entwurf gespeichertscheduled- Zur Veröffentlichung geplantsent- Veröffentlichtfailed- Veröffentlichung fehlgeschlagen
Einzelnen Beitrag abrufen
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
Beitrag erstellen
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": "Hallo von der 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-Felder:
channelId(erforderlich): ID des Zielkanalstext: Inhalt des BeitragsschedulingType(erforderlich): "scheduled", "draft" oder "now"dueAt: ISO 8601 Datum/Uhrzeit für geplante Beiträgemode(erforderlich): "queue" oder "share"assets: MedienanhängetagIds: Inhalt-Tagsmetadata: Plattformspezifische Optionen (siehe Abschnitt Plattform-Metadaten)ideaId: Beitrag mit bestehender Idee verknüpfendraftId: Aus bestehendem Entwurf erstellensource: Ursprung des BeitragsaiAssisted: Ob KI bei der Erstellung des Inhalts geholfen hatsaveToDraft: Als Entwurf statt als Planung speichern
Beitrag mit Instagram-Metadaten erstellen
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": "Schau dir unseren neuesten Beitrag an! #photography",
"schedulingType": "scheduled",
"dueAt": "2026-03-15T14:00:00Z",
"mode": "queue",
"metadata": {
"instagram": {
"type": "post",
"firstComment": "Folge uns für mehr!",
"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-Thread erstellen
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": "Erster Tweet im Thread",
"schedulingType": "scheduled",
"dueAt": "2026-03-15T14:00:00Z",
"mode": "queue",
"metadata": {
"twitter": {
"thread": [
{"text": "Zweiter Tweet im Thread"},
{"text": "Dritter Tweet im 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-Beitrag mit Link erstellen
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": "Unser neuester Blogbeitrag",
"schedulingType": "scheduled",
"dueAt": "2026-03-15T14:00:00Z",
"mode": "queue",
"metadata": {
"linkedin": {
"link": {
"url": "https://example.com/blog-post",
"title": "Titel des Blogbeitrags"
}
}
}
}
}
}).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
Beitrag aktualisieren
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 NotFoundError { message }
... on InvalidInputError { message }
... on UnauthorizedError { message }
}
}
""",
"variables": {
"input": {
"postId": "post123",
"text": "Aktualisierter Inhalt",
"schedulingType": "scheduled",
"dueAt": "2026-03-16T10:00:00Z",
"mode": "queue",
"metadata": {}
}
}
}).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
UpdatePostInput-Felder:
postId(erforderlich): ID des zu aktualisierenden Beitragstext: Neuer InhaltschedulingType: "scheduled", "draft" oder "now"dueAt: Neue geplante Zeitmode: "queue" oder "share"metadata: Plattformspezifische Optionen
Beitrag löschen
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
mutation DeletePost($input: DeletePostInput!) {
deletePost(input: $input) {
... on Post { id }
... on NotFoundError { 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
Ideen abrufen
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
query GetIdeas($organizationId: OrganizationId!) {
ideas(organizationId: $organizationId) {
id
text
createdAt
tags {
id
name
}
}
}
""",
"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
Idee erstellen
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 }
}
}
""",
"variables": {
"input": {
"organizationId": "69846f7479b75e6487fa3484",
"text": "Inhaltsidee für nächste Woche",
"tagIds": []
}
}
}).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
CreateIdeaInput-Felder:
organizationId(erforderlich): ID der Organisationtext(erforderlich): Idee-InhalttagIds: IDs der zugehörigen Tags
Tags abrufen
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
query GetTags($organizationId: OrganizationId!) {
tags(organizationId: $organizationId) {
id
name
color
}
}
""",
"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
Medien hochladen
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
mutation UploadMedia($input: UploadMediaInput!) {
uploadMedia(input: $input) {
... on UploadedMedia {
id
url
type
preview
}
... on InvalidInputError { message }
}
}
""",
"variables": {
"input": {
"channelId": "channel123",
"url": "https://example.com/image.jpg",
"type": "image"
}
}
}).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
UploadMediaInput-Felder:
channelId(erforderlich): Kanal-IDurl(erforderlich): Öffentliche Medien-URLtype: "image", "video" oder "gif"
Planungs-Gruppen abrufen
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"query": """
query GetSchedulingGroups($channelId: ChannelId!) {
schedulingGroups(channelId: $channelId) {
id
name
days
times
channels {
id
name
service
}
}
}
""",
"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
Plattform-Metadaten
{
"instagram": {
"type": "story" | "post" | "reel",
"firstComment": "Erster Kommentar",
"shouldShareToFeed": true,
"media": ["media_id1", "media_id2"]
}
}
{
"twitter": {
"thread": [
{"text": "Tweet 2"},
{"text": "Tweet 3"}
]
}
}
{
"linkedin": {
"link": {
"url": "https://example.com",
"title": "Titel",
"description": "Beschreibung"
}
}
}
TikTok
{
"tiktok": {
"commentDisabled": false,
"duetDisabled": false,
"stitchDisabled": false
}
}
Truncated Translation Notice
Der ursprüngliche SKILL.md-Text wurde bei der Zusendung gekürzt. Einige Mutationsbeispiele, Fehlerbehandlung und fortgeschrittene Szenarien, die nach dem LinkedIn-Beitrag mit Link erscheinen, sind nicht enthalten. Der übersetzte Markdown wurde so vollständig wie möglich aus dem bereitgestellten Inhalt erstellt.