{
  "name": "01 · Social Media / Multi-Platform Social Publisher",
  "active": false,
  "nodes": [
    {
      "id": "fd8a7bf0-5ad2-433c-be83-338ab7dda2e7",
      "name": "📘 Guide",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -640,
        -120
      ],
      "parameters": {
        "content": "## 01 · Social Media · Multi-Platform Social Publisher\n\n### What this does\nAccepts a content brief via webhook, normalizes captions/hashtags, then fans out posts to X, LinkedIn, Instagram Graph, and TikTok placeholder APIs with per-platform payload shaping.\n\n### Setup checklist\n1. Add HTTP credentials / OAuth for each network\n2. Replace httpbin URLs with real Graph API endpoints\n3. Map media URLs from your CDN or `/files` folder\n\n### How to test locally\nPOST http://localhost:5678/webhook-test/social-multi-publish with JSON `{ \"caption\":\"Hello\", \"mediaUrl\":\"https://...\", \"platforms\":[\"x\",\"linkedin\",\"instagram\",\"tiktok\"] }`\n\n### Tips\n- Keep credentials in n8n Credentials (never hardcode secrets).\n- Use **Test URL** on the Webhook while developing.\n- Activate only after credentials + destinations are configured.\n",
        "width": 560,
        "height": 560,
        "color": 5
      }
    },
    {
      "id": "49e813bd-d581-441b-a578-71a4a1314e1c",
      "name": "⚙️ Config",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -640,
        480
      ],
      "parameters": {
        "content": "## Config map\n\n- **Webhook path:** `social-multi-publish`\n- **Replace** all `https://httpbin.org/...` calls with real integrations.\n- **Credentials:** create in n8n → Credentials, then select on HTTP nodes.\n- **Activate** workflow only after a successful Test execution.\n\n### Local files\nShared host folder is mounted at `/files` inside n8n.",
        "width": 560,
        "height": 320,
        "color": 2
      }
    },
    {
      "id": "49daec85-c9f2-4a3b-ba03-b6adad383fc5",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        200
      ],
      "webhookId": "1add92da-1734-45f6-9dfb-f4add758adad",
      "parameters": {
        "httpMethod": "POST",
        "path": "social-multi-publish",
        "responseMode": "responseNode",
        "options": {}
      }
    },
    {
      "id": "9817ae24-8f2b-45c8-a980-12814a8bd80a",
      "name": "Normalize Payload",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        280,
        200
      ],
      "parameters": {
        "mode": "manual",
        "duplicateItem": false,
        "assignments": {
          "assignments": [
            {
              "id": "1",
              "name": "receivedAt",
              "value": "={{ $now.toISO() }}",
              "type": "string"
            },
            {
              "id": "2",
              "name": "source",
              "value": "01 · Social Media",
              "type": "string"
            },
            {
              "id": "3",
              "name": "workflow",
              "value": "Multi-Platform Social Publisher",
              "type": "string"
            },
            {
              "id": "4",
              "name": "payload",
              "value": "={{ $json.body || $json }}",
              "type": "object"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "088f1124-1b21-4823-b425-d31dee2e48c2",
      "name": "Business Logic",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        560,
        200
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "const item = $input.first().json;\nconst payload = item.payload || item;\nconst platforms = payload.platforms || ['primary', 'secondary', 'archive'];\nconst jobs = (Array.isArray(platforms) ? platforms : [platforms]).map((p, idx) => ({\n  json: {\n    ...item,\n    channel: p,\n    jobId: `${Date.now()}-${idx}`,\n    status: 'queued',\n    transformed: {\n      title: payload.title || payload.caption || payload.subject || defTitle(),\n      body: payload.body || payload.message || payload.caption || JSON.stringify(payload),\n      meta: payload.meta || {},\n    },\n  },\n}));\nreturn jobs.length ? jobs : [{ json: { ...item, channel: 'primary', status: 'queued' } }];\nfunction defTitle(){ return 'Multi-Platform Social Publisher'; }\n"
      }
    },
    {
      "id": "4d6eb1ff-3571-4dd9-bbd8-bda9d69c095b",
      "name": "Ready to Dispatch?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        840,
        200
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "ef6e6a94-a005-4f50-977e-1debcca62074",
              "leftValue": "={{ $json.status === \"queued\" }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "44f8bd40-5f31-4618-a21f-3b0f5ccfb9a5",
      "name": "Dispatch A (replace me)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1120,
        80
      ],
      "parameters": {
        "method": "POST",
        "url": "https://httpbin.org/post",
        "options": {},
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json) }}"
      }
    },
    {
      "id": "d3e5bdc0-6190-4d0e-ba85-d2317205c624",
      "name": "Dispatch B (replace me)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1120,
        320
      ],
      "parameters": {
        "method": "POST",
        "url": "https://httpbin.org/post",
        "options": {},
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json) }}"
      }
    },
    {
      "id": "5fdc38d0-56b6-4c11-8586-6911df629dd3",
      "name": "Aggregate Results",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1400,
        200
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "const items = $input.all().map(i => i.json);\nreturn [{ json: { ok: true, workflow: 'Multi-Platform Social Publisher', count: items.length, results: items } }];"
      }
    },
    {
      "id": "e85f3f07-a1fe-4b8d-b0ec-f2d2bd215a82",
      "name": "Webhook Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1680,
        200
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $json }}",
        "options": {}
      }
    }
  ],
  "connections": {
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Normalize Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Payload": {
      "main": [
        [
          {
            "node": "Business Logic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Business Logic": {
      "main": [
        [
          {
            "node": "Ready to Dispatch?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ready to Dispatch?": {
      "main": [
        [
          {
            "node": "Dispatch A (replace me)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Dispatch B (replace me)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dispatch A (replace me)": {
      "main": [
        [
          {
            "node": "Aggregate Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dispatch B (replace me)": {
      "main": [
        [
          {
            "node": "Aggregate Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Results": {
      "main": [
        [
          {
            "node": "Webhook Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner"
  },
  "tags": [],
  "meta": {
    "templateCredsSetupCompleted": true,
    "description": "Accepts a content brief via webhook, normalizes captions/hashtags, then fans out posts to X, LinkedIn, Instagram Graph, and TikTok placeholder APIs with per-platform payload shaping."
  },
  "pinData": {}
}