Fertiger n8n-Workflow
Fünf Nodes: ein manueller Start, ein Edit-Fields-Node mit content und clubId, ein If-Node, der prüft, ob clubId leer ist, und zwei HTTP-Request-Nodes – einer postet in dein Profil, der andere in den Verein.
Der Workflow beginnt mit einem manuellen Trigger, damit du ihn direkt nach dem Import testen kannst. Wenn alles läuft, ersetze den Start durch das, was ihn wirklich auslösen soll – Schedule, RSS, ein Formular – und ordne dessen Ausgabe den beiden Feldern zu.
{
"name": "Amator — publish a post",
"nodes": [
{
"id": "7b0f3a52-1c6e-4d1b-9a43-5e2f8c1d0a01",
"name": "Start",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
0,
0
],
"parameters": {}
},
{
"id": "7b0f3a52-1c6e-4d1b-9a43-5e2f8c1d0a02",
"name": "Post content",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
220,
0
],
"parameters": {
"mode": "manual",
"assignments": {
"assignments": [
{
"id": "7b0f3a52-1c6e-4d1b-9a43-5e2f8c1d0b01",
"name": "content",
"value": "Hello from n8n! Training moved to 19:00 tonight.",
"type": "string"
},
{
"id": "7b0f3a52-1c6e-4d1b-9a43-5e2f8c1d0b02",
"name": "clubId",
"value": "",
"type": "string"
}
]
},
"options": {}
}
},
{
"id": "7b0f3a52-1c6e-4d1b-9a43-5e2f8c1d0a03",
"name": "Club ID empty?",
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
440,
0
],
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "loose",
"version": 2
},
"conditions": [
{
"id": "7b0f3a52-1c6e-4d1b-9a43-5e2f8c1d0c01",
"leftValue": "={{ $json.clubId }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "empty",
"singleValue": true
}
}
],
"combinator": "and"
},
"looseTypeValidation": true,
"options": {}
}
},
{
"id": "7b0f3a52-1c6e-4d1b-9a43-5e2f8c1d0a04",
"name": "Post to my profile",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
680,
-120
],
"parameters": {
"method": "POST",
"url": "https://api.amator.app/api/v1/public/posts",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "X-API-KEY",
"value": "YOUR_API_KEY_HERE"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ content: $json.content }) }}",
"options": {}
}
},
{
"id": "7b0f3a52-1c6e-4d1b-9a43-5e2f8c1d0a05",
"name": "Post to club",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
680,
120
],
"parameters": {
"method": "POST",
"url": "https://api.amator.app/api/v1/public/posts",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "X-API-KEY",
"value": "YOUR_API_KEY_HERE"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ content: $json.content, clubId: $json.clubId }) }}",
"options": {}
}
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "Post content",
"type": "main",
"index": 0
}
]
]
},
"Post content": {
"main": [
[
{
"node": "Club ID empty?",
"type": "main",
"index": 0
}
]
]
},
"Club ID empty?": {
"main": [
[
{
"node": "Post to my profile",
"type": "main",
"index": 0
}
],
[
{
"node": "Post to club",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {},
"pinData": {}
}
In n8n importieren
Kopiere das JSON oben oder lade die Datei herunter.
Gehe in n8n zu Workflows, lege einen neuen Workflow an und füge das JSON auf der leeren Arbeitsfläche ein (Strg/Cmd+V). Für die Datei: Menü ⋯ › Import from File.
Ersetze in beiden HTTP-Request-Nodes YOUR_API_KEY_HERE durch deinen Schlüssel. Noch besser: Speichere ihn als n8n-Credential (Header Auth, Name X-API-KEY).
Schreibe im Node Post content deinen Text in content. Lass clubId für dein Profil leer, oder füge die ID des Vereins ein, um als Verein zu posten.
Klicke auf Execute workflow. Der HTTP-Node zeigt die Antwort – bei Erfolg 201 und die url des Beitrags.