{ "name": "publish-content", "nodes": [ { "parameters": { "httpMethod": "POST", "path": "publish-content", "responseMode": "responseNode", "authentication": "headerAuth", "options": {} }, "id": "webhook-in", "name": "Webhook (publish-content)", "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [-200, 300], "webhookId": "publish-content", "credentials": { "httpHeaderAuth": { "id": "REPLACE", "name": "X-Content-Secret" } } }, { "parameters": { "rules": { "values": [ { "conditions": { "options": { "caseSensitive": true, "typeValidation": "strict" }, "conditions": [ { "id": "r-linkedin", "leftValue": "={{ $json.body.channel }}", "rightValue": "linkedin", "operator": { "type": "string", "operation": "equals" } } ], "combinator": "and" }, "renameOutput": true, "outputKey": "linkedin" }, { "conditions": { "options": { "caseSensitive": true, "typeValidation": "strict" }, "conditions": [ { "id": "r-blog", "leftValue": "={{ $json.body.channel }}", "rightValue": "blog", "operator": { "type": "string", "operation": "equals" } } ], "combinator": "and" }, "renameOutput": true, "outputKey": "blog" } ] }, "options": { "fallbackOutput": "extra" } }, "id": "switch-channel", "name": "Switch by channel", "type": "n8n-nodes-base.switch", "typeVersion": 3, "position": [40, 300] }, { "parameters": { "postAs": "person", "text": "={{ $('Webhook (publish-content)').item.json.body.content.body }}{{ $('Webhook (publish-content)').item.json.body.content.hashtags ? '\\n\\n' + $('Webhook (publish-content)').item.json.body.content.hashtags.join(' ') : '' }}", "additionalFields": {} }, "id": "linkedin-post", "name": "LinkedIn — create post", "type": "n8n-nodes-base.linkedIn", "typeVersion": 1, "position": [300, 180], "credentials": { "linkedInOAuth2Api": { "id": "REPLACE", "name": "LinkedIn OAuth2" } } }, { "parameters": { "method": "POST", "url": "={{ $env.SASE_BLOG_API }}/blog/posts/internal", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ { ...$('Webhook (publish-content)').item.json.body.content, projectKey: 'sase' } }}", "options": {} }, "id": "blog-post", "name": "Blog — POST sase.tr", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [300, 360], "credentials": { "httpHeaderAuth": { "id": "REPLACE", "name": "SASE_BLOG_TOKEN (Bearer)" } } }, { "parameters": { "respondWith": "json", "responseBody": "={{ { ok: true, publishedUrl: ($json.permalink || $json.urn || $json.id || '') } }}", "options": {} }, "id": "respond-linkedin", "name": "Respond — LinkedIn", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1, "position": [560, 180] }, { "parameters": { "respondWith": "json", "responseBody": "={{ { ok: true, publishedUrl: ($json.url || $json.permalink || '') } }}", "options": {} }, "id": "respond-blog", "name": "Respond — Blog", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1, "position": [560, 360] }, { "parameters": { "respondWith": "json", "responseBody": "={{ { ok: false, error: 'unsupported channel: ' + $('Webhook (publish-content)').item.json.body.channel } }}", "options": { "responseCode": 422 } }, "id": "respond-fallback", "name": "Respond — Unsupported", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1, "position": [300, 540] } ], "connections": { "Webhook (publish-content)": { "main": [[{ "node": "Switch by channel", "type": "main", "index": 0 }]] }, "Switch by channel": { "main": [ [{ "node": "LinkedIn — create post", "type": "main", "index": 0 }], [{ "node": "Blog — POST sase.tr", "type": "main", "index": 0 }], [{ "node": "Respond — Unsupported", "type": "main", "index": 0 }] ] }, "LinkedIn — create post": { "main": [[{ "node": "Respond — LinkedIn", "type": "main", "index": 0 }]] }, "Blog — POST sase.tr": { "main": [[{ "node": "Respond — Blog", "type": "main", "index": 0 }]] } }, "settings": { "executionOrder": "v1" }, "active": false }