{
  "name": "LinkedIn Friday Personal Post Drafts",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [{ "field": "weeks", "triggerAtDay": [5], "triggerAtHour": 16, "triggerAtMinute": 0 }]
        }
      },
      "name": "Every Friday 4 PM",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [240, 300]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "http://host.docker.internal:3000/api/blog?limit=5",
        "options": {}
      },
      "name": "Fetch Recent Posts",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [440, 200]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "http://host.docker.internal:3000/api/admin/leads?limit=50",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [{ "name": "Authorization", "value": "={{ 'Bearer ' + $env.ADMIN_API_TOKEN }}" }]
        }
      },
      "name": "Fetch Week Leads",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [440, 400]
    },
    {
      "parameters": {
        "model": "mistral-large-latest",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a LinkedIn ghostwriter for Mohammed Cherifi, founder of Hyperion Consulting (B2B AI consulting). Write for his PERSONAL LinkedIn profile (5-10x more reach than company page).\n\nHis positioning: AI strategy + implementation for European businesses. He has 0→25k followers journey. Tone: expert but human, French entrepreneur energy.\n\nWrite 3 post drafts:\n1. LEAD MAGNET — 'Comment X to get [free resource]' format. End with 'Comment GUIDE below 👇'\n2. INSIGHT — based on recent content, one key AI insight with 3 bullet points\n3. HOT TAKE — contrarian opinion on an AI consulting trend (high engagement)\n\nEach post: max 1300 chars, 3-5 hashtags, line breaks for readability.\nSeparate each with: ───────────"
            },
            {
              "role": "user",
              "content": "=Recent Hyperion content:\n{{ JSON.stringify($node['Fetch Recent Posts'].json?.posts?.slice(0,3) ?? [], null, 2) }}\n\nThis week's leads context:\n- HOT leads: {{ $node['Fetch Week Leads'].json.stats?.hot ?? 0 }} (mostly {{ $node['Fetch Week Leads'].json.data?.filter(l => l.tier === 'hot').map(l => l.companyInfo?.industry ?? '?').slice(0,3).join(', ') || 'unknown industries' }})\n\nGenerate the 3 post drafts now."
            }
          ]
        }
      },
      "name": "Mistral Post Drafts",
      "type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
      "typeVersion": 1,
      "position": [680, 300],
      "credentials": { "mistralCloudApi": { "id": "1", "name": "Mistral Cloud" } }
    },
    {
      "parameters": {
        "chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
        "text": "=✍️ *LinkedIn Personal Post Drafts — This Week*\n_Copy-paste to your personal profile_\n\n{{ $json.message.content }}",
        "additionalFields": { "parse_mode": "Markdown" }
      },
      "name": "Telegram Drafts",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "position": [880, 300],
      "credentials": { "telegramApi": { "id": "1", "name": "Telegram Bot" } }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $env.SLACK_WEBHOOK_URL }}",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            { "name": "text", "value": "=✍️ LinkedIn Personal Post Drafts — This Week\nCopy-paste to your personal profile\n\n{{ $json.message.content }}" }
          ]
        },
        "options": {}
      },
      "name": "Notify Slack",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [880, 400]
    }
  ],
  "connections": {
    "Every Friday 4 PM": {
      "main": [
        [
          { "node": "Fetch Recent Posts", "type": "main", "index": 0 },
          { "node": "Fetch Week Leads", "type": "main", "index": 0 }
        ]
      ]
    },
    "Fetch Recent Posts": { "main": [[{ "node": "Mistral Post Drafts", "type": "main", "index": 0 }]] },
    "Fetch Week Leads": { "main": [[{ "node": "Mistral Post Drafts", "type": "main", "index": 0 }]] },
    "Mistral Post Drafts": { "main": [[{ "node": "Telegram Drafts", "type": "main", "index": 0 }, { "node": "Notify Slack", "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" }
}
