{
  "name": "LinkedIn Post Generator - template",
  "nodes": [
    {
      "id": "db3a4a3d-61b5-4563-85a3-f1d6f873caf7",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        976,
        -352
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "6232fba4-479d-4d09-9500-55fbaf47cb2c",
              "name": "=Title",
              "type": "string",
              "value": "={{$json.output.match(/Title:\\s*([\\s\\S]*?)(?:\\n|$)/)?.[1]}}"
            },
            {
              "id": "5aaf55f5-cecc-4545-83c7-0250d6322005",
              "name": "Link",
              "type": "string",
              "value": "={{$json.output.extractUrl()}}"
            },
            {
              "id": "f4ff9150-3496-4ead-b5af-d23afbfeb7b5",
              "name": "Summary",
              "type": "string",
              "value": "={{$json.output.match(/Summary:\\s*([^]+?)Insight & Commentary:/s)?.[1]?.trim()}}"
            },
            {
              "id": "b866a8cb-a4da-45cc-87af-8f9801c57970",
              "name": "Insight & Commentary",
              "type": "string",
              "value": "={{$json.output.match(/Insight & Commentary:\\s*([^]+)/s)?.[1]}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5e307df6-2dfa-4563-b0f4-42a9e1ec3d2e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -480
      ],
      "parameters": {
        "color": 3,
        "width": 1520,
        "height": 392,
        "content": "# **Step 1: Collect and Analyze Links**\n"
      },
      "typeVersion": 1
    },
    {
      "id": "41ab2eb9-3208-454b-b90e-69cdad1696bc",
      "name": "Content collector",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        624,
        -352
      ],
      "parameters": {
        "text": "=Read the article {{ $json.chatInput }} and do as requiered by your role",
        "options": {
          "systemMessage": "=Today is: {{ $now.format('yyyy-MM-dd') }}\nArticle link: {{ $json.chatInput }}\n\nROLE: \nYou are a sharp research and insight assistant. Your mission is to analyze articles and content shared by user through Telegram, focusing on AI automations and workflows, AI trends, operations, sports, and technology. Your task is to summarize these articles and extract meaningful insights for a tech-savvy audience. Store your summaries and recommendations in an Airtable.\n\nInfuse user’s voice: a blend of formal, direct, and witty. Avoid being too serious and maintain a tone that is professional yet engaging. Incorporate user's style by creating thought-provoking summaries that encourage readers to think and consider changing their current practices.\n\nCAPABILITIES:\n\n- Receive articles from user via Telegram.\n- Access, read, and interpret the full content of each article.\n- Identify key points, themes, and innovations relevant to AI, operations, and technology.\n- Provide concise, insightful summaries in a formal, direct, and witty tone.\n- Add user’s perspective and commentary, using a style that is short, to the point, and avoids unnecessary seriousness.\n- Log the summaries and insights into Airtable with fields: Title, Link, Summary, Insight & Commentary.\n\nINPUT HANDLING:\n\n- Upon receiving a link:\n  - Visit the page and read the full article.\n  - Extract the article’s title and URL.\n  - Write a concise summary, focusing on AI automation, efficiency, and innovation.\n  - Under \"Insight & Commentary,\" provide a witty analysis reflective of user’s style and perspective.\n\n- If given text without a link:\n  - Use the entire text as the Title.\n  - Write a summary of the main ideas.\n  - Provide commentary that ties back to user’s core themes and perspectives.\n\nRESPONSE GUIDELINES:\n\n- Be concise, direct, and insightful.\n- Maintain a thought-leadership tone: confident and witty.\n- Focus on solutions, innovation, and efficiency.\n- Avoid politics and overly serious topics.\n\nLIMITATIONS:\n\n- If the article is inaccessible, note this clearly in the Summary field.\n- If the article is already logged (duplicate), reply with “You already shared this with me, please send a different one.”\n- Skip irrelevant content and avoid repeating the same commentary across entries.\n- Do not delve into politics or overly serious personal subjects.\n\nEXAMPLE OUTPUT:\n\nTitle: \"AI Trends Transforming Operations in 2023\"\n\nLink: https://example.com/ai-trends-2023\n\nSummary: The article explores how AI trends, including automated workflows and intelligent systems, are revolutionizing operational efficiency across industries. Key innovations include predictive analytics for decision-making and AI-driven process automation to reduce manual tasks.\n\nInsight & Commentary: \"Imagine your workflow humming along like a well-oiled machine, where AI takes the mundane off your plate. That's not just the future—it's happening now. Embrace these trends or risk being left behind. At Demandbox, we believe efficiency isn't just about doing things faster; it's about doing them smarter. Let's lead this change.\"\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "a7623437-eaea-4532-8095-c9e8cbb7b549",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -64,
        -240
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "3ca47971-d78c-426d-8606-67bd8c9d43f8",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2032,
        -352
      ],
      "parameters": {
        "text": "={{ $('Edit Fields').item.json.Summary }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8517de48-6fd4-4eec-aa2e-ef860bf05680",
      "name": "If generate",
      "type": "n8n-nodes-base.if",
      "position": [
        288,
        32
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fb91ed8a-73f1-4f9f-bae1-5ebbae9a4501",
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $json.message.chat.id }}",
              "rightValue": "={{ $json.message.from.id }}"
            },
            {
              "id": "f30da9f0-a56c-4bae-a73f-0517b521c11a",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.message.text }}",
              "rightValue": "generate"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "600d6330-cd34-4c03-9486-12022aeda73c",
      "name": "Clean Code",
      "type": "n8n-nodes-base.code",
      "position": [
        1200,
        -352
      ],
      "parameters": {
        "jsCode": "const fields = $input.all().map((item) => item.json);\nreturn fields;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "422e62e0-06ac-482c-b345-956fe22e712f",
      "name": "article or generate?",
      "type": "n8n-nodes-base.if",
      "position": [
        176,
        -240
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "dc4561f4-6560-4e5d-b540-e5e0b7aef3e7",
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $json.message.chat.id }}",
              "rightValue": "={{ $json.message.from.id }}"
            },
            {
              "id": "469202b0-eac6-48c9-a74f-76607dd8d6e2",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.message.text }}",
              "rightValue": "=https://"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "99cd2918-f4df-477e-ad9b-a0bcf245346d",
      "name": "Set Field",
      "type": "n8n-nodes-base.set",
      "position": [
        416,
        -352
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9afa2e7f-0c53-462d-ae0c-66b622787297",
              "name": "=chatInput",
              "type": "string",
              "value": "={{ $('Telegram Trigger').item.json.message.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b26e0137-cb6a-44c1-bf30-64b8ef5705fc",
      "name": "Append row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1584,
        -352
      ],
      "parameters": {
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "96336918-4307-4d5d-9d83-60c21ff90b89",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1392,
        -480
      ],
      "parameters": {
        "color": 4,
        "width": 856,
        "height": 392,
        "content": "# **Step 2: Store data and send a summary message**\n"
      },
      "typeVersion": 1
    },
    {
      "id": "3e6333d6-ea90-4874-8f07-c2a0bf9b9c6a",
      "name": "Get row(s) in sheet in Google Sheets",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        848,
        272
      ],
      "parameters": {
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "58edfc02-05a3-4bce-a91f-5b54125e470b",
      "name": "The post",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1120,
        16
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "209e9e99-fb2c-4d8b-951d-faaace17ff92",
      "name": "Generate LinkedIn Post",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        704,
        16
      ],
      "parameters": {
        "text": "Using the information you have, create a well written viral LinkedIn post ",
        "options": {
          "systemMessage": "=ROLE: \nYou are a LinkedIn content assistan. Your mission is to transform insights from user's curated summaries into three original LinkedIn posts each week. Craft posts that are educational, engaging, and reflect user’s voice and vision on AI automations, workflows, and technological innovation.\n\nuser’s style is formal, direct, and witty—short and to the point. Posts should provoke thought and encourage change without being overly serious.\n\nCAPABILITIES:\n- When asked to generate a LinkedIn post, review the recent articles in the AirTable and generate the post. \n- Scan the Airtable for unused insights and summaries.\n- Evaluate entries to determine their potential to resonate with a tech-savvy audience.\n- Generate three different LinkedIn posts weekly, grounded in user’s style and voice.\n- Ensure posts align with themes of AI trends, operations, and technology while being thought-leadership focused.\n- Flag used content to prevent duplication.\n\nINPUT HANDLING:\n\n- Identify new content: Query Airtable for unused summaries. If none are available, find recent articles related to user’s themes.\n- Select compelling topics based on novelty and relevance.\n- Compose three posts per week:\n  - Start with an engaging hook.\n  - Develop the core argument in concise paragraphs.\n  - Incorporate user’s beliefs and encourage readers to think differently.\n  - End with a thought-provoking statement or call to action.\n\nRESPONSE GUIDELINES:\n\n- Voice: Write in the first person as user (\"I\"/\"we\"). Maintain a confident, direct tone with a touch of wit.\n- Length: Aim for ~150–250 words per post. Use short sentences and paragraphs for clarity.\n- Content: Focus on AI, technology, and operations. Avoid politics and overly serious topics.\n- Accuracy: Never invent facts. Use reputable sources for supporting data. If data is uncertain, omit it.\n\nLIMITATIONS:\n- Before you generate the LinkedIn post, you MUST check first \"the rules tool\" and take into consideration everything is written inside, those are your do and don't guideliness for you to keep in mind. \n- Do not reuse content already posted on LinkedIn.\n- Avoid personal anecdotes and politics.\n- If Airtable has no new entries, inform user and suggest searching for fresh articles.\n\nEXAMPLE OUTPUT:\n\nPost 1: \n\"AI automations are not just a trend—they're a necessity. In 2023, businesses that leverage AI to enhance operations will lead the pack. At Demandbox, we see AI as the key to unlocking unprecedented efficiencies. It's time to rethink how we work—let's innovate, optimize, and transform.\"\n\nPost 2: \n\"Imagine a world where operations run smoothly, effortlessly—powered by AI. That's the future we're building at Demandbox. By automating workflows, we're freeing up time for what truly matters: innovation. How are you using AI to reshape your operations?\"\n\nPost 3: \n\"Efficiency and innovation go hand in hand. As we embrace AI trends, let's focus on improving the way we work. At Demandbox, we're committed to making tech more than just a tool—it's a game-changer. Join us as we redefine efficiency in the tech world.\"\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "f2cb565d-2d8f-4a63-ad85-9cb1a71512ae",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        -1056
      ],
      "parameters": {
        "width": 832,
        "height": 1648,
        "content": "# Generate LinkedIn posts from articles you read\n---\n\n⚙️ **How It Works**\n\n**1️⃣ User Sends an Article Link (Telegram Bot)**    The workflow listens to incoming messages.\nWhen the message contains a URL → it triggers the AI analysis process.\n\n**2️⃣ AI Analyzes the Article**\nThe workflow:\n* Fetches the article content\n* Summarizes it\n* Extracts insights, structure, and key arguments\n* Stores metadata such as title, summary, tone requested, and timestamp\n---\n\n**3️⃣ Data Saved Into Google Sheets**\nEvery article is saved into a Google Sheet with fields like:\n* Date\n* Title\n* Link\n* Summary\n* Insights Commentary\n\nThis becomes your **content library** for future posts.\n\n### **4️⃣ User Requests a Post with “generate”**\nWhen the user writes **“generate”** in Telegram:\n* An IF node detects the keyword\n* A new AI step creates a LinkedIn-style post\n* The post is based on the *most recent* stored article\n  (or any logic you configure — e.g., random, oldest-first, custom tone, etc.)\n\n\n### **5️⃣ Workflow Sends Back a Polished LinkedIn Post**\nThe workflow returns a final, formatted LinkedIn post to the user.\nYou can also optionally:\n* Add hashtags automatically\n* Generate multiple options\n* Or send the post directly to LinkedIn via integration\n\n# ⚙️ Requirements\n **🔑 1. OpenAI Credentials** \nThe credential you select will be used in the LLM: Generate Idea & Caption (GPT-4.1) and LLM\n\n**📊 2. Google Sheets Connection**\nRequired for storing article data. **Credentials → Google → Google Sheets OAuth2**\n\nMinimum recommended fields:\n* Date\n* Title\n* Link\n* Summary\n* Insights Commentary\n\n**The workflow assumes these columns exist.**\n\n\n**🤖 3. Telegram Bot Setup**\nYou must:\n1. Create a bot via **@BotFather**\n2. Add the token inside **Telegram Trigger**\n3. Make sure the bot has permission to receive messages\n\n### **🧠 4. Customize the LinkedIn Post Prompt**\nInside “Generate LinkedIn Post” node, you can edit:\n\n* Tone (professional, storytelling, punchy, etc.)\n* Length\n* CTA\n* Hashtags\n* Personal voice\n\nChange it acording to your needs and style"
      },
      "typeVersion": 1
    },
    {
      "id": "ab17ec27-9393-49cd-bdad-6df3390f5506",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        624,
        -208
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "a265b2fb-ca43-4b4e-9b6e-9a34bb249111",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        640,
        288
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "b790c674-ddfd-4ef9-96e1-7932e4411a8a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -80
      ],
      "parameters": {
        "color": 6,
        "width": 1520,
        "height": 672,
        "content": "# **Step 3: LinkedIn post generator on demand**\nOnce the user asks to \"Generate\" a post"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Set Field": {
      "main": [
        [
          {
            "node": "Content collector",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Code": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Clean Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If generate": {
      "main": [
        [
          {
            "node": "Generate LinkedIn Post",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "article or generate?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Content collector": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Content collector",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Generate LinkedIn Post",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "article or generate?": {
      "main": [
        [
          {
            "node": "Set Field",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If generate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate LinkedIn Post": {
      "main": [
        [
          {
            "node": "The post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet in Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "Generate LinkedIn Post",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "active": false
}
