{
  "name": "Content Generator (Sub-Workflow)",
  "nodes": [
    {
      "parameters": {},
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ {\n  prompt: `Create engaging content about: ${$json.title}\\n\\nURL: ${$json.url}\\nSummary: ${$json.summary}\\n\\nRequirements:\\n- Professional tone\\n- 2-3 paragraphs\\n- Include relevant context`,\n  title: $json.title,\n  url: $json.url\n} }}",
        "options": {}
      },
      "name": "Build Prompt",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.anthropic.com/v1/messages",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "anthropicApi",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "anthropic-version",
              "value": "2023-06-01"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ {\n  model: 'claude-3-5-sonnet-20241022',\n  max_tokens: 400,\n  temperature: 0.7,\n  messages: [{\n    role: 'user',\n    content: $json.prompt\n  }]\n} }}",
        "options": {}
      },
      "name": "Call Anthropic API",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ {\n  generatedContent: $json.content[0].text,\n  title: $('Build Prompt').first().json.title,\n  url: $('Build Prompt').first().json.url,\n  model: $json.model,\n  tokensUsed: $json.usage.total_tokens,\n  generatedAt: new Date().toISOString()\n} }}",
        "options": {}
      },
      "name": "Extract Response",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        900,
        300
      ]
    }
  ],
  "connections": {
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "Build Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Prompt": {
      "main": [
        [
          {
            "node": "Call Anthropic API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call Anthropic API": {
      "main": [
        [
          {
            "node": "Extract Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}