{
  "name": "Content Repurposing Workflow - Template (Saba Automations)",
  "nodes": [
    {
      "id": "1",
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "position": [
        250,
        300
      ],
      "parameters": {}
    },
    {
      "id": "2",
      "name": "Upload Video (Trigger)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        450,
        300
      ],
      "parameters": {
        "requestMethod": "POST",
        "url": "={{$json[\"video_url\"] || ''}}",
        "responseFormat": "file"
      }
    },
    {
      "id": "3",
      "name": "Transcribe (Whisper/OpenAI)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        650,
        300
      ],
      "parameters": {
        "requestMethod": "POST",
        "url": "https://api.openai.com/v1/audio/transcriptions",
        "options": {},
        "headers": {
          "Authorization": "Bearer {{ $credentials.openaiApiKey.apiKey }}",
          "Content-Type": "multipart/form-data"
        },
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "file",
              "value": "={{$binary[\"data\"]}}"
            },
            {
              "name": "model",
              "value": "whisper-1"
            },
            {
              "name": "language",
              "value": "en"
            }
          ]
        }
      }
    },
    {
      "id": "4",
      "name": "Generate 5 LinkedIn Posts",
      "type": "n8n-nodes-base.function",
      "position": [
        850,
        180
      ],
      "parameters": {
        "functionCode": "const transcript = items[0].json.text || items[0].json.transcript || '';\nconst prompts = [];\nfor (let i = 0; i < 5; i++) {\n  prompts.push({ json: { platform: 'LinkedIn', post: `Post ${i+1}: ${transcript.slice(0, 240)}... (repurpose #${i+1})` } });\n}\nreturn prompts;"
      }
    },
    {
      "id": "5",
      "name": "Slice into Shorts (SplitInBatches placeholder)",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        850,
        360
      ],
      "parameters": {
        "batchSize": 10,
        "options": {}
      }
    },
    {
      "id": "6",
      "name": "Create 10 Tweets",
      "type": "n8n-nodes-base.function",
      "position": [
        1050,
        360
      ],
      "parameters": {
        "functionCode": "const text = items[0].json.text || '';\nconst tweets = [];\nfor (let i = 0; i < 10; i++) {\n  tweets.push({ json: { platform: 'Twitter', tweet: `${text.slice(i*50, i*50+240)} #repurpose #clip${i+1}` } });\n}\nreturn tweets;"
      }
    },
    {
      "id": "7",
      "name": "Schedule Posts (Buffer/Meta API)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1250,
        300
      ],
      "parameters": {
        "requestMethod": "POST",
        "url": "https://api.buffer.com/1/updates/create.json",
        "headers": {
          "Authorization": "Bearer {{ $credentials.bufferApi.apiKey }}",
          "Content-Type": "application/json"
        },
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "text",
              "value": "={{$json[\"postText\"] || $json[\"tweet\"] || $json[\"post\"]}}"
            },
            {
              "name": "profile_ids[]",
              "value": "={{$credentials.bufferProfiles.ids.join(',')}}"
            },
            {
              "name": "scheduled_at",
              "value": "={{new Date().toISOString()}}"
            }
          ]
        }
      }
    },
    {
      "id": "8",
      "name": "NoOp / Finish",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1450,
        300
      ],
      "parameters": {}
    }
  ],
  "connections": {
    "Start": {},
    "1": {},
    "2": {
      "main": [
        [
          {
            "node": "3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3": {
      "main": [
        [
          {
            "node": "4",
            "type": "main",
            "index": 0
          },
          {
            "node": "5",
            "type": "main",
            "index": 0
          },
          {
            "node": "6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4": {
      "main": [
        [
          {
            "node": "7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5": {
      "main": [
        [
          {
            "node": "7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6": {
      "main": [
        [
          {
            "node": "7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7": {
      "main": [
        [
          {
            "node": "8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {}
}