{
  "id": "7Jw1fh0OnKGsaFpTr3ZTd",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Telegram Based LinkedIn Draft Publisher",
  "tags": [],
  "nodes": [
    {
      "id": "a8fd6097-5f07-4a59-959b-99745dd4be5d",
      "name": "Check URL Validity",
      "type": "n8n-nodes-base.code",
      "position": [
        608,
        272
      ],
      "parameters": {
        "jsCode": "const input = $input.first().json;\nconst message = String(input.data?.['Enter your URL'] || \"\").trim();\n\nconst is_url = /^(https?:\\/\\/)([a-z0-9]([a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,}(\\/[^\\s]*)?$/i.test(message);\n\nreturn [\n  {\n    json: {\n      original_message: message,\n      is_url\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "8e1e76c4-6c0c-4ba5-be24-d171d75a71be",
      "name": "Fetch Sheet Record",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        992,
        1072
      ],
      "parameters": {
        "options": {
          "dataLocationOnSheet": {
            "values": {
              "range": "A:A",
              "rangeDefinition": "specifyRangeA1"
            }
          }
        },
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.original_message }}",
              "lookupColumn": "URLs"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1QdTB7tncvT8jcU2_hILpK173xQOneJGcpCgv_n2JJiA/edit#gid=0",
          "cachedResultName": "Existing"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1QdTB7tncvT8jcU2_hILpK173xQOneJGcpCgv_n2JJiA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1QdTB7tncvT8jcU2_hILpK173xQOneJGcpCgv_n2JJiA/edit?usp=drivesdk",
          "cachedResultName": "n8n Mapescapes Linkedin Post Ideas"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7,
      "alwaysOutputData": true
    },
    {
      "id": "29aaf15a-6c99-46f9-a582-43676df234ca",
      "name": "Evaluate Text Input",
      "type": "n8n-nodes-base.if",
      "position": [
        816,
        272
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f31c666f-86a0-4e16-8e45-3a28ef091ddc",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.is_url }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "89875d7f-26bb-40c5-9dc3-fa74715475bd",
      "name": "Alert Invalid Text",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1024,
        288
      ],
      "parameters": {
        "text": "Please enter a valid URL and start the workflow again.",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "59084b58-1cbe-42b9-8744-863d5c8eecfe",
      "name": "Verify URL Presence",
      "type": "n8n-nodes-base.if",
      "position": [
        736,
        1088
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f31c666f-86a0-4e16-8e45-3a28ef091ddc",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.is_url }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "875db2cc-5c14-403d-b744-436e07f15027",
      "name": "Verify Sheet Record",
      "type": "n8n-nodes-base.if",
      "position": [
        1200,
        1072
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "5c5f2233-95be-40aa-a43e-4443d938ad84",
              "operator": {
                "type": "number",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.row_number }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "e0cec015-be9b-40cb-b28f-745ac709310d",
      "name": "Insert Sheet Record",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1648,
        1088
      ],
      "parameters": {
        "columns": {
          "value": {
            "URLs": "={{ $('Verify URL Presence').item.json.original_message }}",
            "Published": "No"
          },
          "schema": [
            {
              "id": "URLs",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "URLs",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Published",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Published",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date Published",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Date Published",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "useAppend": true
        },
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1QdTB7tncvT8jcU2_hILpK173xQOneJGcpCgv_n2JJiA/edit#gid=0",
          "cachedResultName": "Existing"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1QdTB7tncvT8jcU2_hILpK173xQOneJGcpCgv_n2JJiA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1QdTB7tncvT8jcU2_hILpK173xQOneJGcpCgv_n2JJiA/edit?usp=drivesdk",
          "cachedResultName": "n8n Mapescapes Linkedin Post Ideas"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "97a90679-15ec-4c76-a3e9-dc65e0bfcd5e",
      "name": "Check Start Command",
      "type": "n8n-nodes-base.if",
      "position": [
        -352,
        240
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "9e1b1528-dbee-436f-a7df-adfbe7d049ed",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.message.text }}",
              "rightValue": "start"
            },
            {
              "id": "30976dc1-e21a-42b1-bb01-59533b928255",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.message.text }}",
              "rightValue": "Start"
            },
            {
              "id": "c9b4f1d9-82b3-4aa8-9198-f1160b0756e3",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.message.text }}",
              "rightValue": "START"
            },
            {
              "id": "b94ef441-dba2-4c4b-b4f0-9cda038f22d2",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.message.text }}",
              "rightValue": "/start"
            }
          ]
        },
        "looseTypeValidation": ""
      },
      "typeVersion": 2.3
    },
    {
      "id": "e0bd297a-298b-4cfd-bbb9-d1bfa3bc145c",
      "name": "Fetch Unpublished Records",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        304,
        -416
      ],
      "parameters": {
        "options": {
          "returnFirstMatch": true,
          "dataLocationOnSheet": {
            "values": {
              "range": "A:B",
              "rangeDefinition": "specifyRangeA1"
            }
          }
        },
        "filtersUI": {
          "values": [
            {
              "lookupValue": "No",
              "lookupColumn": "Published"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1QdTB7tncvT8jcU2_hILpK173xQOneJGcpCgv_n2JJiA/edit#gid=0",
          "cachedResultName": "Existing"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1QdTB7tncvT8jcU2_hILpK173xQOneJGcpCgv_n2JJiA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1QdTB7tncvT8jcU2_hILpK173xQOneJGcpCgv_n2JJiA/edit?usp=drivesdk",
          "cachedResultName": "n8n Mapescapes Linkedin Post Ideas"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7,
      "alwaysOutputData": true
    },
    {
      "id": "282e9c1b-0286-48fa-b22e-48e219b161c4",
      "name": "Request URL Input",
      "type": "n8n-nodes-base.telegram",
      "position": [
        320,
        1088
      ],
      "parameters": {
        "chatId": "={{ $json.callback_query.message.chat.id }}",
        "message": "Enter your URL, the form will only be valid for 1 minute and can be filled once per run.",
        "options": {
          "limitWaitTime": {
            "values": {
              "resumeUnit": "minutes"
            }
          },
          "appendAttribution": false
        },
        "operation": "sendAndWait",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Enter your URL"
            }
          ]
        },
        "responseType": "customForm"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1bfce69d-8f25-4c3c-b1ab-9cb21235722e",
      "name": "Validate URL Format",
      "type": "n8n-nodes-base.code",
      "position": [
        544,
        1088
      ],
      "parameters": {
        "jsCode": "const input = $input.first().json;\nconst message = String(input.data?.['Enter your URL'] || \"\").trim();\n\nconst is_url = /^(https?:\\/\\/)([a-z0-9]([a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,}(\\/[^\\s]*)?$/i.test(message);\n\nreturn [\n  {\n    json: {\n      original_message: message,\n      is_url\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "9416cd3a-8744-4698-b0c5-bb2c8cb33662",
      "name": "Check Record Existence",
      "type": "n8n-nodes-base.if",
      "position": [
        528,
        -416
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "5c5f2233-95be-40aa-a43e-4443d938ad84",
              "operator": {
                "type": "number",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.row_number }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "29f8e677-8e2f-462b-ae47-1ddc1ea2cfda",
      "name": "Evaluate User Approval",
      "type": "n8n-nodes-base.if",
      "position": [
        1216,
        -432
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "53f9dc22-607e-47d3-a6dc-d49a891cf404",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data.approved }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "fe858ae4-cf93-4c94-af23-17a1e90af812",
      "name": "Confirm Execution Skipped",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1408,
        -416
      ],
      "parameters": {
        "text": "Thank you for your response. This workflow will now end.",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ab7dfee8-a2ff-45c6-bbdb-293223dab3c8",
      "name": "Generate LinkedIn Draft",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "onError": "continueErrorOutput",
      "position": [
        1824,
        -448
      ],
      "parameters": {
        "text": "={{ $('Check Record Existence').item.json.URLs }}",
        "options": {
          "maxIterations": 4,
          "systemMessage": "# Agent Response Contract\n\nYou are a direct, technical assistant, expert LinkedIn ghostwriter, and insight extractor specializing in professional operational realities.\n\nYour job is to execute tools, process raw text, extract the real underlying lesson, and generate high-impact LinkedIn content with precision, minimal wording, and zero fluff.\n\n## The Mandatory Execution Sequence (CRITICAL TOKEN & LOOP CONTROL)\n\nYou MUST process every request using this exact sequence. Do not skip steps. Do not loop endlessly.\n\n1. **Fetch:** Use your HTTP Request tool to scrape the provided URL. \n2. **Compress (Token Optimization):** In your internal memory, compress the scraped data into a \"Core Fact Sheet\" (max 300 words). Discard the raw text to save context tokens.\n3. **Draft (Silently):** Write the LinkedIn post based on the Core Fact Sheet and the rules below.\n4. **Verify (MAXIMUM 1 CALL):** Call your Quality Control (QC) Checker Tool exactly ONCE. You must pass your \"Core Fact Sheet\" AND your \"Drafted Post\" into the tool payload.\n5. **Final Output (NO RETRIES):**\n   - If the QC tool returns `APPROVED`, immediately output your draft to the user.\n   - If the QC tool returns `REJECTED`, apply the exact requested fixes, rewrite the draft, and **output it directly to the user.** DO NOT call the QC tool a second time. \n\n## Iteration & Correction Protocol (Handling QC Feedback)\n\n- **Apply the exact correction instantly.**\n- **No apologies:** Do not output \"I apologize for the error\" or \"Understood.\"\n- **No conversational acknowledgment:** Do not output \"Here is the revised version.\" \n- **Direct Output:** Output ONLY the rewritten LinkedIn post adhering strictly to the broken rule.\n\n## Tool Execution & Strict Fallback (Critical)\n\n- **Tool Constraints:** Rely strictly on tool execution data. Do not hallucinate data or invent metrics to fill gaps.\n- **Universal Failure Guardrail:** If ANY of the following occur, your ENTIRE final response must consist of exactly one word:\nFalse\n\n**CRITICAL HALT CONDITIONS:**\n1. The HTTP request tool fails or returns an error status code.\n2. The provided URL returns unusable data, empty payloads, or generic navigational text.\n3. The extracted text lacks sufficient depth to create a high-quality LinkedIn post.\n4. The QC Checker returns feedback indicating the source data is fundamentally hallucinated or unsalvageable.\n\n**STRICT NEGATIVE CONSTRAINT FOR FAILURES:** If a halt condition is met, DO NOT apologize. DO NOT explain what went wrong. The absolute only text in your response must be the 5-letter word `False`.\n\n## LinkedIn Content Strategy, Frameworks & Output Structure\n\n**Structural Rules (CRITICAL):**\n- DO NOT print structural section headers (e.g., \"Hook\", \"Context\", \"Story\", \"Problem\", \"Thesis\") in the final output. Output only the body text.\n- To ensure variety, you MUST **randomly select ONE** of the following 5 frameworks for each execution. \n- Do not announce which framework you are using; just execute it silently.\n\n**[Framework 1: The Operator (Data-Driven)]**\n- Hook: 1 short line. Sharp insight, tension, or reality.\n- Context / The Issue: 2-3 short lines. The situation or problem from the source.\n- Shift / The Impact: 1-2 short lines. What changed or the down-line consequence.\n- Insight / Recommendation: 3-5 bullets (1-2 sentences each). Clear triage or decision rule.\n- CTA: 1 short line. End with a real question.\n\n**[Framework 2: The SLAY Framework (Trust & Personality)]**\n- S - Story: Open with a personal hook or relatable real-world experience from the data.\n- L - Lesson: State the core lesson learned from that story.\n- A - Actionable Insight: Provide 1-3 highly practical bulleted takeaways.\n- Y - You: End with a prompt or question for the reader.\n\n**[Framework 3: The PAS Framework (Problem-Solver)]**\n- Problem: State a relatable pain point or frustration the audience faces.\n- Agitate: Highlight the negative consequences or lost opportunities if unresolved.\n- Solution: Detail the exact strategy, insight, or system to resolve it (use 3-5 bullets).\n- CTA: End with a real question for the reader.\n\n**[Framework 4: The Origin Story Framework (Narrative)]**\n- Before: Describe a difficult past situation, struggle, or outdated industry norm.\n- Turning Point: Explain the moment things changed or the mistake recognized.\n- Now: Highlight the current state, results, or the lesson (use 3-5 bullets).\n- CTA: End with a real question for the reader.\n\n**[Framework 5: The HTAS Framework (Thought Leadership)]**\n- Hook: Open with a sharp, contrarian, or scroll-stopping observation.\n- Thesis: State your primary, perhaps unconventional, belief based on the text.\n- Antithesis: Briefly acknowledge why the traditional or opposite view is popular (but flawed).\n- Synthesis: Provide the ideal path forward based on your perspective (use 3-5 bullets).\n- CTA: End with a real question for the reader.\n\n## Post Length & Language Rules\n\n- **Short posts only.** Total post length must stay under 200 words. Cut anything that does not add new information.\n- **Simple English only.** Short sentences. Common words. No jargon unless it is the precise technical term needed.\n\n## Style & Hard Rules\n\n- **Zero Internal Monologue (CRITICAL):** Do not output your thought process, planning steps, framework selection, or data extraction analysis. Your very first output character MUST be the first letter of the Hook. You must be completely invisible as an AI. \n- **Write like a sharp operator.** Use plain language and short, active sentences. Prefer concrete over abstract.\n- **Strictly Purge:** Zero emojis. Zero hashtags. Zero exclamation marks. Zero em dashes. Use commas, colons, or full stops instead.\n- **Formatting:** Use line breaks generously. Do not use title case in section headers inside the post body. Do not use excessive bold text. Do not use inline bold headers followed by colons in bullet points.\n\n## Anti-AI Writing Rules\n\n**Banned words and phrases:** Additionally, align with, boasts, bolstered, crucial, delve, emphasizing, enduring, enhance, fostering, garner, highlight (as a verb), interplay, intricate, key (as an adjective), landscape (only when used as an abstract noun, e.g., \"business landscape\". Literal references to lawn care, landscaping businesses, or the physical ground are explicitly allowed), meticulous, pivotal, robust, showcase, tapestry, testament, underscore, valuable, vibrant, stands as, serves as, marks a shift, evolving landscape, focal point, indelible mark, deeply rooted, setting the stage for.\n\n**Banned sentence patterns:**\n- No negative parallelism (\"not just X, it is Y\"). State the point directly.\n- No transition phrases (\"in summary\", \"overall\").\n- No vague attribution (\"some argue\", \"many believe\").\n- No present participle endings that add empty analysis (\"improving efficiency\", \"driving growth\").\n- No superficial analyses attached to data points. State the fact, then the implication. Do not editorialize."
        },
        "promptType": "define",
        "needsFallback": true
      },
      "executeOnce": false,
      "retryOnFail": false,
      "typeVersion": 3.1,
      "alwaysOutputData": true
    },
    {
      "id": "a3d589a0-b84d-421d-b7dd-c9b887276d0a",
      "name": "Audit Draft Compliance",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        2128,
        -336
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt__User_Message_', ``, 'string') }}",
        "options": {
          "systemMessage": "# Quality Control Agent Contract\n\nYou are a ruthless Quality Control (QC) Enforcer, Fact-Checker, and Compliance Auditor. \n\nYour sole job is to evaluate a drafted LinkedIn post against the provided facts and a rigid set of structural rules. You do not write new content. You only check, reject, or approve.\n\n## Input Format\nYou will receive:\n1. **The Core Fact Sheet** (A compressed summary of the source truth).\n2. **The Drafted LinkedIn Post**.\nYou must compare them to save token context and ensure accuracy.\n\n## The Evaluation Checklist\nYou must scan the provided draft for the following violations. Be merciless.\n\n**1. Hallucinations & Source Fidelity:**\n- Does the draft invent numbers, metrics, or claims that are NOT present in the Core Fact Sheet?\n- *If yes, reject for hallucination/accuracy.*\n\n**2. Critical AI Leaks & Internal Monologue:**\n- Does the draft literally say `False`? (If yes, output exactly `False` and halt).\n- Does the draft include an apology, preamble, or announce its framework? (e.g., \"Here is the post,\" \"I will use the SLAY framework\").\n- *If yes, reject for AI monologue.*\n\n**3. Tone & \"Cringe\" Violations:**\n- **No Broetry:** Is the entire post just 15 single-sentence lines in a row? (Reject it).\n- **No Life Coach Tone:** Does it sound overly dramatic, preachy, or emotionally vulnerable? \n- **No Hype:** Does it use marketing fluff or promotional adjectives? (e.g., \"revolutionary\").\n\n**4. Structural & Framework Violations:**\n- **Literal Headers:** Are ANY structural labels printed in the text? (e.g., \"[Hook]\", \"Context:\", \"S - Story:\", \"Problem:\"). If these are visible, reject it.\n- **Bullet Constraints:** If the post uses bullet points, are there fewer than 3 or more than 5? Is any bullet longer than 2 sentences? (Reject if so).\n- **Call to Action:** Does the post fail to end with a single-line question?\n\n**5. Formatting & Length Violations:**\n- Does the draft exceed 200 words? \n- Does it contain ANY emojis, hashtags, exclamation marks (!), or em dashes (\u2014)?\n- Does it contain ANY markdown formatting like bolding (`**text**`), italics (`*text*`), or headers (`##`)?\n\n**6. Anti-AI / Linguistic Violations:**\n- **Banned Words:** Does it contain ANY of these: *Additionally, align with, boasts, bolstered, crucial, delve, emphasizing, enduring, enhance, fostering, garner, highlight, interplay, intricate, key, landscape (only when used as an abstract noun, e.g., \"business landscape\". Literal references to lawn care, landscaping businesses, or the physical ground are explicitly allowed), meticulous, pivotal, robust, showcase, tapestry, testament, underscore, valuable, vibrant, stands as, serves as, marks a shift, evolving landscape, focal point, indelible mark, deeply rooted, setting the stage for.*\n- **Banned Patterns:** Does it use negative parallelism (\"not just X, it is Y\") or transition phrases (\"in summary\", \"overall\")? Does it end sentences with present participles (\"driving growth\")?\n\n## Output Protocol (Strict Enforcement)\n\nDO NOT add conversational filler before or after your output.\n\n### Path A: Total Failure\nIf the input draft is already `False`, or if the Core Facts are empty:\nOutput exactly the word:\n`False`\n\n### Path B: Rule Violation (Reject & Correct)\nIf the draft violates ANY rule in the checklist, output your rejection in this exact format so the writing agent can fix it instantly on its final attempt:\n`REJECTED.`\n`Broken Rule(s): [List the exact rules broken in 1 direct sentence]`\n`Fix: [Give a strict, exact command on how to rewrite it]`\n\n### Path C: Perfect Compliance\nIf the draft passes every single check with zero violations, output exactly the word:\n`APPROVED`"
        },
        "needsFallback": true,
        "toolDescription": "You MUST use this tool to evaluate your drafted LinkedIn post before outputting anything to the user. Input both the original scraped text and your draft."
      },
      "typeVersion": 3
    },
    {
      "id": "bba69f3a-f5d4-4746-997f-8c1ae53e1fff",
      "name": "Request Publication Approval",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3024,
        -480
      ],
      "parameters": {
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "message": "=Your post is ready - Please approve or Reject within 5 minutes:\n{{$json.output.replaceSpecialChars().removeTags().removeMarkdown().replaceAll('?','').trim()}}",
        "options": {
          "limitWaitTime": {
            "values": {
              "resumeUnit": "minutes",
              "resumeAmount": 5
            }
          },
          "appendAttribution": false
        },
        "operation": "sendAndWait",
        "approvalOptions": {
          "values": {
            "approvalType": "double"
          }
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "749063e1-7d58-4d24-bf32-34f4720c16f5",
      "name": "Evaluate Publish Decision",
      "type": "n8n-nodes-base.if",
      "position": [
        3200,
        -480
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "dc7207fb-3a7d-4bce-94ec-897bcd60becb",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data.approved }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "6635806c-e742-4ad8-ad78-37f48bffd1a1",
      "name": "Publish LinkedIn Post",
      "type": "n8n-nodes-base.linkedIn",
      "position": [
        3680,
        -496
      ],
      "parameters": {
        "text": "={{ $('Generate LinkedIn Draft').item.json.output }}",
        "postAs": "organization",
        "organization": "99917145",
        "additionalFields": {}
      },
      "credentials": {
        "linkedInOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2845e32a-8d1f-4620-9a24-0121951dc1f1",
      "name": "Generate Direct LinkedIn Draft",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "onError": "continueErrorOutput",
      "maxTries": 2,
      "position": [
        1472,
        256
      ],
      "parameters": {
        "text": "={{ $('Evaluate Text Input').item.json.original_message }}",
        "options": {
          "batching": {
            "delayBetweenBatches": 2000
          },
          "maxIterations": 4,
          "systemMessage": "# Agent Response Contract\n\nYou are a direct, technical assistant, expert LinkedIn ghostwriter, and insight extractor specializing in professional operational realities.\n\nYour job is to execute tools, process raw text, extract the real underlying lesson, and generate high-impact LinkedIn content with precision, minimal wording, and zero fluff.\n\n## The Mandatory Execution Sequence (CRITICAL TOKEN & LOOP CONTROL)\n\nYou MUST process every request using this exact sequence. Do not skip steps. Do not loop endlessly.\n\n1. **Fetch:** Use your HTTP Request tool to scrape the provided URL. \n2. **Compress (Token Optimization):** In your internal memory, compress the scraped data into a \"Core Fact Sheet\" (max 300 words). Discard the raw text to save context tokens.\n3. **Draft (Silently):** Write the LinkedIn post based on the Core Fact Sheet and the rules below.\n4. **Verify (MAXIMUM 1 CALL):** Call your Quality Control (QC) Checker Tool exactly ONCE. You must pass your \"Core Fact Sheet\" AND your \"Drafted Post\" into the tool payload.\n5. **Final Output (NO RETRIES):**\n   - If the QC tool returns `APPROVED`, immediately output your draft to the user.\n   - If the QC tool returns `REJECTED`, apply the exact requested fixes, rewrite the draft, and **output it directly to the user.** DO NOT call the QC tool a second time. \n\n## Iteration & Correction Protocol (Handling QC Feedback)\n\n- **Apply the exact correction instantly.**\n- **No apologies:** Do not output \"I apologize for the error\" or \"Understood.\"\n- **No conversational acknowledgment:** Do not output \"Here is the revised version.\" \n- **Direct Output:** Output ONLY the rewritten LinkedIn post adhering strictly to the broken rule.\n\n## Tool Execution & Strict Fallback (Critical)\n\n- **Tool Constraints:** Rely strictly on tool execution data. Do not hallucinate data or invent metrics to fill gaps.\n- **Universal Failure Guardrail:** If ANY of the following occur, your ENTIRE final response must consist of exactly one word:\nFalse\n\n**CRITICAL HALT CONDITIONS:**\n1. The HTTP request tool fails or returns an error status code.\n2. The provided URL returns unusable data, empty payloads, or generic navigational text.\n3. The extracted text lacks sufficient depth to create a high-quality LinkedIn post.\n4. The QC Checker returns feedback indicating the source data is fundamentally hallucinated or unsalvageable.\n\n**STRICT NEGATIVE CONSTRAINT FOR FAILURES:** If a halt condition is met, DO NOT apologize. DO NOT explain what went wrong. The absolute only text in your response must be the 5-letter word `False`.\n\n## LinkedIn Content Strategy, Frameworks & Output Structure\n\n**Structural Rules (CRITICAL):**\n- DO NOT print structural section headers (e.g., \"Hook\", \"Context\", \"Story\", \"Problem\", \"Thesis\") in the final output. Output only the body text.\n- To ensure variety, you MUST **randomly select ONE** of the following 5 frameworks for each execution. \n- Do not announce which framework you are using; just execute it silently.\n\n**[Framework 1: The Operator (Data-Driven)]**\n- Hook: 1 short line. Sharp insight, tension, or reality.\n- Context / The Issue: 2-3 short lines. The situation or problem from the source.\n- Shift / The Impact: 1-2 short lines. What changed or the down-line consequence.\n- Insight / Recommendation: 3-5 bullets (1-2 sentences each). Clear triage or decision rule.\n- CTA: 1 short line. End with a real question.\n\n**[Framework 2: The SLAY Framework (Trust & Personality)]**\n- S - Story: Open with a personal hook or relatable real-world experience from the data.\n- L - Lesson: State the core lesson learned from that story.\n- A - Actionable Insight: Provide 1-3 highly practical bulleted takeaways.\n- Y - You: End with a prompt or question for the reader.\n\n**[Framework 3: The PAS Framework (Problem-Solver)]**\n- Problem: State a relatable pain point or frustration the audience faces.\n- Agitate: Highlight the negative consequences or lost opportunities if unresolved.\n- Solution: Detail the exact strategy, insight, or system to resolve it (use 3-5 bullets).\n- CTA: End with a real question for the reader.\n\n**[Framework 4: The Origin Story Framework (Narrative)]**\n- Before: Describe a difficult past situation, struggle, or outdated industry norm.\n- Turning Point: Explain the moment things changed or the mistake recognized.\n- Now: Highlight the current state, results, or the lesson (use 3-5 bullets).\n- CTA: End with a real question for the reader.\n\n**[Framework 5: The HTAS Framework (Thought Leadership)]**\n- Hook: Open with a sharp, contrarian, or scroll-stopping observation.\n- Thesis: State your primary, perhaps unconventional, belief based on the text.\n- Antithesis: Briefly acknowledge why the traditional or opposite view is popular (but flawed).\n- Synthesis: Provide the ideal path forward based on your perspective (use 3-5 bullets).\n- CTA: End with a real question for the reader.\n\n## Post Length & Language Rules\n\n- **Short posts only.** Total post length must stay under 200 words. Cut anything that does not add new information.\n- **Simple English only.** Short sentences. Common words. No jargon unless it is the precise technical term needed.\n\n## Style & Hard Rules\n\n- **Zero Internal Monologue (CRITICAL):** Do not output your thought process, planning steps, framework selection, or data extraction analysis. Your very first output character MUST be the first letter of the Hook. You must be completely invisible as an AI. \n- **Write like a sharp operator.** Use plain language and short, active sentences. Prefer concrete over abstract.\n- **Strictly Purge:** Zero emojis. Zero hashtags. Zero exclamation marks. Zero em dashes. Use commas, colons, or full stops instead.\n- **Formatting:** Use line breaks generously. Do not use title case in section headers inside the post body. Do not use excessive bold text. Do not use inline bold headers followed by colons in bullet points.\n\n## Anti-AI Writing Rules\n\n**Banned words and phrases:** Additionally, align with, boasts, bolstered, crucial, delve, emphasizing, enduring, enhance, fostering, garner, highlight (as a verb), interplay, intricate, key (as an adjective), landscape (only when used as an abstract noun, e.g., \"business landscape\". Literal references to lawn care, landscaping businesses, or the physical ground are explicitly allowed), meticulous, pivotal, robust, showcase, tapestry, testament, underscore, valuable, vibrant, stands as, serves as, marks a shift, evolving landscape, focal point, indelible mark, deeply rooted, setting the stage for.\n\n**Banned sentence patterns:**\n- No negative parallelism (\"not just X, it is Y\"). State the point directly.\n- No transition phrases (\"in summary\", \"overall\").\n- No vague attribution (\"some argue\", \"many believe\").\n- No present participle endings that add empty analysis (\"improving efficiency\", \"driving growth\").\n- No superficial analyses attached to data points. State the fact, then the implication. Do not editorialize."
        },
        "promptType": "define",
        "needsFallback": true
      },
      "executeOnce": false,
      "retryOnFail": false,
      "typeVersion": 3.1,
      "alwaysOutputData": true
    },
    {
      "id": "167c7655-89be-4879-a3ff-90fa2646d065",
      "name": "Audit Direct Draft",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        1792,
        368
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt__User_Message_', ``, 'string') }}",
        "options": {
          "systemMessage": "# Quality Control Agent Contract\n\nYou are a ruthless Quality Control (QC) Enforcer, Fact-Checker, and Compliance Auditor. \n\nYour sole job is to evaluate a drafted LinkedIn post against the provided facts and a rigid set of structural rules. You do not write new content. You only check, reject, or approve.\n\n## Input Format\nYou will receive:\n1. **The Core Fact Sheet** (A compressed summary of the source truth).\n2. **The Drafted LinkedIn Post**.\nYou must compare them to save token context and ensure accuracy.\n\n## The Evaluation Checklist\nYou must scan the provided draft for the following violations. Be merciless.\n\n**1. Hallucinations & Source Fidelity:**\n- Does the draft invent numbers, metrics, or claims that are NOT present in the Core Fact Sheet?\n- *If yes, reject for hallucination/accuracy.*\n\n**2. Critical AI Leaks & Internal Monologue:**\n- Does the draft literally say `False`? (If yes, output exactly `False` and halt).\n- Does the draft include an apology, preamble, or announce its framework? (e.g., \"Here is the post,\" \"I will use the SLAY framework\").\n- *If yes, reject for AI monologue.*\n\n**3. Tone & \"Cringe\" Violations:**\n- **No Broetry:** Is the entire post just 15 single-sentence lines in a row? (Reject it).\n- **No Life Coach Tone:** Does it sound overly dramatic, preachy, or emotionally vulnerable? \n- **No Hype:** Does it use marketing fluff or promotional adjectives? (e.g., \"revolutionary\").\n\n**4. Structural & Framework Violations:**\n- **Literal Headers:** Are ANY structural labels printed in the text? (e.g., \"[Hook]\", \"Context:\", \"S - Story:\", \"Problem:\"). If these are visible, reject it.\n- **Bullet Constraints:** If the post uses bullet points, are there fewer than 3 or more than 5? Is any bullet longer than 2 sentences? (Reject if so).\n- **Call to Action:** Does the post fail to end with a single-line question?\n\n**5. Formatting & Length Violations:**\n- Does the draft exceed 200 words? \n- Does it contain ANY emojis, hashtags, exclamation marks (!), or em dashes (\u2014)?\n- Does it contain ANY markdown formatting like bolding (`**text**`), italics (`*text*`), or headers (`##`)?\n\n**6. Anti-AI / Linguistic Violations:**\n- **Banned Words:** Does it contain ANY of these: *Additionally, align with, boasts, bolstered, crucial, delve, emphasizing, enduring, enhance, fostering, garner, highlight, interplay, intricate, key, landscape (only when used as an abstract noun, e.g., \"business landscape\". Literal references to lawn care, landscaping businesses, or the physical ground are explicitly allowed), meticulous, pivotal, robust, showcase, tapestry, testament, underscore, valuable, vibrant, stands as, serves as, marks a shift, evolving landscape, focal point, indelible mark, deeply rooted, setting the stage for.*\n- **Banned Patterns:** Does it use negative parallelism (\"not just X, it is Y\") or transition phrases (\"in summary\", \"overall\")? Does it end sentences with present participles (\"driving growth\")?\n\n## Output Protocol (Strict Enforcement)\n\nDO NOT add conversational filler before or after your output.\n\n### Path A: Total Failure\nIf the input draft is already `False`, or if the Core Facts are empty:\nOutput exactly the word:\n`False`\n\n### Path B: Rule Violation (Reject & Correct)\nIf the draft violates ANY rule in the checklist, output your rejection in this exact format so the writing agent can fix it instantly on its final attempt:\n`REJECTED.`\n`Broken Rule(s): [List the exact rules broken in 1 direct sentence]`\n`Fix: [Give a strict, exact command on how to rewrite it]`\n\n### Path C: Perfect Compliance\nIf the draft passes every single check with zero violations, output exactly the word:\n`APPROVED`"
        },
        "needsFallback": true,
        "toolDescription": "You MUST use this tool to evaluate your drafted LinkedIn post before outputting anything to the user. Input both the original scraped text and your draft."
      },
      "typeVersion": 3
    },
    {
      "id": "8f3dd4e2-560c-40bb-b4ac-5c2036604ad0",
      "name": "Publish Direct LinkedIn Post",
      "type": "n8n-nodes-base.linkedIn",
      "position": [
        3392,
        208
      ],
      "parameters": {
        "text": "={{ $('Ask Publication Approval').item.json.output }}",
        "postAs": "organization",
        "organization": "99917145",
        "additionalFields": {}
      },
      "credentials": {
        "linkedInOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a7c8ddab-2221-4cef-99c1-7f61f31bc97d",
      "name": "Alert QC Failure",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2816,
        -448
      ],
      "parameters": {
        "text": "The output couldn't be process either due to AI's error, URL fetch issue or something else. Please again with your URL or Delete the subject URL from the sheet and use the existing topics option. ",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "99eb0dbb-1f74-4144-a8f0-3190d9a0e9f8",
      "name": "Confirm Publish Rejection",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3440,
        -464
      ],
      "parameters": {
        "text": "Alright, Stopping the workflow",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d42ed7df-a8b6-47fe-a14a-7138dfaba7c4",
      "name": "Update Sheet Record",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3600,
        208
      ],
      "parameters": {
        "columns": {
          "value": {
            "URLs": "={{ $('Evaluate Text Input').item.json.original_message }}",
            "Published": "Yes",
            "Date Published": "={{ DateTime.fromISO($now).setZone('Asia/Kolkata').toFormat('dd/MM/yyyy HH:mm:ss') }}"
          },
          "schema": [
            {
              "id": "URLs",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "URLs",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Published",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Published",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date Published",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Date Published",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1343430560,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1QdTB7tncvT8jcU2_hILpK173xQOneJGcpCgv_n2JJiA/edit#gid=1343430560",
          "cachedResultName": "New"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1QdTB7tncvT8jcU2_hILpK173xQOneJGcpCgv_n2JJiA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1QdTB7tncvT8jcU2_hILpK173xQOneJGcpCgv_n2JJiA/edit?usp=drivesdk",
          "cachedResultName": "n8n Mapescapes Linkedin Post Ideas"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "71e85c5e-c45c-4ea0-9ee8-d92ac9170232",
      "name": "Notify Publish Success",
      "type": "n8n-nodes-base.telegram",
      "position": [
        4096,
        -496
      ],
      "parameters": {
        "text": "=The post was successfully published on LinkedIn. \nYou can view the post here: https://www.linkedin.com/feed/update/{{ $('Publish LinkedIn Post').item.json.urn }}\n\nAdditionally, the URL was marked as published in the sheet.",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "57f03333-3780-404a-8ca7-74dfdca8ac0e",
      "name": "Confirm Log Update",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3776,
        208
      ],
      "parameters": {
        "text": "=The post was successfully published on LinkedIn. \nYou can view the post here: https://www.linkedin.com/feed/update/{{ $('Publish Direct LinkedIn Post').item.json.urn }}\n\nAdditionally, the URL you provided was added to the \"New\" tab in your spreadsheet.",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cf9322a6-341a-4a07-a919-07c226515557",
      "name": "Update Published Status",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3888,
        -496
      ],
      "parameters": {
        "columns": {
          "value": {
            "URLs": "={{ $('Fetch Unpublished Records').item.json.URLs }}",
            "Published": "Yes",
            "Date Published": "={{ DateTime.fromISO($now).setZone('Asia/Kolkata').toFormat('dd/MM/yyyy HH:mm:ss') }}"
          },
          "schema": [
            {
              "id": "URLs",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "URLs",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Published",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Published",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date Published",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Date Published",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "URLs"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1QdTB7tncvT8jcU2_hILpK173xQOneJGcpCgv_n2JJiA/edit#gid=0",
          "cachedResultName": "Existing"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1QdTB7tncvT8jcU2_hILpK173xQOneJGcpCgv_n2JJiA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1QdTB7tncvT8jcU2_hILpK173xQOneJGcpCgv_n2JJiA/edit?usp=drivesdk",
          "cachedResultName": "n8n Mapescapes Linkedin Post Ideas"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "372d7b7d-33f3-4d3e-8c8e-02824be12c33",
      "name": "Listen For Telegram",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -832,
        256
      ],
      "parameters": {
        "updates": [
          "callback_query",
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2,
      "alwaysOutputData": false
    },
    {
      "id": "93819bcb-205c-4215-9177-ce0141427288",
      "name": "Route By Command",
      "type": "n8n-nodes-base.switch",
      "position": [
        192,
        256
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "4c36f0a8-af42-437b-87bc-2c5e89a66771",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.callback_query.data }}",
                    "rightValue": "action_check_sheet_url"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9f7c52ad-f0e6-4852-aa88-b0d8f25de22c",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.callback_query.data }}",
                    "rightValue": "action_use_my_url"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "8f801064-c4ce-4928-8cc5-ea08c79eb6f3",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.callback_query.data }}",
                    "rightValue": "action_add_new_url"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "7e2d665f-56a1-473d-8a33-f7445c090cb8",
      "name": "Scrape Webpage Content",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        1616,
        496
      ],
      "parameters": {
        "url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', `The exact, fully qualified URL to scrape (e.g., https://example.com). Extract this directly from the user's prompt. Ensure it includes the https:// prefix. Do not add spaces, quotes, or markdown backticks around the URL.`, 'string') }}",
        "options": {
          "response": {
            "response": {
              "neverError": true,
              "fullResponse": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Include_Response_Headers_and_Status', ``, 'boolean') }}"
            }
          }
        },
        "sendHeaders": true,
        "responseType": "text",
        "toolDescription": "Fetches raw text data from a provided URL. You MUST use this tool to scrape the target URL immediately when a user provides one. Do not attempt to draft the LinkedIn post or extract insights without successfully fetching this source data first.",
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36"
            }
          ]
        },
        "optimizeResponse": true,
        "provideSslCertificates": ""
      },
      "typeVersion": 4.4
    },
    {
      "id": "bd77e7ac-678c-4bf0-8c97-37b97e1acdc5",
      "name": "Notify Generation Start",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1616,
        -448
      ],
      "parameters": {
        "text": "Please wait while the AI models take their time, you will be updated about the process status soon. Generally, the process takes around 5 minutes to complete.",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2,
      "alwaysOutputData": true
    },
    {
      "id": "2507904e-6b97-4488-8037-dca74201a4fa",
      "name": "Request Web Page",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        1968,
        -192
      ],
      "parameters": {
        "url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', `The exact, fully qualified URL to scrape (e.g., https://example.com). Extract this directly from the user's prompt. Ensure it includes the https:// prefix. Do not add spaces, quotes, or markdown backticks around the URL.`, 'string') }}",
        "options": {
          "response": {
            "response": {
              "neverError": true,
              "fullResponse": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Include_Response_Headers_and_Status', ``, 'boolean') }}"
            }
          }
        },
        "sendHeaders": true,
        "responseType": "text",
        "toolDescription": "Fetches raw text data from a provided URL. You MUST use this tool to scrape the target URL immediately when a user provides one. Do not attempt to draft the LinkedIn post or extract insights without successfully fetching this source data first.",
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36"
            }
          ]
        },
        "optimizeResponse": true,
        "provideSslCertificates": ""
      },
      "typeVersion": 4.4
    },
    {
      "id": "bb30d950-b35d-41f3-8662-51175ece6773",
      "name": "Verify User Approval",
      "type": "n8n-nodes-base.if",
      "position": [
        2944,
        224
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "dc7207fb-3a7d-4bce-94ec-897bcd60becb",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data.approved }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "120d3d65-8f1c-4010-8fcd-265b2df7af0e",
      "name": "Route Callback Access",
      "type": "n8n-nodes-base.switch",
      "position": [
        -592,
        256
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "8fa0c1e8-ceb7-429b-9430-9bc351be9680",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": 5013795623
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "0e9b648a-b75a-4fe6-a6e4-dee24eb35a00",
                    "operator": {
                      "type": "number",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.callback_query.from.id }}",
                    "rightValue": 5013795623
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "90eb5cf9-5642-48a6-8751-fd79c7e7f561",
      "name": "Start Message Options",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -32,
        224
      ],
      "parameters": {
        "text": "Hi \u2014 this bot uses powerful workflow automation (n8n) and helps turn article URLs into high-quality LinkedIn post drafts. It can pull the next URL from Google Sheets or use one you send directly, analyze the content, generate a draft, and route it for review or the next action here in Telegram.   \n\nNote: This is not an AI agent, or a chatbot, and your first response isn't reviewed or replied to with context.\n\n\nThere are limited available options here. Please choose your pick.",
        "chatId": "={{ $json.message.chat.id }}",
        "replyMarkup": "inlineKeyboard",
        "inlineKeyboard": {
          "rows": [
            {
              "row": {
                "buttons": [
                  {
                    "text": "Check Existing Topics",
                    "additionalFields": {
                      "callback_data": "action_check_sheet_url"
                    }
                  }
                ]
              }
            },
            {
              "row": {
                "buttons": [
                  {
                    "text": "Use my URL",
                    "additionalFields": {
                      "callback_data": "action_use_my_url"
                    }
                  }
                ]
              }
            },
            {
              "row": {
                "buttons": [
                  {
                    "text": "Add New URL to Repository",
                    "additionalFields": {
                      "callback_data": "action_add_new_url"
                    }
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "07bb6961-9277-4f2c-a4b1-5f7e12471eee",
      "name": "Report Empty Queue",
      "type": "n8n-nodes-base.telegram",
      "position": [
        768,
        -400
      ],
      "parameters": {
        "text": "There are NO URLs that aren't published",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a659fc06-019c-417a-b71a-7ee9ed42943c",
      "name": "Ask Execution Approval",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1008,
        -432
      ],
      "parameters": {
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "message": "=The URL not published yet at row number:  {{ $json.row_number }} is {{ $json.URLs }}. Do you want to proceed or skip?",
        "options": {
          "limitWaitTime": {
            "values": {
              "resumeUnit": "minutes"
            }
          },
          "appendAttribution": false
        },
        "operation": "sendAndWait",
        "approvalOptions": {
          "values": {
            "approvalType": "double",
            "approveLabel": "\u2705 Proceed",
            "disapproveLabel": "\u274c Skip"
          }
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9b615c62-124a-48f0-ac17-a84e9ef558e4",
      "name": "Ask Page URL",
      "type": "n8n-nodes-base.telegram",
      "position": [
        400,
        272
      ],
      "parameters": {
        "chatId": "={{ $json.callback_query.message.chat.id }}",
        "message": "Enter your URL, the form will only be valid for 1 minute and can be filled once per run.",
        "options": {
          "limitWaitTime": {
            "values": {
              "resumeUnit": "minutes"
            }
          },
          "appendAttribution": false
        },
        "operation": "sendAndWait",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Enter your URL"
            }
          ]
        },
        "responseType": "customForm"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b5fb3c4f-cbf6-4370-8cfe-3f1d7d414ef2",
      "name": "Announce Processing Start",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1248,
        256
      ],
      "parameters": {
        "text": "Please wait while the AI models take their time, you will be updated about the process status soon. Generally, the process takes around 5 minutes to complete.",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2,
      "alwaysOutputData": true
    },
    {
      "id": "7f008873-86ed-430a-99f6-cb6e942024af",
      "name": "Check Quality Status",
      "type": "n8n-nodes-base.switch",
      "position": [
        2624,
        -464
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "123f091c-f667-4bcd-a4a2-d525444989e5",
                    "operator": {
                      "type": "string",
                      "operation": "notEquals"
                    },
                    "leftValue": "={{ $json.output }}",
                    "rightValue": "False"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "62e544fb-e031-4564-9e71-7a2378e14d44",
                    "operator": {
                      "type": "boolean",
                      "operation": "false",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.output }}",
                    "rightValue": ""
                  }
                ]
              }
            }
          ]
        },
        "options": {},
        "looseTypeValidation": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "ed57ea3b-5ea1-4a35-a598-c3f887816037",
      "name": "Confirm Workflow Stopped",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3200,
        240
      ],
      "parameters": {
        "text": "Alright, Stopping the workflow",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7ec7d135-bba3-498d-b2d9-db2b5c01c7bc",
      "name": "Check Compliance Status",
      "type": "n8n-nodes-base.if",
      "position": [
        2320,
        240
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d190d2a4-3ee6-412b-b4ea-5f4f5774a425",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": "False"
            },
            {
              "id": "9133b35d-4d93-4de6-9127-2447d9a2fa57",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "3edf0de1-3eca-4265-a952-a567695712b3",
      "name": "Send Failure Notification",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2112,
        272
      ],
      "parameters": {
        "text": "The output couldn't be process either due to AI's error, URL fetch issue or something else. Please again with your URL or Delete the subject URL from the sheet and use the existing topics option. ",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ee1c3a62-1cef-4fe5-ba80-f73f06f013e1",
      "name": "Send Failure Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2528,
        256
      ],
      "parameters": {
        "text": "The output couldn't be process either due to AI's error, URL fetch issue or something else. Please again with your URL or Delete the subject URL from the sheet and use the existing topics option. ",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0941770d-9310-48b7-8ae9-7abf20207772",
      "name": "Ask Publication Approval",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2736,
        224
      ],
      "parameters": {
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "message": "=Your post is ready - Please approve or Reject within 5 minutes:\n{{$json.output.replaceSpecialChars().removeTags().removeMarkdown().replaceAll('?','').trim()}}",
        "options": {
          "limitWaitTime": {
            "values": {
              "resumeUnit": "minutes",
              "resumeAmount": 5
            }
          },
          "appendAttribution": false
        },
        "operation": "sendAndWait",
        "approvalOptions": {
          "values": {
            "approvalType": "double"
          }
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f7df8413-150c-4396-b936-acd7ddd70bc5",
      "name": "Send Fail Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2432,
        -432
      ],
      "parameters": {
        "text": "The output couldn't be process either due to AI's error, URL fetch issue or something else. Please again with your URL or Delete the subject URL from the sheet and use the existing topics option. ",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "11b75354-b2a8-4fbb-89b8-56350f197b12",
      "name": "Fallback Post Generation Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        1872,
        -96
      ],
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "71f1fe42-d863-48a9-8450-fb48ab5d84b3",
      "name": "Primary QC Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        2128,
        -176
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemma-4-26b-a4b-it"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "e5183256-8b7e-423e-9317-100c8ae419ba",
      "name": "Fallback QC model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        2176,
        -32
      ],
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d0f59c32-9b85-48a1-af17-6947e1f70d8b",
      "name": "Primary Post Creation Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1472,
        432
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemma-4-31b-it"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "9e858266-f5dd-405d-8844-5d2cb38371ce",
      "name": "Fallback Post Creation Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        1520,
        640
      ],
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5664348a-e842-47b9-bd52-a93eb4db6c1a",
      "name": "QC Primary Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1792,
        544
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemma-4-26b-a4b-it"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "69d2cde3-8f9b-487f-b9ac-831b9917f9be",
      "name": "QC Fallback Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        1840,
        688
      ],
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "61dd8518-b9e6-4248-94b3-ea9b46d69b54",
      "name": "Send Invalid URL Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        944,
        1248
      ],
      "parameters": {
        "text": "Please enter a valid URL - start the workflow again.",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1b25aef1-b880-4d43-bad8-8ac872491474",
      "name": "Send Duplicate URL Warning",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1440,
        1056
      ],
      "parameters": {
        "text": "The URL already exists - Please start the workflow again and add a new URL. Thanks!",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "53a0c5f0-56a8-43cb-9cbf-2adfc270d064",
      "name": "Send Duplicate URL Warning1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1888,
        1088
      ],
      "parameters": {
        "text": "=Your URL -  {{ $json.URLs }} was added to the sheet.",
        "chatId": "={{ $('Route By Command').item.json.callback_query.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6786fb17-1357-4ee1-9145-8620b346ff4b",
      "name": "Template Description",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1808,
        -80
      ],
      "parameters": {
        "color": 6,
        "width": 832,
        "height": 812,
        "content": "## Automate LinkedIn draft creation and publishing from Telegram\n\n### This n8n template demonstrates how to use AI to generate, quality-check, and publish LinkedIn posts, using Telegram as your mobile command center.\n\nPerfect for content creators and marketers: Quickly turn web articles into polished LinkedIn posts, run them through an automated AI quality check, and approve them on-the-go directly from your Telegram app!\n\n### How it works\n* The workflow listens for commands from your Telegram bot to initiate a draft or check the queue.\n* It scrapes content from provided URLs or accepts direct text input.\n* A Primary AI model generates a LinkedIn draft (with a Fallback model ready just in case).\n* Dedicated AI Quality Control (QC) models audit the draft to ensure it meets your compliance and quality standards.\n* The workflow sends the generated draft back to you on Telegram using a \"Wait\" node, waiting for your final human-in-the-loop approval or rejection.\n* Upon approval, the post is directly published to LinkedIn, and your Google Sheet is updated to track published vs. unpublished content.\n\n### How to set up\n1. Connect your Telegram bot, Google Sheets, LinkedIn, and chosen AI model credentials.\n2. Update the Google Sheets nodes with your specific Sheet ID (ensure it has columns for tracking URLs, drafts, and publish statuses).\n3. Activate the workflow and send your starting command to your Telegram bot to begin the drafting process.\n\n### Requirements\n* Telegram Bot Token\n* Google Sheets account (for database logging)\n* LinkedIn account\n* API keys for your chosen AI Models (e.g., OpenAI, Anthropic, or Gemini)"
      },
      "typeVersion": 1
    },
    {
      "id": "feb7580e-898c-4bd0-8357-94e7e5c565ba",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -656
      ],
      "parameters": {
        "color": 7,
        "width": 4048,
        "height": 752,
        "content": "## Branch: Database Queue Processing\n- Retrieve unpublished records from Google Sheets.\n- Request execution approval via Telegram.\n- Generate LinkedIn draft using AI models.\n- Audit draft compliance using quality control models.\n- Request publication approval via Telegram.\n- Publish post to LinkedIn and update sheet status."
      },
      "typeVersion": 1
    },
    {
      "id": "ca816990-1808-4a68-a46c-da61666052c4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        144
      ],
      "parameters": {
        "color": 7,
        "width": 3616,
        "height": 704,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Branch: Direct Draft Generation\n- Request page URL or text input via Telegram.\n- Validate input format and alert user if invalid.\n- Generate LinkedIn draft using AI models (with webpage scraping if URL provided).\n- Audit draft compliance using quality control models.\n- Request publication approval via Telegram.\n- Publish post to LinkedIn and append new record to Google Sheets."
      },
      "typeVersion": 1
    },
    {
      "id": "a9a86b9c-47a8-459c-8f23-2d57e17fd367",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        880
      ],
      "parameters": {
        "color": 7,
        "width": 1728,
        "height": 544,
        "content": "## Branch: URL Queue Ingestion\n- Request URL input via Telegram.\n- Validate URL format and alert user if invalid.\n- Fetch sheet records to verify URL presence.\n- Send warning message if duplicate record exists.\n- Insert new URL record into Google Sheets.\n- Send confirmation message via Telegram."
      },
      "typeVersion": 1
    },
    {
      "id": "e8587946-0cba-4a68-a4c0-56f81790a7fc",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -912,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 1248,
        "height": 512,
        "content": "## Setup and Routing\n- Listens for Telegram updates.\n- Routes callback access and commands.\n- Checks start commands and sends message options."
      },
      "typeVersion": 1
    },
    {
      "id": "c103d9a3-0f4b-4a41-af34-03f9f2110be0",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1408,
        144
      ],
      "parameters": {
        "width": 656,
        "height": 704,
        "content": "### Direct Generation and Audit\n- Generates post text from direct input via primary or fallback AI models.\n- Scrapes web page data for context.\n- Audits text compliance using primary or fallback QC models."
      },
      "typeVersion": 1
    },
    {
      "id": "9387603e-a289-4d31-b5f1-fcf797589bcc",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1760,
        -576
      ],
      "parameters": {
        "width": 624,
        "height": 656,
        "content": "### Draft Generation and Audit\n- Generates post text via primary or fallback AI models.\n- Scrapes web page data for context if required.\n- Audits compliance using primary or fallback QC models."
      },
      "typeVersion": 1
    },
    {
      "id": "994a9d26-3f40-4278-bfc1-adf2f6775b69",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3632,
        -624
      ],
      "parameters": {
        "width": 608,
        "height": 320,
        "content": "### Publication and Status Update\n- Publishes post to LinkedIn.\n- Updates published status in Google Sheets.\n- Notifies of publish success via Telegram."
      },
      "typeVersion": 1
    },
    {
      "id": "6503d20f-eaac-43ff-a8a5-fd1b5a217ec0",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3344,
        176
      ],
      "parameters": {
        "width": 576,
        "height": 400,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n### Publication and Log Append\n- Publishes post to LinkedIn.\n- Updates sheet record.\n- Confirms log update."
      },
      "typeVersion": 1
    },
    {
      "id": "19d0f264-d618-43ed-8ea9-ee45c04c0892",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        240
      ],
      "parameters": {
        "width": 208,
        "height": 384,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n### Command Routing\n- Evaluates Telegram command.\n- Routes workflow to Database Queue Processing, Direct Draft Generation, or URL Queue Ingestion."
      },
      "typeVersion": 1
    },
    {
      "id": "60ad86fa-e008-4d97-ba08-ab97b177ef30",
      "name": "Primary Post Generation Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1824,
        -224
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemma-4-31b-it"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "b6beee4b-7253-48bb-9542-4012c6651e87",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1824,
        752
      ],
      "parameters": {
        "width": 848,
        "height": 512,
        "content": "@[youtube](QUYkwW78aA8)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "b159f9e5-1a1f-493b-805d-2dab0a3ec9ec",
  "connections": {
    "Ask Page URL": {
      "main": [
        [
          {
            "node": "Check URL Validity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Primary QC Model": {
      "ai_languageModel": [
        [
          {
            "node": "Audit Draft Compliance",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "QC Primary Model": {
      "ai_languageModel": [
        [
          {
            "node": "Audit Direct Draft",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Request Web Page": {
      "ai_tool": [
        [
          {
            "node": "Generate LinkedIn Draft",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Route By Command": {
      "main": [
        [
          {
            "node": "Fetch Unpublished Records",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Ask Page URL",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Request URL Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fallback QC model": {
      "ai_languageModel": [
        [
          {
            "node": "Audit Draft Compliance",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "QC Fallback Model": {
      "ai_languageModel": [
        [
          {
            "node": "Audit Direct Draft",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "Request URL Input": {
      "main": [
        [
          {
            "node": "Validate URL Format",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Audit Direct Draft": {
      "ai_tool": [
        [
          {
            "node": "Generate Direct LinkedIn Draft",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Check URL Validity": {
      "main": [
        [
          {
            "node": "Evaluate Text Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Sheet Record": {
      "main": [
        [
          {
            "node": "Verify Sheet Record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Start Command": {
      "main": [
        [
          {
            "node": "Start Message Options",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Evaluate Text Input": {
      "main": [
        [
          {
            "node": "Announce Processing Start",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Alert Invalid Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert Sheet Record": {
      "main": [
        [
          {
            "node": "Send Duplicate URL Warning1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Listen For Telegram": {
      "main": [
        [
          {
            "node": "Route Callback Access",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Sheet Record": {
      "main": [
        [
          {
            "node": "Confirm Log Update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate URL Format": {
      "main": [
        [
          {
            "node": "Verify URL Presence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify Sheet Record": {
      "main": [
        [
          {
            "node": "Send Duplicate URL Warning",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Insert Sheet Record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify URL Presence": {
      "main": [
        [
          {
            "node": "Fetch Sheet Record",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Invalid URL Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Quality Status": {
      "main": [
        [
          {
            "node": "Request Publication Approval",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Alert QC Failure",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify User Approval": {
      "main": [
        [
          {
            "node": "Publish Direct LinkedIn Post",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Confirm Workflow Stopped",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Publish LinkedIn Post": {
      "main": [
        [
          {
            "node": "Update Published Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Callback Access": {
      "main": [
        [
          {
            "node": "Check Start Command",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Route By Command",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Message Options": {
      "main": [
        []
      ]
    },
    "Ask Execution Approval": {
      "main": [
        [
          {
            "node": "Evaluate User Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Audit Draft Compliance": {
      "ai_tool": [
        [
          {
            "node": "Generate LinkedIn Draft",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Check Record Existence": {
      "main": [
        [
          {
            "node": "Ask Execution Approval",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Report Empty Queue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Evaluate User Approval": {
      "main": [
        [
          {
            "node": "Notify Generation Start",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Confirm Execution Skipped",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Webpage Content": {
      "ai_tool": [
        [
          {
            "node": "Generate Direct LinkedIn Draft",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Check Compliance Status": {
      "main": [
        [
          {
            "node": "Ask Publication Approval",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Failure Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate LinkedIn Draft": {
      "main": [
        [
          {
            "node": "Check Quality Status",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Fail Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Generation Start": {
      "main": [
        [
          {
            "node": "Generate LinkedIn Draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Published Status": {
      "main": [
        [
          {
            "node": "Notify Publish Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ask Publication Approval": {
      "main": [
        [
          {
            "node": "Verify User Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Announce Processing Start": {
      "main": [
        [
          {
            "node": "Generate Direct LinkedIn Draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Evaluate Publish Decision": {
      "main": [
        [
          {
            "node": "Publish LinkedIn Post",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Confirm Publish Rejection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Unpublished Records": {
      "main": [
        [
          {
            "node": "Check Record Existence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Primary Post Creation Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Direct LinkedIn Draft",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fallback Post Creation Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Direct LinkedIn Draft",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "Publish Direct LinkedIn Post": {
      "main": [
        [
          {
            "node": "Update Sheet Record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Request Publication Approval": {
      "main": [
        [
          {
            "node": "Evaluate Publish Decision",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Primary Post Generation Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate LinkedIn Draft",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fallback Post Generation Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate LinkedIn Draft",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "Generate Direct LinkedIn Draft": {
      "main": [
        [
          {
            "node": "Check Compliance Status",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Failure Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}