8
n8n 中文网amn8n.com

工作流结果转换为Markdown笔记并保存到Obsidian知识库

中级

这是一个Other领域的自动化工作流,包含 15 个节点。主要使用 If, Set, GoogleDrive, Agent, LmChatOpenAi 等节点。 工作流结果转换为Markdown笔记并保存到Obsidian知识库,通过Google Drive

前置要求
  • Google Drive API 凭证
  • OpenAI API Key

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "3wbxkdT6hilhq0Na",
  "meta": {
    "instanceId": "d47f3738b860eed937a1b18d7345fa2c65cf4b4957554e29477cb064a7039870"
  },
  "name": "工作流结果转换为 Markdown 笔记并保存到您的 Obsidian 知识库,通过 Google Drive",
  "tags": [],
  "nodes": [
    {
      "id": "be787ece-4118-4063-98b0-41672dd570c0",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        -480
      ],
      "parameters": {
        "width": 440,
        "height": 680,
        "content": "## 将文件夹连接到 Obsidian 知识库"
      },
      "typeVersion": 1
    },
    {
      "id": "a30f3fdc-95a1-44ff-844a-58353dc7e177",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        -480
      ],
      "parameters": {
        "width": 440,
        "height": 680,
        "content": "## 工作流结果到 Obsidian 知识库"
      },
      "typeVersion": 1
    },
    {
      "id": "d9527913-dad1-4abc-8c86-8c76f53dd513",
      "name": "保存 Markdown 文件",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        740,
        0
      ],
      "parameters": {
        "name": "={{ $json.title }}.md",
        "content": "=---\n{{ $json.frontmatter }}\n---\n{{ $json.content }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "15dvUtfSjaCCXmnOVeIUfeyRd_raI3PnQ",
          "cachedResultUrl": "https://drive.google.com/drive/folders/15dvUtfSjaCCXmnOVeIUfeyRd_raI3PnQ",
          "cachedResultName": "clippings-attachments"
        },
        "operation": "createFromText"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "Vpmg4nRArCy8DHiE",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "6484937e-17fd-444c-916b-1527382927d4",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1020,
        -380
      ],
      "parameters": {
        "color": 3,
        "width": 460,
        "height": 540,
        "content": "## 创建符号链接"
      },
      "typeVersion": 1
    },
    {
      "id": "fe21a7c2-e8db-46be-87e7-63888bf6e9e7",
      "name": "从任何工作流接收结果",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -660,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "8f2399ba-0bda-4a2e-b773-7e28df16e7c2",
      "name": "如果输入有二进制附件",
      "type": "n8n-nodes-base.if",
      "position": [
        20,
        -160
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "9f56b367-2313-4a92-9572-b2d2687aba71",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{$json[\"binary\"]}}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d7cae1d6-5bfe-4e69-8257-0f7947b51c96",
      "name": "从输入1编写 Zettlekasten 笔记",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -280,
        240
      ],
      "parameters": {
        "text": "={{ JSON.stringify($json) }}",
        "options": {
          "systemMessage": "You are an expert knowledge management assistant creating a Zettlekasten note from raw input data. Follow these precise steps:\n\n1. Extract key insights and meaningful connections from the provided JSON input.\n\n2. Structure the note using these Zettlekasten principles:\n- Create a clear, atomic central idea\n- Use precise, concise language\n- Link potential connections to other knowledge domains\n- Ensure the note can stand alone as a meaningful knowledge unit\n\n3. Note format:\n- Unique ID: Generate a unique identifier \n- Title: Concise, descriptive headline capturing core insight\n- Content: Synthesized information with clear reasoning\n- Tags: Relevant conceptual tags for future retrieval\n- References: Source of original data (optional)\n\n4. Prioritize intellectual clarity, semantic depth, and potential for future knowledge expansion.\n\nRespond ONLY with the completed Zettlekasten note in JSON format. Do not include any additional commentary or explanation."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "303d6633-8e98-4fbc-8ee1-9f1075bcaa3e",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -100,
        420
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"title\": \"Concise, Descriptive Title\",\n  \"content\": \"Synthesized insights and key information\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "62800f09-8659-47b8-9a85-7d3d2c07ec1a",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -300,
        420
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "q8L9oWVM7QyzYEE5",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "df11dfcb-fb38-4796-9b28-eb1876f68261",
      "name": "重构 JSON",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        240
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c9061623-d0d0-4b63-a166-4766d88992aa",
              "name": "title",
              "type": "string",
              "value": "={{ $('Write Zettlekasten note from input1').item.json.output.title }}"
            },
            {
              "id": "9f870307-3cbf-41b3-ba69-309610b2d020",
              "name": "content",
              "type": "string",
              "value": "={{ $('Write Zettlekasten note from input1').item.json.output.content }}"
            },
            {
              "id": "1f40b120-00e4-479f-85b0-3fd903e629cb",
              "name": "frontmatter",
              "type": "string",
              "value": "={{ $json.output.frontmatter }}"
            },
            {
              "id": "5b845683-5a25-486b-92b0-98990fcbf7af",
              "name": "references",
              "type": "string",
              "value": "={{ $('Write Zettlekasten note from input1').item.json.output.references }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "2a701cf8-e59d-47ae-83c6-9ac7148bd2c8",
      "name": "结构化输出解析器1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        240,
        420
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"frontmatter\": \"frontmatter here\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "1e4da42e-e945-4be8-88ac-2579857ff3fa",
      "name": "OpenAI 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        60,
        420
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "q8L9oWVM7QyzYEE5",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "af5494d8-a53f-48b1-b939-210c882485be",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -340,
        100
      ],
      "parameters": {
        "color": 4,
        "width": 880,
        "height": 460,
        "content": "## 可选 - 使用 AI 代理撰写笔记"
      },
      "typeVersion": 1
    },
    {
      "id": "5d184ea4-88d0-4658-ab94-55246f3507fc",
      "name": "编写 YAML 前置元数据",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        60,
        240
      ],
      "parameters": {
        "text": "={{ $json.output.content }}",
        "options": {
          "systemMessage": "=Generate comprehensive YAML frontmatter for an Obsidian note, focusing on metadata extraction and organization.\n\nOutput Format:\n```yaml\ntitle: \"{Extract a clear, concise title from input data}\"\ndate: {{ $now.toFormat('yyyy-MM-dd') }}\n\ntags:\n - {Derive 3-4 most relevant conceptual tags}\naliases:\n - {Alternative titles or key phrases}\nstatus: \"draft\"\nsource: \"{Infer original data source if possible}\""
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "d2b291be-97af-4bcb-8cc6-b21439bdcfb9",
      "name": "保存附件",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        740,
        -180
      ],
      "parameters": {
        "name": "=",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "15dvUtfSjaCCXmnOVeIUfeyRd_raI3PnQ",
          "cachedResultUrl": "https://drive.google.com/drive/folders/15dvUtfSjaCCXmnOVeIUfeyRd_raI3PnQ",
          "cachedResultName": "clippings-attachments"
        },
        "inputDataFieldName": "=data"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "Vpmg4nRArCy8DHiE",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    }
  ],
  "active": false,
  "pinData": {
    "Write Zettlekasten note from input1": [
      {
        "json": {
          "output": {
            "id": "note-0235",
            "tags": [
              "Freelance",
              "Employment Trends",
              "Media Industry",
              "Permanent Contracts"
            ],
            "title": "Shift from Freelancers to Permanent Contracts in Media",
            "content": "Recent developments in the media sector indicate a notable trend where freelancers are increasingly being offered permanent contracts, reflecting a shift in employment practices within the industry. This transition aligns with new leadership changes at prominent companies such as WPG Uitgevers and Mybusinessmedia, which may further influence operational dynamics. Additionally, the appointment of Marc Veeningen as the new editor-in-chief of Talpa Networks signifies fresh perspectives in media management, potentially impacting staffing strategies. This trend not only addresses the job security concerns of freelancers but also suggests a recalibration of talent acquisition by media organizations. Such evolutions warrant closer examination of the balance between flexibility and stability in the workforce.",
            "references": "Source: https://www.villamedia.nl/artikel/transfer-thursday-freelancers-naar-vast-contract-een-mooie-klus-bij-de-volkskrant-en-een-nieuwe-directeur-bij-wpg"
          }
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c87bbecc-453d-4b8c-8b86-dcf7e1d6907b",
  "connections": {
    "Restructure JSON": {
      "main": [
        []
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Write Zettlekasten note from input1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Write YAML Frontmatter",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Save Markdown file": {
      "main": [
        []
      ]
    },
    "Write YAML Frontmatter": {
      "main": [
        [
          {
            "node": "Restructure JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Write Zettlekasten note from input1",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "Write YAML Frontmatter",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Receive results from any workflow": {
      "main": [
        [
          {
            "node": "If the input has binary attachment",
            "type": "main",
            "index": 0
          },
          {
            "node": "Save Markdown file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If the input has binary attachment": {
      "main": [
        [
          {
            "node": "Save attachment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Zettlekasten note from input1": {
      "main": [
        [
          {
            "node": "Write YAML Frontmatter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 其他

需要付费吗?

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

工作流信息
难度等级
中级
节点数量15
分类1
节点类型8
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流