8
n8n 中文网amn8n.com

使用关键词自动进行 AI 新闻筛选并发送到 Telegram

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 27 个节点。主要使用 If, Code, Wait, Telegram, HttpRequest 等节点。 使用 Gemini AI 和 BrowserAct 筛选实时新闻并发送至 Telegram 频道

前置要求
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "jn6Sgk2HcKiQKW0s",
  "meta": {
    "instanceId": "e2a1d0ec98fd0994972a016020dcf90b56d31fa85f2abd02801701fb8fc45e3d",
    "templateCredsSetupCompleted": true
  },
  "name": "使用关键词自动进行 AI 新闻筛选并发送到 Telegram",
  "tags": [],
  "nodes": [
    {
      "id": "c6e3a4a0-5ad5-4112-b31f-5fe4778e6166",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        416,
        64
      ],
      "webhookId": "de7e4b3a-5957-40b9-9312-dcf012ebc6f0",
      "parameters": {
        "unit": "minutes"
      },
      "typeVersion": 1.1
    },
    {
      "id": "18832f60-9fb3-4cec-ba87-781dd68bfcde",
      "name": "等待1",
      "type": "n8n-nodes-base.wait",
      "position": [
        -128,
        64
      ],
      "webhookId": "25fa1ce4-496d-47af-b18e-47b3319236cb",
      "parameters": {
        "unit": "minutes",
        "amount": 1
      },
      "typeVersion": 1.1
    },
    {
      "id": "fdc9f1cf-45ff-4264-885f-ccf84593244e",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        928,
        -32
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"Matched_News\": [\n    {\n      \"Headline\": \"<String>\",\n      \"Pic\": \"<String>\",\n      \"Url\": \"<String>\"\n    }\n  ]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "f5977d48-28d1-4fa5-adcb-d15a1d735a3e",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -624,
        -192
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7df1a8af-2829-41c8-9b5d-6b295a3be150",
      "name": "便签-介绍",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        -416
      ],
      "parameters": {
        "width": 592,
        "height": 424,
        "content": "## 试试看!"
      },
      "typeVersion": 1
    },
    {
      "id": "254977ab-b357-46b9-b802-bd467faa3bf1",
      "name": "便签-抓取",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        -416
      ],
      "parameters": {
        "color": 5,
        "width": 480,
        "height": 180,
        "content": "## 1. 触发新闻抓取器"
      },
      "typeVersion": 1
    },
    {
      "id": "cea82e48-0885-4791-b9ad-ba376541e4ca",
      "name": "便签-等待",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        -416
      ],
      "parameters": {
        "color": 5,
        "width": 496,
        "height": 180,
        "content": "## 2. 等待抓取完成"
      },
      "typeVersion": 1
    },
    {
      "id": "fedbec03-948e-44b5-b39b-919b85ba450b",
      "name": "便签-AI",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        -416
      ],
      "parameters": {
        "color": 4,
        "width": 496,
        "height": 176,
        "content": "## 3. 使用 AI 按关键词筛选新闻"
      },
      "typeVersion": 1
    },
    {
      "id": "c0ad9350-4281-48f7-adb0-0ae07bf9e733",
      "name": "便签-通知",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        288
      ],
      "parameters": {
        "color": 3,
        "width": 496,
        "height": 164,
        "content": "## 4. 将新闻发送到 Telegram"
      },
      "typeVersion": 1
    },
    {
      "id": "321d6bf9-303f-43a2-a559-4c1bbff5e543",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        -224
      ],
      "parameters": {
        "color": 5,
        "width": 480,
        "height": 496,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "85c6eae6-b867-41d0-9028-a5f5664b0956",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        -224
      ],
      "parameters": {
        "color": 4,
        "width": 496,
        "height": 304,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "bff1aca3-719f-4328-8d4d-2d95583fa413",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        96
      ],
      "parameters": {
        "color": 3,
        "width": 496,
        "height": 176,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c27989d0-7f1b-4a42-8dc1-7ac56e6f0fbd",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        -224
      ],
      "parameters": {
        "color": 5,
        "width": 496,
        "height": 496,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "416d315c-0554-40ff-a7af-9a4e73f4fd05",
      "name": "便签-如何使用",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        16
      ],
      "parameters": {
        "width": 592,
        "height": 168,
        "content": "## 使用方法"
      },
      "typeVersion": 1
    },
    {
      "id": "b51ef89a-024e-4e05-910e-6e6767341f08",
      "name": "运行工作流",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        -320,
        -192
      ],
      "parameters": {
        "url": "https://api.browseract.com/v2/workflow/run-task",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "workflow_id",
              "value": "52940169781736034"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "x2SDklVkEIBFM56U",
          "name": "BrowserACtaPi"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "2a231d11-d5cd-4407-8eed-ae5da29f784f",
      "name": "检查错误",
      "type": "n8n-nodes-base.if",
      "position": [
        -128,
        -192
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d48ae258-78a0-4b26-923d-2643b6b774c6",
              "operator": {
                "type": "object",
                "operation": "notExists",
                "singleValue": true
              },
              "leftValue": "={{ $json.error }}",
              "rightValue": ""
            },
            {
              "id": "3967a169-8432-45bd-8f89-08795fd12679",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": "null"
            }
          ]
        }
      },
      "retryOnFail": false,
      "typeVersion": 2.2
    },
    {
      "id": "5a7f5fa2-c200-4083-b7f5-583fefac52b2",
      "name": "获取工作流数据",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        160,
        -208
      ],
      "parameters": {
        "url": "https://api.browseract.com/v2/workflow/get-task",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "=task_id",
              "value": "={{ $json.id }}"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "x2SDklVkEIBFM56U",
          "name": "BrowserACtaPi"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "73aaf1e5-d195-456b-8f27-421d0341fde2",
      "name": "检查\"已完成\"状态",
      "type": "n8n-nodes-base.if",
      "position": [
        432,
        -208
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0347a2a2-eb32-414d-9494-4e648078cf40",
              "operator": {
                "type": "object",
                "operation": "notExists",
                "singleValue": true
              },
              "leftValue": "={{ $json.error }}",
              "rightValue": ""
            },
            {
              "id": "99f31959-6f27-40dd-97c3-6ff611da1e0b",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "finished"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "95c5ddfe-713d-4aa1-8a8e-8ef3bbef9847",
      "name": "关键词筛选",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        784,
        -224
      ],
      "parameters": {
        "text": "=from input parameters {{ $json.input_parameters }} you can find \"Key_Words\" input parametres are spilted by \";\" and each keyWord Splited by \",\" Extract the Keywords From it\n\ninside the Output -> String {{ $json.output.string }} there is list of maps like thsi sample\n[\n{\n\"Headline\":<String>\n\"Pic\":<String>\n\"Url\":<String>\n}\n]\n\ni want you to check each items Headline and comapre it with teh keywords if it directly contains keywords or were about keywords send it to output in the Json like this \n\n{\n  \"Matched_News\": [\n    {\n      \"Headline\": \"<String>\",\n      \"Pic\": \"<String>\",\n      \"Url\": \"<String>\"\n    }\n  ]\n}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "2bcfb58c-03ce-4b10-bdaa-1b2b349b1e25",
      "name": "Google Gemini",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        784,
        -32
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "G8YK0DTLFGi5n0WD",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "20e496e0-d254-4bbf-b1fb-7a26c629dabf",
      "name": "代码 - 清理输出",
      "type": "n8n-nodes-base.code",
      "position": [
        688,
        128
      ],
      "parameters": {
        "jsCode": "// Get the original list from the 'Request' key in the incoming data.\nconst originalList = $input.first().json.output.Matched_News;\n\n// Create a new array to store the formatted output.\nconst outputItems = [];\n\n// Loop through each item in the original list.\nfor (const item of originalList) {\n  // For each item, create a new object in the desired format.\n  outputItems.push({\n    json: {\n      \"text\": item\n    }\n  });\n}\n\n// Return the new list of formatted objects.\nreturn outputItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "c6716be1-b60f-45f6-a4ed-0352fe5019a7",
      "name": "发送新闻图片到 Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        896,
        128
      ],
      "webhookId": "7d044499-2671-4606-bd72-18153c3cc7a0",
      "parameters": {
        "file": "={{ $json.text.Url }}",
        "chatId": "@test",
        "operation": "sendPhoto",
        "additionalFields": {
          "caption": "={{ $json.text.Headline }}\n\n{{ $json.text.Url }}"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "34LCOs7mfDx5vkSV",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0dbf1ada-3cdb-4167-b024-672bb01f6f39",
      "name": "便签-如何使用1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        192
      ],
      "parameters": {
        "width": 592,
        "height": 96,
        "content": "## 需要帮助?"
      },
      "typeVersion": 1
    },
    {
      "id": "409a0100-6535-45e9-8354-b0f148a2acb9",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        -512
      ],
      "parameters": {
        "color": 5,
        "width": 182,
        "height": 80,
        "content": "##"
      },
      "typeVersion": 1
    },
    {
      "id": "66583e9c-49db-4498-a42e-c0d5a2d5455b",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        -512
      ],
      "parameters": {
        "color": 5,
        "width": 182,
        "height": 80,
        "content": "##"
      },
      "typeVersion": 1
    },
    {
      "id": "1ba5bc7c-7190-44a9-9bb4-92fb0261607e",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        784,
        -512
      ],
      "parameters": {
        "color": 4,
        "width": 262,
        "height": 80,
        "content": "##"
      },
      "typeVersion": 1
    },
    {
      "id": "33e672c8-e51c-4fc9-bbf6-adec63b3c27d",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        768,
        464
      ],
      "parameters": {
        "color": 3,
        "width": 214,
        "height": 80,
        "content": "##"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d1c49fab-6556-4a49-81ba-7171954be2df",
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Get WorkFlow Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Run WorkFlow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run WorkFlow": {
      "main": [
        [
          {
            "node": "Check For Errors",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini": {
      "ai_languageModel": [
        [
          {
            "node": "KeyWords filtering",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Check For Errors": {
      "main": [
        [
          {
            "node": "Get WorkFlow Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Run WorkFlow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get WorkFlow Data": {
      "main": [
        [
          {
            "node": "Check For \"Finished\" Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "KeyWords filtering": {
      "main": [
        [
          {
            "node": "Code - Clean Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Clean Output": {
      "main": [
        [
          {
            "node": "Send a News Photo To Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "KeyWords filtering",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Check For \"Finished\" Status": {
      "main": [
        [
          {
            "node": "KeyWords filtering",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

作者
Madame AI Team | Kai

Madame AI Team | Kai

@madame-ai

I’m a PhD in Physics turned AI enthusiast, passionate about uncovering how AI is transforming content creation, business, and daily life.

外部链接
在 n8n.io 查看

分享此工作流