{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "29e577d0-dd31-419f-aa60-c8340578002f",
      "name": "Chat Trigger",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -784,
        448
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.4
    },
    {
      "id": "14bb8c46-0267-44bf-a9cf-fbfd7e202b1c",
      "name": "Extract URL",
      "type": "n8n-nodes-base.set",
      "position": [
        -560,
        448
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2227abe6-01be-4b3e-99a4-d493c23fc34c",
              "name": "url",
              "type": "string",
              "value": "={{ $json.chatInput }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "0e9db9e4-e543-4caf-8870-6b176f5f9e1c",
      "name": "Check Valid URL",
      "type": "n8n-nodes-base.if",
      "position": [
        -352,
        448
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e010953b-ae9b-4717-8a78-0e22f9b393e6",
              "operator": {
                "type": "string",
                "operation": "startsWith"
              },
              "leftValue": "={{ $json.url }}",
              "rightValue": "http"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "b89ba8d8-9dde-4a88-8d74-79bf8c9e3ce6",
      "name": "Fetch Webpage",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -96,
        416
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {}
      },
      "typeVersion": 4.3
    },
    {
      "id": "56873344-b3cd-4e1e-9e36-a676d8450fe4",
      "name": "Extract HTML Content",
      "type": "n8n-nodes-base.html",
      "position": [
        112,
        416
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "removeElements",
              "cssSelector": "script, style, noscript, iframe, header, nav, .navigation, .nav, .menu, [class*=\"header\"], [id*=\"header\"], footer, [class*=\"footer\"], [id*=\"footer\"], aside, .sidebar, [class*=\"sidebar\"], .widget, [class*=\"widget\"], .comment, .comments, [class*=\"comment\"], .advertisement, .ad, [class*=\"ads\"], [class*=\"banner\"], form:not([class*=\"search\"]), input, button:not([class*=\"read-more\"]):not([class*=\"cta\"])"
            },
            {
              "key": "title",
              "cssSelector": "h1, title"
            },
            {
              "key": "description",
              "cssSelector": "meta[name=\"description\"], meta[property=\"og:description\"]"
            },
            {
              "key": "url",
              "cssSelector": "link[rel=\"canonical\"], meta[property=\"og:url\"]"
            },
            {
              "key": "mainContent",
              "cssSelector": "main, [role=\"main\"], #main-content, #content, .site-main, .main-content, .content-area, article, .entry-content, .post-content, .page-content"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1603aaaf-e7b0-416e-b2be-fb0e1df3ae07",
      "name": "AI Summarizer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        416,
        416
      ],
      "parameters": {
        "text": "={{ JSON.stringify($json) }}",
        "options": {
          "systemMessage": "=B\u1ea1n l\u00e0 tr\u1ee3 l\u00fd AI th\u00f4ng minh \u0111\u01b0\u1ee3c ph\u00e1t tri\u1ec3n b\u1edfi Nguy\u1ec5n Thi\u1ec7u To\u00e0n (Jay Nguyen) - CEO c\u1ee7a GenStaff (https://genstaff.net). Nhi\u1ec7m v\u1ee5 c\u1ee7a b\u1ea1n l\u00e0 nh\u1eadn n\u1ed9i dung v\u0103n b\u1ea3n \u0111\u01b0\u1ee3c tr\u00edch xu\u1ea5t t\u1eeb m\u1ed9t trang web, sau \u0111\u00f3 t\u00f3m t\u1eaft l\u1ea1i m\u1ed9t c\u00e1ch ng\u1eafn g\u1ecdn, khoa h\u1ecdc v\u00e0 th\u00f4ng minh.\n\nNguy\u00ean t\u1eafc tr\u1ea3 l\u1eddi:\n- B\u1ed1 c\u1ee5c r\u00f5 r\u00e0ng, s\u1eed d\u1ee5ng bullet points \u0111\u1ec3 li\u1ec7t k\u00ea \u00fd ch\u00ednh.\n- L\u01b0\u1ee3c b\u1ecf c\u00e1c th\u00f4ng tin r\u00e1c, ch\u1ec9 t\u1eadp trung v\u00e0o n\u1ed9i dung l\u00f5i c\u1ee7a b\u00e0i vi\u1ebft.\n- Gi\u1eef gi\u1ecdng \u0111i\u1ec7u chuy\u00ean nghi\u1ec7p, h\u1ed7 tr\u1ee3 v\u00e0 th\u1ea5u hi\u1ec3u ng\u01b0\u1eddi d\u00f9ng."
        },
        "promptType": "define"
      },
      "typeVersion": 3.1
    },
    {
      "id": "b92f7bab-0b85-4029-957a-649938809344",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        368,
        640
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-1.5-flash"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "89d87f1c-a778-4702-a9fb-7a27346a9ab2",
      "name": "Main Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1472,
        64
      ],
      "parameters": {
        "width": 550,
        "height": 750,
        "content": "## Smart WordPress Article Summarizer with AI\n\nThis workflow allows you to input a WordPress or blog article URL via a Chat Interface, automatically fetch and clean its content, and generate a smart, concise summary using **Gemini AI**.\n\nAll AI interactions are tailored by a custom system prompt ensuring clear, structured outputs.\n\n### How it works\n1. **Input:** You submit a URL into the n8n Chat interface.\n2. **Validation:** The workflow verifies if the input is a valid HTTP link.\n3. **Extraction:** It fetches the raw webpage and intelligently extracts only the main content (removing ads, navbars, footers, etc.).\n4. **Summarization:** The extracted text is processed by Gemini AI to produce a bulleted, easy-to-read summary.\n\n### Setup\n* [ ] Connect your **Google Gemini** credential in the AI Chat Model node.\n* [ ] Open the Chat interface in n8n and paste a URL to test.\n* [ ] Activate the workflow.\n\n### Customization tips\n* **Change Trigger:** Swap the Chat Trigger for Telegram, Slack, or Zalo to summarize links sent via messaging apps.\n* **Adjust AI Tone:** Modify the system prompt inside the AI Summarizer node to fit your specific reading preferences.\n\n### LICENCE\nThis template is shared free of charge. Copyright belongs to Nguyen Thieu Toan. Any copying or modification must credit the author."
      },
      "typeVersion": 1
    },
    {
      "id": "281ca63f-002e-48b8-8ad0-62727ed08df3",
      "name": "Section 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        224
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 450,
        "content": "## Section 1: Input & Validation\nReceives input from the chat interface, assigns the value to a variable, and verifies that the input starts with 'http' before proceeding."
      },
      "typeVersion": 1
    },
    {
      "id": "9bcda5bb-8155-461d-b8c6-be53cf626663",
      "name": "Section 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        224
      ],
      "parameters": {
        "color": 7,
        "width": 460,
        "height": 450,
        "content": "## Section 2: Fetch & Clean Content\nDownloads the webpage's raw HTML and uses CSS selectors to strip away noise (ads, navbars, footers), isolating the main article text."
      },
      "typeVersion": 1
    },
    {
      "id": "f60cbc0f-1484-49dc-be2e-26d5b6075f5b",
      "name": "Section 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        224
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 600,
        "content": "## Section 3: AI Summarization\nPasses the cleaned text to the AI Agent powered by Gemini. The agent is prompted to act as a professional summarizer, delivering structured, bulleted insights."
      },
      "typeVersion": 1
    },
    {
      "id": "625096b3-3f70-48a8-adeb-02c8310fdbd7",
      "name": "Warning",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        848
      ],
      "parameters": {
        "color": 3,
        "width": 300,
        "height": 180,
        "content": "## \u26a0\ufe0f Important!\n\nThe **Google Gemini Chat Model** requires a valid `googlePalmApi` credential. Please connect your API key before chatting."
      },
      "typeVersion": 1
    },
    {
      "id": "c14ef698-bf23-4269-bc7c-e66c0e4285a3",
      "name": "Author Message",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1472,
        864
      ],
      "parameters": {
        "color": 4,
        "width": 550,
        "height": 400,
        "content": "## Author Message\n\nHi! I am **Nguyen Thieu Toan (Jay Nguyen)** \u2014 a Verified n8n Creator and CEO of GenStaff. Thank you for using this template!\n\nThis workflow is shared with you for free. If it brings value to your work, optimizes your operations, or saves you time, you can buy me a coffee here: **[My Donate Website](https://nguyenthieutoan.com/payment/)** *(PayPal, Momo, Bank Transfer)*\n\n* Website: [nguyenthieutoan.com](https://nguyenthieutoan.com)\n* Email: me@nguyenthieutoan.com\n* Company: GenStaff ([genstaff.net](https://genstaff.net))\n* Socials (Facebook / X / LinkedIn): @nguyenthieutoan\n\n*Discover more of my automation solutions:* **[Click here](https://n8n.io/creators/nguyenthieutoan/)**"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Extract URL": {
      "main": [
        [
          {
            "node": "Check Valid URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Chat Trigger": {
      "main": [
        [
          {
            "node": "Extract URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Webpage": {
      "main": [
        [
          {
            "node": "Extract HTML Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Valid URL": {
      "main": [
        [
          {
            "node": "Fetch Webpage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract HTML Content": {
      "main": [
        [
          {
            "node": "AI Summarizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Summarizer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}