{
  "name": "AI Content Repurposer — TurtleTools",
  "nodes": [
    {"parameters":{},"id":"t","name":"Manual Trigger","type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[240,300]},
    {"parameters":{"assignments":{"assignments":[{"id":"u","name":"url","value":"https://example.com/your-blog-post","type":"string"}]}},"id":"s","name":"Set Blog URL","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[440,300]},
    {"parameters":{"url":"={{ $json.url }}","options":{"response":{"response":{"responseFormat":"text"}}}},"id":"f","name":"Fetch Blog Content","type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[640,300]},
    {
      "parameters": {
        "jsCode": "const raw = $input.first().json.data || '';\n// Strip HTML tags to get clean text\nconst text = raw.replace(/<[^>]*>/g, ' ').replace(/\\s+/g, ' ').trim().substring(0, 2000);\n\nreturn [{json: {\n  model: 'anthropic/claude-sonnet-4-20250514',\n  messages: [\n    {\n      role: 'system',\n      content: 'You are a content repurposing expert. Given a blog post, create THREE versions:\\n\\n1. **twitter_thread**: Array of 5-7 tweets, each under 280 chars, hook in tweet 1\\n2. **linkedin_post**: Professional tone, 150-200 words, strong hook, end with question\\n3. **email_blurb**: Casual, 100 words, one key insight, CTA to read full post\\n\\nReturn as JSON with keys: twitter_thread (array), linkedin_post (string), email_blurb (string)'\n    },\n    {\n      role: 'user',\n      content: 'Repurpose this blog post:\\n\\n' + text\n    }\n  ],\n  max_tokens: 2000,\n  response_format: { type: 'json_object' }\n}}];"
      },
      "id":"c","name":"Build AI Request","type":"n8n-nodes-base.code","typeVersion":2,"position":[840,300]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://openrouter.ai/api/v1/chat/completions",
        "sendHeaders": true,
        "headerParameters": {"parameters":[
          {"name":"Authorization","value":"Bearer YOUR_OPENROUTER_KEY"},
          {"name":"Content-Type","value":"application/json"}
        ]},
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json) }}"
      },
      "id":"a","name":"Call OpenRouter","type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[1040,300]
    },
    {"parameters":{"assignments":{"assignments":[{"id":"r","name":"repurposed","value":"={{ JSON.parse($json.choices[0].message.content) }}","type":"object"}]}},"id":"e","name":"Extract Results","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[1240,300]}
  ],
  "connections": {
    "Manual Trigger":{"main":[[{"node":"Set Blog URL","type":"main","index":0}]]},
    "Set Blog URL":{"main":[[{"node":"Fetch Blog Content","type":"main","index":0}]]},
    "Fetch Blog Content":{"main":[[{"node":"Build AI Request","type":"main","index":0}]]},
    "Build AI Request":{"main":[[{"node":"Call OpenRouter","type":"main","index":0}]]},
    "Call OpenRouter":{"main":[[{"node":"Extract Results","type":"main","index":0}]]}
  },
  "settings":{"executionOrder":"v1"},
  "meta": {
    "description": "Turn one blog post into platform-optimized content for X/Twitter, LinkedIn, and email newsletters. Uses a Code node to build the AI request and OpenRouter for the LLM call. Verified working in n8n 2.4.6.",
    "category": "Content",
    "difficulty": "beginner",
    "author": "TurtleTools",
    "tested": "2026-02-02, n8n 2.4.6, google/gemini-2.0-flash-001 via OpenRouter"
  }
}
