8
n8n 中文网amn8n.com

blog_workflow_template_n8n

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 23 个节点。主要使用 If, Code, Wait, Gmail, LinkedIn 等节点。 使用Claude AI从新闻自动生成WordPress文章并分享到LinkedIn

前置要求
  • Google 账号和 Gmail API 凭证
  • LinkedIn API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • Anthropic API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "mOYawNKTDlExaveN",
  "meta": {
    "instanceId": "b75f4073dad0f93fa3a88b8a144a6a6bb3ffc5fb4c5b8f758257986fdc74ce77"
  },
  "name": "blog_workflow_template_n8n",
  "tags": [],
  "nodes": [
    {
      "id": "1f2c0ac6-fddc-4335-97ab-2330cffc0889",
      "name": "当点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        1488,
        1120
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e58ac4d7-b874-482c-8bf7-7ba733f6bd18",
      "name": "审批请求",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2816,
        944
      ],
      "webhookId": "6b64b6eb-b90d-4cf0-8b91-8743f12d92ee",
      "parameters": {
        "sendTo": "<mail>@gmail.com",
        "message": "={{ $json.output.content }}",
        "options": {},
        "subject": "=Article approval: {{ $json.output.title }}",
        "operation": "sendAndWait",
        "approvalOptions": {
          "values": {
            "approvalType": "double"
          }
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "1dd1ac97-acfd-48eb-aff5-280f3a47fc97",
      "name": "定时触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        1488,
        832
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 10,
              "triggerAtMinute": 30
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b46e02aa-6ccf-4198-97b0-d1d480f247ce",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        2688,
        1728
      ],
      "webhookId": "cc8dc6d4-7969-4658-93d9-105ba467ff01",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "c2facf43-a1ff-47a3-ba73-a942a269e11e",
      "name": "如果",
      "type": "n8n-nodes-base.if",
      "position": [
        3120,
        944
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "8eabd36a-87f0-47d6-b240-5b7b5b3ef2bc",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data.approved }}",
              "rightValue": "true"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "b2a499ee-16fe-454b-9a19-2bb2b152c72b",
      "name": "基础LLM链",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        2320,
        944
      ],
      "parameters": {
        "text": "=[PROMPT GOES HERE]:  {{ $json.userNews }}",
        "batching": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "3acad4e1-76ad-4887-883d-1406f6c8f730",
      "name": "Anthropic 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        2320,
        1136
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-20250514",
          "cachedResultName": "Claude 4 Sonnet"
        },
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "57695364-25ea-47f1-a809-5f6a55f8718d",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2464,
        1136
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"title\": \"Title of the article\",\n\t\"content\": \"content of the article\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "fd83b42b-ba7e-421a-8acb-f97bef2bbda5",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2656,
        1344
      ],
      "parameters": {
        "color": 5,
        "width": 400,
        "height": 528,
        "content": "## 日志记录"
      },
      "typeVersion": 1
    },
    {
      "id": "aa7aa325-eb00-4d25-bfc7-c23bc2e6c5ed",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1840,
        448
      ],
      "parameters": {
        "color": 5,
        "width": 784,
        "height": 848,
        "content": "## 内容生成"
      },
      "typeVersion": 1
    },
    {
      "id": "ced1b5ad-caa0-4010-9028-8680ac8da858",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2656,
        448
      ],
      "parameters": {
        "color": 5,
        "width": 400,
        "height": 848,
        "content": "## 人工介入"
      },
      "typeVersion": 1
    },
    {
      "id": "672dc96a-dd9e-4697-bc34-26e0c78c3c8f",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3088,
        448
      ],
      "parameters": {
        "color": 4,
        "width": 1344,
        "height": 848,
        "content": "## 发布内容"
      },
      "typeVersion": 1
    },
    {
      "id": "0bc9d9a3-5ebd-437a-8bbb-7a68b5a9780e",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1328,
        448
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 848,
        "content": "## 触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "364d480e-9601-4568-b3cc-6e2450a17503",
      "name": "成功消息",
      "type": "n8n-nodes-base.gmail",
      "position": [
        4160,
        944
      ],
      "webhookId": "1198e092-a011-440b-a9b8-85967added38",
      "parameters": {
        "sendTo": "<mail>@gmail.com",
        "message": "=Articolo pubblicato:  {{ $('Push article to WordPress').item.json.short_URL }}",
        "options": {},
        "subject": "WordPress Article"
      },
      "typeVersion": 2.1
    },
    {
      "id": "c1bbbbb4-2a3c-46b1-89f6-4a8a0c046691",
      "name": "失败消息",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3312,
        1136
      ],
      "webhookId": "0cde3d27-12e3-4470-b258-e42f595c29fd",
      "parameters": {
        "sendTo": "<mail>@gmail.com",
        "message": "=You declined the article:  {{ $('HTTP Request to Claude 2 - Title Creation').item.json.content[0].text }}",
        "options": {},
        "subject": "Article DECLINED"
      },
      "typeVersion": 2.1
    },
    {
      "id": "67ec150b-3bfd-4567-8f85-04c6e979021b",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        304
      ],
      "parameters": {
        "width": 1296,
        "height": 1536,
        "content": "## AI驱动的博客自动化"
      },
      "typeVersion": 1
    },
    {
      "id": "a3cc5fa3-a50b-43ea-a708-851639c4e31d",
      "name": "获取新闻",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1904,
        944
      ],
      "parameters": {
        "url": "https://api.currentsapi.services/v1/search",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "b9Fm0LGH82gzzSGa",
          "name": "Header Auth - CurrentsApi"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 3000
    },
    {
      "id": "125d4d6c-dc06-4788-bf6f-d3a8d7edcdd9",
      "name": "JSON解析",
      "type": "n8n-nodes-base.code",
      "position": [
        2112,
        944
      ],
      "parameters": {
        "jsCode": "const userString = JSON.stringify($input.first().json.news);\n\n// The CORRECT way to return data in a Code Node\nreturn [\n  {\n    json: {\n      userNews: userString\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "b3e4c350-57ed-4627-bfec-02041f2c17b6",
      "name": "追加日志到表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2864,
        1728
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "type",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "role",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "role",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "model",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "model",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "content",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "content",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "stop_reason",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "stop_reason",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "stop_sequence",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "stop_sequence",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "usage",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "usage",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dowCNqxxlNt8LUJmqn5jEFQVCVcsECC3OuPMUwHlI44/edit#gid=0",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1dowCNqxxlNt8LUJmqn5jEFQVCVcsECC3OuPMUwHlI44",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dowCNqxxlNt8LUJmqn5jEFQVCVcsECC3OuPMUwHlI44/edit?usp=drivesdk",
          "cachedResultName": "log_blog"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "clGpH9YgPxlD7PM0",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "71f6624e-dc6a-42ea-99ae-ec80c2b8221e",
      "name": "从数组中选择图片",
      "type": "n8n-nodes-base.code",
      "position": [
        3280,
        944
      ],
      "parameters": {
        "jsCode": "function getRandomItem(arr) {\n  // Calculate a random index and return the item at that index\n  return arr[Math.floor(Math.random() * arr.length)];\n}\n\nconst myChoices = [\"131\", \"130\", \"129\", \"70\"];\n\n// Call the function and store the returned value in a variable\nconst selected = getRandomItem(myChoices);\n\n// Return as an array of items, each with a { json } property\nreturn [\n  { json: { choice: selected } }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "040fa548-d626-4da1-a6ed-cb2a50b2165f",
      "name": "推送文章到WordPress",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3456,
        944
      ],
      "parameters": {
        "url": "https://public-api.wordpress.com/rest/v1.1/sites/<site_Id>/posts/new",
        "method": "POST",
        "options": {
          "response": {
            "response": {}
          }
        },
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "title",
              "value": "={{ $('Basic LLM Chain').item.json.output.title }}"
            },
            {
              "name": "content",
              "value": "={{ $('Basic LLM Chain').item.json.output.content }}"
            },
            {
              "name": "featured_image",
              "value": "={{ $json.choice }}"
            }
          ]
        },
        "genericAuthType": "oAuth2Api"
      },
      "credentials": {
        "oAuth2Api": {
          "id": "Z1r5LAKxOTyzadio",
          "name": "WordPress.com - auth"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.2
    },
    {
      "id": "4a69a961-9d51-4e87-b95c-77707c4b8fed",
      "name": "获取LinkedIn图片",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3664,
        944
      ],
      "parameters": {
        "url": "={{ $json.post_thumbnail.URL }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "159306a0-662f-4bb3-9de8-d2b58f39c8fa",
      "name": "推送到LinkedIn页面",
      "type": "n8n-nodes-base.linkedIn",
      "position": [
        3888,
        944
      ],
      "parameters": {
        "text": "={{ $json.title }}",
        "postAs": "organization",
        "organization": "111111111",
        "additionalFields": {
          "originalUrl": "={{ $json.URL }}",
          "thumbnailBinaryPropertyName": "data"
        },
        "shareMediaCategory": "ARTICLE"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d1aac863-8bc5-42e1-8503-426b47ed32a4",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Choose image from array",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Failure message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Append log to sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JSON Parsing": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetching news": {
      "main": [
        [
          {
            "node": "JSON Parsing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Approval request",
            "type": "main",
            "index": 0
          },
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approval request": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Fetching news",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Push to Linkedin Page": {
      "main": [
        [
          {
            "node": "Success message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET Image for Linkedin": {
      "main": [
        [
          {
            "node": "Push to Linkedin Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Choose image from array": {
      "main": [
        [
          {
            "node": "Push article to WordPress",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Push article to WordPress": {
      "main": [
        [
          {
            "node": "GET Image for Linkedin",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Fetching news",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 内容创作, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流