{
  "name": "Vorlux AI | Content Repurpose",
  "active": false,
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "content-repurpose",
        "options": { "responseMode": "lastNode" }
      },
      "id": "webhook-trigger",
      "name": "Repurpose Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [220, 300]
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const data = $input.first().json.body || $input.first().json;\nconst content = data.content || data.text || '';\nconst title = data.title || 'Content';\nconst source = data.source || 'blog';\n\nconst variants = [\n  { platform: 'twitter', maxLength: 280, format: 'thread', prompt: `Create a 3-tweet thread from: ${title}. Key points from the content.` },\n  { platform: 'linkedin', maxLength: 3000, format: 'post', prompt: `Create a professional LinkedIn post from: ${title}. Include insights and call-to-action.` },\n  { platform: 'instagram', maxLength: 2200, format: 'caption', prompt: `Create an Instagram caption with hashtags from: ${title}.` },\n  { platform: 'youtube-community', maxLength: 500, format: 'poll', prompt: `Create a YouTube community post with a question related to: ${title}.` },\n  { platform: 'discord', maxLength: 2000, format: 'announcement', prompt: `Create a Discord announcement from: ${title}. Keep it engaging and community-focused.` }\n];\n\nreturn [{ json: { title, content: content.substring(0, 2000), source, variants, taskId: 'repurpose-' + Date.now() } }];"
      },
      "id": "plan-variants",
      "name": "Plan Content Variants",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [460, 300]
    },
    {
      "parameters": {
        "url": "http://host.docker.internal:3010/api/studio/content/repurpose",
        "method": "POST",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ title: $json.title, content: $json.content, variants: $json.variants }) }}",
        "options": { "timeout": 60000 }
      },
      "id": "generate-variants",
      "name": "Generate All Variants",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [700, 300]
    },
    {
      "parameters": {
        "url": "http://host.docker.internal:3010/api/content/library",
        "method": "POST",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ type: 'repurposed', sourceTitle: $('Plan Content Variants').first().json.title, variants: $json.variants || $json.data }) }}",
        "options": { "timeout": 15000 }
      },
      "id": "save-to-library",
      "name": "Save to Content Library",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [940, 300]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{$env.DISCORD_CONTENT_WEBHOOK}}",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ content: '♻️ **Content Repurposed**\\nSource: ' + $('Plan Content Variants').first().json.title + '\\nVariants created: 5 platforms (Twitter, LinkedIn, Instagram, YouTube, Discord)' }) }}"
      },
      "id": "discord-notify",
      "name": "Discord Notify",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [1180, 300]
    }
  ],
  "connections": {
    "Repurpose Webhook": { "main": [[{ "node": "Plan Content Variants", "type": "main", "index": 0 }]] },
    "Plan Content Variants": { "main": [[{ "node": "Generate All Variants", "type": "main", "index": 0 }]] },
    "Generate All Variants": { "main": [[{ "node": "Save to Content Library", "type": "main", "index": 0 }]] },
    "Save to Content Library": { "main": [[{ "node": "Discord Notify", "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" }
}
