{
  "name": "LLM LinkedIn Post Generator",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "linkedin-post",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "llpg0001-0001-4000-8000-000000000001",
      "name": "Receive Topic Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [240, 300]
    },
    {
      "parameters": {
        "resource": "text",
        "operation": "message",
        "modelId": {
          "__rl": true,
          "value": "gpt-4o",
          "mode": "list"
        },
        "messages": {
          "values": [
            {
              "content": "Write a compelling LinkedIn post about the following topic. The post should: start with a hook that grabs attention in the first line, share a personal insight or unique angle, include 3-5 short paragraphs with line breaks for readability, add 5-7 relevant hashtags at the end, and stay under 1300 characters total. Tone: {{ $json.body.tone || 'professional and conversational' }}.\n\nTopic: {{ $json.body.topic }}\nTarget audience: {{ $json.body.audience || 'professionals and entrepreneurs' }}"
            }
          ]
        },
        "options": {
          "temperature": 0.7,
          "maxTokens": 600
        }
      },
      "id": "llpg0001-0002-4000-8000-000000000002",
      "name": "Generate LinkedIn Post",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1,
      "position": [460, 300]
    },
    {
      "parameters": {
        "jsCode": "const post = $input.item.json.message.content;\nconst charCount = post.length;\nconst wordCount = post.split(/\\s+/).length;\nreturn [{ json: { post_text: post, character_count: charCount, word_count: wordCount, within_limit: charCount <= 1300, topic: $('Receive Topic Webhook').item.json.body.topic, generated_at: new Date().toISOString() } }];"
      },
      "id": "llpg0001-0003-4000-8000-000000000003",
      "name": "Validate and Format Post",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [680, 300]
    },
    {
      "parameters": {
        "person": "={{ $env.LINKEDIN_PERSON_URN }}",
        "text": "={{ $json.post_text }}",
        "additionalFields": {}
      },
      "id": "llpg0001-0004-4000-8000-000000000004",
      "name": "Publish to LinkedIn",
      "type": "n8n-nodes-base.linkedIn",
      "typeVersion": 1,
      "position": [900, 300]
    }
  ],
  "connections": {
    "Receive Topic Webhook": {
      "main": [[{ "node": "Generate LinkedIn Post", "type": "main", "index": 0 }]]
    },
    "Generate LinkedIn Post": {
      "main": [[{ "node": "Validate and Format Post", "type": "main", "index": 0 }]]
    },
    "Validate and Format Post": {
      "main": [[{ "node": "Publish to LinkedIn", "type": "main", "index": 0 }]]
    }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "meta": {},
  "pinData": {}
}
