{
  "id": "KJI3ivu0QdOeWQnp",
  "meta": {
    "instanceId": "bddc3f9d7220ab462121a22afd09fa37a953a530ce58fc501da29a1454364846",
    "templateCredsSetupCompleted": true
  },
  "name": "Classify and Summarize WeChat Articles to Google Sheets and Notion",
  "tags": [],
  "nodes": [
    {
      "id": "379aa7e3-f0f9-431a-b86d-4e1ed71fd307",
      "name": "Read Initial Links",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -140,
        160
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 198451233,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/12HW0_goHSaO2QpqLTYxNpEWePBK4o0nsniyAx-hkkXE/edit#gid=198451233",
          "cachedResultName": "Save Initial Links"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "12HW0_goHSaO2QpqLTYxNpEWePBK4o0nsniyAx-hkkXE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/12HW0_goHSaO2QpqLTYxNpEWePBK4o0nsniyAx-hkkXE/edit?usp=drivesdk",
          "cachedResultName": "5am project"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "credential-id",
          "name": "googleSheetsOAuth2Api Credential"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "def0ea7d-7da8-4506-9c90-4312bd6e5b64",
      "name": "Read RSS Links",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -140,
        360
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/12HW0_goHSaO2QpqLTYxNpEWePBK4o0nsniyAx-hkkXE/edit#gid=0",
          "cachedResultName": "Read RSS Links"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "12HW0_goHSaO2QpqLTYxNpEWePBK4o0nsniyAx-hkkXE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/12HW0_goHSaO2QpqLTYxNpEWePBK4o0nsniyAx-hkkXE/edit?usp=drivesdk",
          "cachedResultName": "5am project"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "credential-id",
          "name": "googleSheetsOAuth2Api Credential"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "c21ea372-874b-4b85-ae7d-d546deb92d06",
      "name": "IF (Filter by Date)",
      "type": "n8n-nodes-base.if",
      "position": [
        500,
        360
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c059092a-cddd-4790-bb65-a26afefa40af",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ new Date($json.pubDate).getTime() }}",
              "rightValue": "={{ new Date(Date.now() - 10* 24 * 60 * 60 * 1000).getTime() }}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "2213c327-38d5-4a7c-a06c-d9bad22e7d2a",
      "name": "Save Initial Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        980,
        340
      ],
      "parameters": {
        "columns": {
          "value": {
            "link": "={{ $json.link }}",
            "title": "={{ $json.title }}",
            "pubDate": "={{ $json.pubDate }}"
          },
          "schema": [
            {
              "id": "pubDate",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "pubDate",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "creator",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "creator",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "link",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "author",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "author",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "content:encoded",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "content:encoded",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "content:encodedSnippet",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "content:encodedSnippet",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "contentSnippet",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "contentSnippet",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "content",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "content",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "itunes",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "itunes",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "link"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 198451233,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/12HW0_goHSaO2QpqLTYxNpEWePBK4o0nsniyAx-hkkXE/edit#gid=198451233",
          "cachedResultName": "Save Initial Links"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "12HW0_goHSaO2QpqLTYxNpEWePBK4o0nsniyAx-hkkXE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/12HW0_goHSaO2QpqLTYxNpEWePBK4o0nsniyAx-hkkXE/edit?usp=drivesdk",
          "cachedResultName": "5am project"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "credential-id",
          "name": "googleSheetsOAuth2Api Credential"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "2f5de224-3143-44c3-9730-766110cc4a03",
      "name": "RSS Read",
      "type": "n8n-nodes-base.rssFeedRead",
      "onError": "continueRegularOutput",
      "position": [
        80,
        360
      ],
      "parameters": {
        "url": "={{ $json.rss_feed_url }}",
        "options": {
          "ignoreSSL": false
        }
      },
      "executeOnce": false,
      "typeVersion": 1.1
    },
    {
      "id": "8c5bd286-a773-4e2e-9418-a1399ad80ab3",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -320,
        160
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "202633fe-ec3d-43c8-bdca-a19e40db1961",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        1100,
        180
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "ceec6d61-4ec8-4073-9693-ca768af3d6eb",
      "name": "Filter Unique Links",
      "type": "n8n-nodes-base.code",
      "position": [
        1520,
        180
      ],
      "parameters": {
        "jsCode": "const allItems = $input.all();\nconst linkCount = {};\n\n// 统计每个 link 的出现次数\nallItems.forEach(item => {\n  const link = item.json.link;\n  linkCount[link] = (linkCount[link] || 0) + 1;\n});\n\n// 过滤只出现 1 次的记录\nconst uniqueItems = allItems.filter(item => {\n  const link = item.json.link;\n  return linkCount[link] === 1;\n}).map(item => item.json);\n\nreturn uniqueItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "bda380c5-c9a3-4d16-b999-15ecbc296706",
      "name": "Filtered Data",
      "type": "n8n-nodes-base.set",
      "position": [
        740,
        340
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "298296a8-44f6-439d-8c4f-b86041721db4",
              "name": "pubDate",
              "type": "string",
              "value": "={{ $json.pubDate }}"
            },
            {
              "id": "6458616a-df3e-45ca-ba15-e7ef84283965",
              "name": "creator",
              "type": "string",
              "value": "={{ $json.creator }}"
            },
            {
              "id": "bb14c554-47d5-47c9-8be4-bcc4a9eaf1c3",
              "name": "title",
              "type": "string",
              "value": "={{ $json.title }}"
            },
            {
              "id": "e0cff4cc-2a8d-4d1b-9fe2-351c1dd2950b",
              "name": "link",
              "type": "string",
              "value": "={{ $json.link }}"
            },
            {
              "id": "c1d5909b-8a8f-4493-a67b-09b10fa2009a",
              "name": "author",
              "type": "string",
              "value": "={{ $json.author }}"
            },
            {
              "id": "8ea445ef-50ac-468d-b13d-90330447de13",
              "name": "content:encoded",
              "type": "string",
              "value": "={{ $json['content:encoded'] }}"
            },
            {
              "id": "a8a22f59-4a2c-413c-9c53-a37431d6debc",
              "name": "content:encodedSnippet",
              "type": "string",
              "value": "={{ $json['content:encodedSnippet'] }}"
            },
            {
              "id": "425df1ea-dacf-4cbe-b685-36f7722b36a7",
              "name": "contentSnippet",
              "type": "string",
              "value": "={{ $json.contentSnippet }}"
            },
            {
              "id": "81f67650-86bd-4aec-87e0-ab1ba85293f5",
              "name": "content",
              "type": "string",
              "value": "={{ $json.content }}"
            },
            {
              "id": "bb60c7f5-817a-4331-8e03-ad29ff07bf7a",
              "name": "itunes",
              "type": "string",
              "value": "={{ $json.itunes }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "77fdc062-a331-43c3-b702-66152ed0be5e",
      "name": "pubDate&link Only",
      "type": "n8n-nodes-base.set",
      "position": [
        1320,
        180
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "07cf0b6d-9310-49d0-a515-bbd7377a8033",
              "name": "pubDate",
              "type": "string",
              "value": "={{ $json.pubDate }}"
            },
            {
              "id": "c04d9abf-d522-4951-b2b7-249d1c00b47f",
              "name": "link",
              "type": "string",
              "value": "={{ $json.link }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "04040e72-be20-40c4-9f99-b3036de54d12",
      "name": "pubDate Processing",
      "type": "n8n-nodes-base.set",
      "position": [
        300,
        360
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "274a88d7-5b91-4934-b7cd-7ae56e8587b2",
              "name": "pubDate",
              "type": "string",
              "value": "={{ new Date($json.pubDate).toISOString() }}"
            },
            {
              "id": "f2f5b242-c94d-4a4a-a97b-5dac938021c4",
              "name": "creator",
              "type": "string",
              "value": ""
            },
            {
              "id": "633465a4-8473-456b-aa1b-2d35a3544e28",
              "name": "title",
              "type": "string",
              "value": "={{ $json.title }}"
            },
            {
              "id": "edd82c33-3325-47ef-a4a1-58cd88181ed8",
              "name": "link",
              "type": "string",
              "value": "={{ $json.link }}"
            },
            {
              "id": "877279c6-052b-475a-a1d8-75e748bd8691",
              "name": "author",
              "type": "string",
              "value": "={{ $json.author }}"
            },
            {
              "id": "ea83ca2f-306a-4c2f-8fdd-0e54b473716d",
              "name": "content:encoded",
              "type": "string",
              "value": "={{ $json['content:encoded'] }}"
            },
            {
              "id": "b4f54fd1-1bb5-4def-926d-83246786214e",
              "name": "content:encodedSnippet",
              "type": "string",
              "value": "={{ $json['content:encodedSnippet'] }}"
            },
            {
              "id": "063d3f43-c626-4c96-aca0-5249efab4693",
              "name": "contentSnippet",
              "type": "string",
              "value": "={{ $json.contentSnippet }}"
            },
            {
              "id": "2e90a2e2-94d7-4d91-a85d-06facd879e44",
              "name": "content",
              "type": "string",
              "value": "={{ $json.content }}"
            },
            {
              "id": "b589c9c7-0330-4b6c-b974-9ba924ff51a6",
              "name": "itunes",
              "type": "object",
              "value": "={{ $json.itunes }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "79ad6600-91ba-43f8-9a93-baf75671b4da",
      "name": "Merge1",
      "type": "n8n-nodes-base.merge",
      "position": [
        1220,
        360
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "ee826fb2-5542-42cc-ae2f-9636c1db930a",
      "name": "Restore Full Data with Code",
      "type": "n8n-nodes-base.code",
      "position": [
        -140,
        620
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\n\n// 创建一个对象来跟踪链接出现次数和对应项\nconst linkTracker = {};\n\n// 第一次遍历：统计每个链接出现的次数和记录对应项\nitems.forEach(item => {\n  const link = item.json.link ? item.json.link.trim().toLowerCase() : \"\";\n  if (link) {\n    if (!linkTracker[link]) {\n      linkTracker[link] = {\n        count: 0,\n        items: []\n      };\n    }\n    linkTracker[link].count++;\n    linkTracker[link].items.push(item);\n  }\n});\n\nconsole.log(\"Link Tracker:\", JSON.stringify(linkTracker, null, 2));\n\n// 第二次遍历：筛选出重复链接且带有 content 的项\nconst result = [];\nconst processedLinks = new Set(); // 用于避免重复处理同一个链接\n\nfor (const [link, data] of Object.entries(linkTracker)) {\n  if (data.count > 1 && !processedLinks.has(link)) {\n    processedLinks.add(link);\n    const itemsWithContent = data.items.filter(item => item.json.content !== undefined && item.json.content !== \"\");\n    if (itemsWithContent.length > 0) {\n      result.push(...itemsWithContent);\n    }\n  }\n}\n\nconsole.log(\"Result:\", JSON.stringify(result, null, 2));\nreturn result;"
      },
      "executeOnce": false,
      "typeVersion": 2,
      "alwaysOutputData": false
    },
    {
      "id": "980da728-dcc1-4eec-a590-9899c29a8982",
      "name": "Relevance Classification for Topic Monitoring",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        300,
        620
      ],
      "parameters": {
        "options": {
          "fallback": "discard"
        },
        "inputText": "={{ $json.title }}{{ $json.cleanedContent }}",
        "categories": {
          "categories": [
            {
              "category": "relevant",
              "description": "Articles related to 欧阳良宜, 读书笔记，AI in these fields."
            },
            {
              "category": "not_relevant",
              "description": "Articles not directly related to 欧阳良宜, 招生, 超级个体 in these fields."
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "50642d77-04a1-40b0-87a7-41d073dff5e6",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        320,
        840
      ],
      "parameters": {
        "model": "gpt-4.1-nano",
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "credential-id",
          "name": "openAiApi Credential"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "7c91fad5-56b5-466f-b320-6c0fc8f55254",
      "name": "Basic LLM Chain",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        720,
        600
      ],
      "parameters": {
        "text": "={{ $json.cleanedContent }}",
        "messages": {
          "messageValues": [
            {
              "message": "=You are an expert AI assistant responsible for analyzing and summarizing articles from WeChat public accounts **in Chinese**, formatting the output into Slack-compatible messages. Your task is to provide a deep, insightful summary that captures the main ideas, key points, and purpose of the article, while adding your own thoughtful analysis and interpretation to enhance understanding. Follow the guidelines below and use Slack-specific Markdown format.\n\n---\n\n### Instructions:\n1. **Input Analysis**: The input text may include incomplete HTML fragments, JavaScript code, or metadata. Focus only on meaningful textual content (e.g., article body or description) and ignore non-content elements (e.g., scripts, tags, or emojis).\n2. **Summary Requirements**:\n   - Provide a comprehensive overview of the article's content, highlighting the central theme and key points without unnecessary details.\n   - Add your own analysis and interpretation to offer deeper insights, connecting the content to broader contexts or implications.\n   - Use clear, natural, and professional Chinese suitable for a general audience.\n3. **Output Structure**:\n   - **Title with Link**: Format the article title as a clickable link using Slack Markdown: `<URL|*文章标题*>`. Ensure the title is engaging and reflective of the content.\n   - **Summary Sections**: Use **bold text** (`*`) for section headings (e.g., *文章概要*, *关键要点*, *背景与相关性*) to guide readers.\n   - **Key Points**: Present key insights as bullet points using `•` for concise and scannable information.\n   - **Context and Relevance**: Explain the article’s importance, its relevance to readers’ interests, and its connection to trends or industry developments.\n4. **Slack Markdown Formatting**:\n   - **Bold text**: `*bold text*`.\n   - **Italic text**: `_italic text_` (optional for emphasis).\n   - **Bullet points**: Use `•` for lists.\n   - **Links**: Use `<URL|*text*>` for clickable links.\n   - **Line breaks**: Use a blank line to separate paragraphs for readability.\n\n---\n\n### Input Text:\n{{ $json.cleanedContent }}\n\n### Output:\n[Provide the summary in the structured format below, tailored to the input text.]\n\n1. **Title with Link** – `<URL|*文章标题*>`  \n2. **文章概要** – [Comprehensive overview with deep analysis.]  \n3. **关键要点** –  \n   • [Key point 1]  \n   • [Key point 2]  \n   • [Key point 3]  \n4. **背景与相关性** – [Explanation of importance and relevance with your interpretation.]"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.5
    },
    {
      "id": "770887c4-4278-448a-961a-71eacbd57f3d",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        740,
        840
      ],
      "parameters": {
        "model": "gpt-4.1-nano",
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "credential-id",
          "name": "openAiApi Credential"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "7efc776d-d8f0-4014-9551-ce6817450c91",
      "name": "Set Fields - Relevant Articles",
      "type": "n8n-nodes-base.set",
      "position": [
        1140,
        600
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "3fbf5256-f06b-450a-adf7-65591a19c7dd",
              "name": "article_url",
              "type": "string",
              "value": "={{ $('Relevance Classification for Topic Monitoring').item.json.link }}"
            },
            {
              "id": "02f506cf-28fe-46ef-b97e-7ec938805151",
              "name": "summarized",
              "type": "string",
              "value": "YES"
            },
            {
              "id": "e23059bd-8bb2-439a-85bd-f9e191930d1e",
              "name": "summary",
              "type": "string",
              "value": "={{ $json.text }}"
            },
            {
              "id": "096acb35-4e9e-48fd-8e61-8ceb525591fa",
              "name": "fetched_at",
              "type": "string",
              "value": "={{$now}}"
            },
            {
              "id": "427243d1-01c4-458a-9626-75366e4264cd",
              "name": "publish_date",
              "type": "string",
              "value": "={{ $('Relevance Classification for Topic Monitoring').item.json.pubDate.toDateTime().format('yyyy-MM-dd') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "6250fcff-7557-4fcb-8de1-e23e3673d545",
      "name": "Google Sheets - Add relevant article",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1400,
        600
      ],
      "parameters": {
        "columns": {
          "value": {
            "title": "{{ $('Relevance Classification for Topic Monitoring').item.json.title }}",
            "summary": "={{ $json.summary }}",
            "fetched_at": "={{ $json.fetched_at }}",
            "summarized": "={{ $json.summarized }}",
            "article_url": "={{ $json.article_url }}",
            "publish_date": "={{ $json.publish_date }}"
          },
          "schema": [
            {
              "id": "article_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "article_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summarized",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "summarized",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "website",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "fetched_at",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "fetched_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "publish_date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "publish_date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1936091950,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/12HW0_goHSaO2QpqLTYxNpEWePBK4o0nsniyAx-hkkXE/edit#gid=1936091950",
          "cachedResultName": "Save Processed Data"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "12HW0_goHSaO2QpqLTYxNpEWePBK4o0nsniyAx-hkkXE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/12HW0_goHSaO2QpqLTYxNpEWePBK4o0nsniyAx-hkkXE/edit?usp=drivesdk",
          "cachedResultName": "5am project"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "credential-id",
          "name": "googleSheetsOAuth2Api Credential"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "3f3c8159-d130-46c9-be36-a44274639dc2",
      "name": "Clean HTML Content",
      "type": "n8n-nodes-base.code",
      "position": [
        80,
        620
      ],
      "parameters": {
        "jsCode": "const items = $input.all().map(item => item.json);\n\nconst cleanedData = items.map(item => {\n  let text = \"\";\n\n  // 尝试从 meta description 提取\n  const metaDescriptionMatch = item.content.match(/<meta\\s+name=[\"']description[\"']\\s+content=[\"'](.*?)[\"']/i);\n  if (metaDescriptionMatch && metaDescriptionMatch[1]) {\n    text = metaDescriptionMatch[1].trim();\n  } else {\n    // 移除脚本和样式，提取可能正文\n    text = item.content\n      .replace(/<script[^>]*>[\\s\\S]*?<\\/script>/gi, \"\") // 移除脚本\n      .replace(/<style[^>]*>[\\s\\S]*?<\\/style>/gi, \"\") // 移除样式\n      .replace(/<!--[\\s\\S]*?-->/g, \"\") // 移除注释\n      .replace(/<[^>]+>/g, \" \") // 移除标签\n      .replace(/window\\..*?(?=\\s|$)/g, \"\") // 移除 window 对象\n      .replace(/[\\s\\n\\r]+/g, \" \") // 合并多余空格\n      .trim();\n  }\n\n  // 如果仍为空，标记为无内容\n  if (!text) {\n    text = \"No content extracted\";\n  }\n\n  return {\n    ...item,\n    cleanedContent: text\n  };\n});\n\nconsole.log(\"Cleaned Data:\", JSON.stringify(cleanedData, null, 2));\nreturn cleanedData;"
      },
      "typeVersion": 2
    },
    {
      "id": "de9ca195-a03d-4e81-9764-be1b15c30698",
      "name": "Create a database page",
      "type": "n8n-nodes-base.notion",
      "position": [
        1400,
        800
      ],
      "parameters": {
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "22e79d55-2675-8055-a143-d55302c3c1b1",
          "cachedResultUrl": "https://www.notion.so/22e79d5526758055a143d55302c3c1b1",
          "cachedResultName": "wechat"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "article_url|title",
              "title": "={{ $json.article_url }}"
            },
            {
              "key": "summary|rich_text",
              "textContent": "={{ $json.summary }}"
            },
            {
              "key": "fetched_at|rich_text",
              "textContent": "={{ $json.fetched_at }}"
            }
          ]
        }
      },
      "credentials": {
        "notionApi": {
          "id": "credential-id",
          "name": "notionApi Credential"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7417f405-bb62-4fb7-842f-81b6c6e8a21c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        -40
      ],
      "parameters": {
        "width": 360,
        "height": 380,
        "content": "## Workflow Overview\n\nThis workflow automates classifying and summarizing WeChat articles! 📑 It reads RSS links from Google Sheets, filters by date ⏳, cleans content 🧹, classifies relevance (e.g., AI, specific person) 🎯, and creates Slack-formatted summaries with GPT-4.1-nano. 🤖 Results save to Google Sheets and Notion. 📊\n\n- **Setup Guide**: Replace documentId and rss_feed_url with your own. 🔧 Configure OpenAI and Google Sheets credentials—don’t hardcode! 🔐\n- **Customization**: Tweak AI prompts or add outputs (e.g., Slack). 🎨\n- **Note**: Use n8n credentials for security. 🛡️\n(Optional: Add a Loom video or YouTube link here! 🎥)"
      },
      "typeVersion": 1
    },
    {
      "id": "45d493a4-c20a-4da1-a01c-6db4be67e127",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        -40
      ],
      "parameters": {
        "color": 5,
        "width": 1020,
        "height": 560,
        "content": "## Step 1 - Data Input📥\n\nRead initial links and RSS feeds from Google Sheets. 📋"
      },
      "typeVersion": 1
    },
    {
      "id": "f7be9779-8638-40f7-92e7-9db22cf16d62",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1140,
        -40
      ],
      "parameters": {
        "color": 5,
        "width": 560,
        "height": 560,
        "content": "## Step 2 - Deduplication Step 🔄\n\nCheck for already processed URLs using \"Filter Unique Links\" node. ✅ \nIf a URL is duplicate, skip it; process only new content. ⏩ \nThis ensures efficiency and avoids redundant work! 🚀"
      },
      "typeVersion": 1
    },
    {
      "id": "598b9f22-f977-4269-92f2-1b512b3d61f3",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        880
      ],
      "parameters": {
        "color": 5,
        "width": 1200,
        "height": 280,
        "content": "## Step 3 - Processing⚙️\n\n- Classification 📊: Use \"Relevance Classification\" node to categorize articles (e.g., relevant to AI/specific person or not). 🎯 AI determines relevance based on content.\n- AI Summarization 🧠: Leverage \"Basic LLM Chain\" with GPT-4.1-nano to generate insightful, Slack-formatted summaries in Chinese. 🤖 Focuses on key points and analysis."
      },
      "typeVersion": 1
    },
    {
      "id": "4e6ff59a-5788-415c-a463-ceb0bd448b1e",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1140,
        1000
      ],
      "parameters": {
        "color": 5,
        "content": "## Step 4 - Output📤\n\nSave to Google Sheets and Notion.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5e456447-8c95-43af-a068-075b86c084fb",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "pubDate&link Only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge1": {
      "main": [
        [
          {
            "node": "Restore Full Data with Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RSS Read": {
      "main": [
        [
          {
            "node": "pubDate Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filtered Data": {
      "main": [
        [
          {
            "node": "Save Initial Data",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read RSS Links": {
      "main": [
        [
          {
            "node": "RSS Read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Set Fields - Relevant Articles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Save Initial Data": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "pubDate&link Only": {
      "main": [
        [
          {
            "node": "Filter Unique Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean HTML Content": {
      "main": [
        [
          {
            "node": "Relevance Classification for Topic Monitoring",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Relevance Classification for Topic Monitoring",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Read Initial Links": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "pubDate Processing": {
      "main": [
        [
          {
            "node": "IF (Filter by Date)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Unique Links": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "IF (Filter by Date)": {
      "main": [
        [
          {
            "node": "Filtered Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Restore Full Data with Code": {
      "main": [
        [
          {
            "node": "Clean HTML Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Fields - Relevant Articles": {
      "main": [
        [
          {
            "node": "Google Sheets - Add relevant article",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create a database page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Read Initial Links",
            "type": "main",
            "index": 0
          },
          {
            "node": "Read RSS Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Relevance Classification for Topic Monitoring": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}