8
n8n 中文网amn8n.com

使用 Gemini AI 将 Readwise 高亮转换为每周内容创意

高级

这是一个Content Creation, AI Summarization领域的自动化工作流,包含 21 个节点。主要使用 Code, Filter, Markdown, SplitOut, HttpRequest 等节点。 使用 Gemini AI 将 Readwise 高亮转换为每周内容创意

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "42450f423595f391b7c323eb4191c0bc81df9f6de5483a12f34f76cb4146556c",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "d658ca25-1a80-4f28-ac28-6b36b60d2ffa",
      "name": "获取文章",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -672,
        -256
      ],
      "parameters": {
        "url": "https://readwise.io/api/v3/list",
        "options": {
          "pagination": {
            "pagination": {
              "nextURL": "={{ $response.body.nextPageCursor ? `https://readwise.io/api/v3/list?pageCursor=$response.body.nextPageCursor` : 'https://readwise.io/api/v3/list'}}",
              "paginationMode": "responseContainsNextURL",
              "requestInterval": 500,
              "completeExpression": "={{!$response.body.nextPageCursor }}",
              "paginationCompleteWhen": "other"
            }
          }
        },
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "updatedAfter",
              "value": "={{ $now.minus(7, 'days') }}"
            },
            {
              "name": "withHtmlContent",
              "value": "true"
            },
            {
              "name": "category",
              "value": "article"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "pMGV283zpuVbPlMh",
          "name": "Readwise Auth"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e9ab5e55-6500-4ffd-b19f-88921321d0b3",
      "name": "拆分文章结果",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -448,
        -256
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "results"
      },
      "typeVersion": 1
    },
    {
      "id": "564a1d51-de71-4d39-badd-bfcb0653c3c8",
      "name": "获取高亮内容",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        -256
      ],
      "parameters": {
        "url": "=https://readwise.io/api/v3/list/",
        "options": {
          "pagination": {
            "pagination": {
              "nextURL": "={{ $response.body.nextPageCursor ? `https://readwise.io/api/v3/list?pageCursor=$response.body.nextPageCursor` : 'https://readwise.io/api/v3/list'}}",
              "paginationMode": "responseContainsNextURL",
              "requestInterval": 500,
              "completeExpression": "={{!$response.body.nextPageCursor }}",
              "paginationCompleteWhen": "other"
            }
          }
        },
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "category",
              "value": "=highlight"
            },
            {
              "name": "updatedAfter",
              "value": "={{ $now.minus(7, 'days') }}"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "pMGV283zpuVbPlMh",
          "name": "Readwise Auth"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4105eb45-90d4-4557-9465-3437247199e0",
      "name": "拆分高亮结果",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        224,
        -256
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "results"
      },
      "typeVersion": 1
    },
    {
      "id": "4b4b5b76-8c80-4845-ae40-c053a7ec0635",
      "name": "合并文章与高亮内容",
      "type": "n8n-nodes-base.code",
      "position": [
        672,
        -256
      ],
      "parameters": {
        "jsCode": "const articles = $('Filter Articles >10% Read').all();\nconst highlights = $('Find Highlights for Article').all();\n\n  return articles.map(a => {\n    const article = a.json;\n    const matched_highlights = highlights\n      .filter(h => h.json.parent_id === article.id)\n      .map(h => h.json);\n\n    return {\n      json: {\n        title: article.title,\n        url: article.url,\n        original_url: article.source_url || article.url,\n        author: article.author,\n        summary: article.summary,\n        content: article.html_content,\n        reading_progress: article.reading_progress,\n        highlight_count: matched_highlights.length,\n        highlights: matched_highlights.map(h => ({\n          text: h.content || h.text,\n          note: h.notes || h.note\n        }))\n      }\n    };\n  });"
      },
      "typeVersion": 2
    },
    {
      "id": "55c72541-46c7-434b-93a2-f135586045c9",
      "name": "准备提示词",
      "type": "n8n-nodes-base.code",
      "position": [
        896,
        -256
      ],
      "parameters": {
        "jsCode": "const articles = $input.all().map(item => item.json);\n\n// Build article content\n  const combinedContent = articles.map(article => {\n    let content = `## ${article.title}\\n`;\n    if (article.original_url) content += `**Original URL:** ${article.original_url}\\n`;\n    if (article.author) content += `**Author:** ${article.author}\\n`;\n    if (article.content) content += `**Summary:** ${article.content}\\n`;\n    content += `**Highlights:** ${article.highlight_count}\\n`;\n    content += `**Reading Progress:** ${Math.round(article.reading_progress * 100)}%\\n\\n`;\n\n    if (article.highlights && article.highlights.length > 0) {\n      content += `**Key Highlights:**\\n`;\n      article.highlights.forEach(highlight => {\n        content += `- \"${highlight.text}\"\\n`;\n        if (highlight.note) {\n          content += `  *Note: ${highlight.note}*\\n`;\n        }\n      });\n    }\n\n    content += `\\n---\\n\\n`;\n    return content;\n  }).join('');\n\n// Build the prompt with EXPLICIT formatting instructions\nconst prompt = `You are a reading analyst helping a tech consultant and AI engineering freelancer extract valuable insights from their weekly reading habits.\n\nAnalyze the following articles and highlights from the past week and create insights that would be valuable for:\n1. Professional development in tech consulting and AI engineering\n2. Content creation and thought leadership\n3. Business strategy and industry trends\n4. Technical knowledge and best practices\n\nFocus on creating actionable insights that could become:\n- LinkedIn posts about industry trends\n- Technical blog articles\n- Business insights for consulting\n- Learning priorities for skill development\n- Content ideas based on interesting findings\n\nWeekly reading data:\n${combinedContent}\n\nCRITICAL FORMATTING RULES:\n1. When referencing articles, ALWAYS use this exact markdown link format: [Article Title](URL)\n2. NEVER write bare URLs - always wrap them in markdown links\n3. Example: [The Majority AI View](https://www.anildash.com/2025/10/17/the-majority-ai-view/)\n4. For bullet points with links: \"- Read [Article Title](URL) for more details\"\n5. Use the ORIGINAL article URL (not Readwise URLs) in all links\n\nVALID markdown link examples:\n✅ [The Sprinter Developer](https://example.com/article)\n✅ Read more in [Ruby AI: Introducing Phoenix](https://example.com)\n✅ - [Article Title](https://example.com) discusses...\n\nINVALID examples (DO NOT USE):\n❌ https://example.com (bare URL)\n❌ Article Title: https://example.com (URL not in markdown format)\n❌ [Article Title] - https://example.com (incorrect syntax)\n\nPlease provide your analysis in the following format:\n\n# Weekly Reading Insights\n\n## 📊 Reading Pattern Analysis\n[Brief analysis of reading habits, topics covered, and engagement levels]\n\n## 🔍 Key Themes & Trends\n[3-5 major themes or trends identified across the articles]\n\n## 💡 Top Insights & Takeaways\n[5-7 most valuable insights. When mentioning specific articles, use markdown links: [Article Title](URL)]\n\n## 🎯 Content Creation Opportunities\n[4-6 specific content ideas. Reference articles using markdown links.]\n\n## 📚 Most Valuable Articles\n[Top 3-4 articles. Format each as: [Article Title](URL) - Brief summary]\n\n## 🔗 Notable Quotes & Highlights\n[Best quotes. Format as: \"Quote text\" - [Source Article](URL)]\n\n## 📈 Learning & Development Priorities\n[Suggested areas for deeper learning based on reading patterns]\n\nRemember: Every article reference MUST be a properly formatted markdown link: [Title](URL)`;\n\nreturn [{\n  json: {\n    prompt: prompt,\n    articles_count: articles.length,\n    total_highlights: articles.reduce((sum, a) => sum + a.highlight_count, 0)\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "f3691550-22f6-4374-a07f-6652802fa017",
      "name": "筛选阅读进度>10%的文章",
      "type": "n8n-nodes-base.filter",
      "position": [
        -224,
        -256
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "075acdec-fb32-4680-a807-09316a782e49",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.reading_progress }}",
              "rightValue": 0.1
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "bfa61775-01fb-4f89-bdb6-ec3df344c643",
      "name": "查找文章对应的高亮",
      "type": "n8n-nodes-base.filter",
      "position": [
        448,
        -256
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "37db4560-d8c7-4a06-bf29-dbc1adde58c2",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.parent_id }}",
              "rightValue": "={{ $('Filter Articles >10% Read').item.json.id }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f7a94120-67a5-4301-8e49-df99417a72df",
      "name": "生成每周洞察",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1120,
        -256
      ],
      "parameters": {
        "text": "={{ $json.prompt }}",
        "batching": {},
        "promptType": "define"
      },
      "retryOnFail": true,
      "typeVersion": 1.7
    },
    {
      "id": "2d6c8414-6c61-4e3b-99b9-1f22f467242d",
      "name": "AI模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1200,
        -32
      ],
      "parameters": {
        "model": "google/gemini-2.5-pro",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "aCsTDT5LGS5D8Ndl",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "51c9c8d4-64ff-4b46-bcea-58247340c540",
      "name": "将洞察转换为HTML",
      "type": "n8n-nodes-base.markdown",
      "position": [
        1472,
        -256
      ],
      "parameters": {
        "mode": "markdownToHtml",
        "options": {
          "tables": true,
          "simplifiedAutoLink": true,
          "openLinksInNewWindow": true
        },
        "markdown": "={{ $json.text }}"
      },
      "typeVersion": 1
    },
    {
      "id": "52d42ad7-9c68-4c78-aa47-3c950b6583c4",
      "name": "为Readwise保存API格式化",
      "type": "n8n-nodes-base.code",
      "position": [
        1696,
        -256
      ],
      "parameters": {
        "jsCode": "  const insights = $input.first().json.data;\n  const timestamp = new Date().toISOString().split('T')[0];\n\n  return [{\n    json: {\n      url: `https://weekly-insights.local/${timestamp}`,\n      html: insights, // Just convert newlines to <br>\n      title: `Weekly Reading Insights - ${timestamp}`,\n      author: \"AI Reading Analyst\",\n      summary: \"AI-generated insights from weekly reading highlights\",\n      should_clean_html: true, // Let Readwise clean/format it\n      location: \"new\",\n      category: \"article\"\n    }\n  }];"
      },
      "typeVersion": 2
    },
    {
      "id": "8f07a901-ea39-415d-99e7-4bce43ba36c7",
      "name": "将洞察保存至Readwise",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1920,
        -256
      ],
      "parameters": {
        "url": "https://readwise.io/api/v3/save/",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "pMGV283zpuVbPlMh",
          "name": "Readwise Auth"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e362501c-ab5a-492d-a94b-679063d9d4f0",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        -704
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 256,
        "content": "## 📌 开始"
      },
      "typeVersion": 1
    },
    {
      "id": "995257c2-e0ad-42b5-9be7-d86c55630540",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -432,
        -704
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 256,
        "content": "## 📌 获取READWISE数据"
      },
      "typeVersion": 1
    },
    {
      "id": "b1b348fb-9deb-4d32-8bd7-3b73b793ba3c",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -704
      ],
      "parameters": {
        "color": 7,
        "width": 304,
        "height": 256,
        "content": "## 📌 筛选与匹配数据"
      },
      "typeVersion": 1
    },
    {
      "id": "87a101df-925e-4b81-8277-e1b3f681ced0",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        -704
      ],
      "parameters": {
        "color": 7,
        "width": 384,
        "height": 256,
        "content": "## 📌 准备AI提示"
      },
      "typeVersion": 1
    },
    {
      "id": "cac3fd5f-1196-4dd4-82e2-d0e3d4254f5b",
      "name": "便签说明4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        -704
      ],
      "parameters": {
        "color": 7,
        "width": 304,
        "height": 256,
        "content": "## 📌 生成AI洞察"
      },
      "typeVersion": 1
    },
    {
      "id": "fb5fc2ae-d8f6-4f86-b926-ffc090789818",
      "name": "便签说明5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1536,
        -704
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 256,
        "content": "## 📌 将洞察保存回READWISE"
      },
      "typeVersion": 1
    },
    {
      "id": "d5f335d3-8610-454d-aa0d-ad27b75ab59a",
      "name": "周一 - 09:00",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -896,
        -416
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 9 * * 1"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0f971879-dc47-477a-9342-f7f102220953",
      "name": "当点击“执行工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -896,
        -256
      ],
      "parameters": {},
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "AI Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Weekly Insights",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Articles": {
      "main": [
        [
          {
            "node": "Split Article Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Monday - 09:00": {
      "main": [
        [
          {
            "node": "Fetch Articles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Prompt": {
      "main": [
        [
          {
            "node": "Generate Weekly Insights",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Highlights": {
      "main": [
        [
          {
            "node": "Split Highlights Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Article Results": {
      "main": [
        [
          {
            "node": "Filter Articles >10% Read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert Insights to HTML": {
      "main": [
        [
          {
            "node": "Format for Readwise Save API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Weekly Insights": {
      "main": [
        [
          {
            "node": "Convert Insights to HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Highlights Results": {
      "main": [
        [
          {
            "node": "Find Highlights for Article",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Articles >10% Read": {
      "main": [
        [
          {
            "node": "Fetch Highlights",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Highlights for Article": {
      "main": [
        [
          {
            "node": "Merge Articles & Highlights",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Articles & Highlights": {
      "main": [
        [
          {
            "node": "Prepare Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format for Readwise Save API": {
      "main": [
        [
          {
            "node": "Save Insights to Readwise",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Fetch Articles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 内容创作, AI 摘要总结

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量21
分类2
节点类型10
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Julian Kaiser

Julian Kaiser

@jksr

Full Stack Developer turned AI & Automation Engineer, implementing intelligent solutions with custom code, LLMs & n8n. Need help debugging a tricky workflow? I offer focused 60-minute sessions to get you unstuck fast. Check the link below.

外部链接
在 n8n.io 查看

分享此工作流