使用NewsAPI和Google Gemini自动生成科技新闻博客文章并发布到WordPress
中级
这是一个Content Creation、Multimodal AI领域的自动化工作流,包含 9 个节点。主要使用 Code、Wordpress、HttpRequest、SplitInBatches、Agent 等节点。 使用NewsAPI和Google Gemini自动生成科技新闻博客文章并发布到WordPress
前置要求
- •可能需要目标 API 的认证凭证
- •Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "ba65f2c4-f38e-407c-87d8-5540a98ce6e3",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-336,
-176
],
"parameters": {
"width": 2092,
"height": 588,
"content": "## 每日新闻摘要自动化"
},
"typeVersion": 1,
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI News Summarizer",
"type": "ai_languageModel",
"index": 0
}
]
]
}
},
{
"id": "8f0b8ffe-e898-4d43-8b67-1ebe60c2e3a6",
"name": "每日上午 8 点触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
128,
48
],
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 8 * * *"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "f002cec0-eee4-457e-9b81-81b1bc4cf8aa",
"name": "获取科技新闻",
"type": "n8n-nodes-base.httpRequest",
"position": [
320,
48
],
"parameters": {
"url": "https://newsapi.org/v2/top-headlines?apiKey=yourkey&country=us&category=technology&pageSize=10",
"options": {},
"sendBody": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "country",
"value": "us"
},
{
"name": "pageSize",
"value": "10"
},
{
"name": "category",
"value": "technology"
}
]
},
"genericAuthType": "httpQueryAuth"
},
"credentials": {
"httpQueryAuth": {
"id": "VHh5tyahYp2OlfDs",
"name": "Query Auth account"
}
},
"typeVersion": 4.1
},
{
"id": "8a7b5502-fa7f-4a19-ba44-f0da9fb71f10",
"name": "AI 新闻摘要器",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
992,
48
],
"parameters": {
"text": "=You are a tech news writer. Based on the article provided, write an engaging blog post.\n\nReturn ONLY valid JSON in this exact format:\n{\n \"title\": \"Your catchy headline here\",\n \"content\": \"Full blog post content with proper formatting\"\n}\n\nArticle details:\n- Title: {{ $json.title }}\n- Description: {{ $json.description }}\n- Content: {{ $json.content }}\n- Source: {{ $json.source }}\n\nWrite a 600-800 word blog post expanding on this article.",
"options": {
"systemMessage": "You are a tech news curator. Create a compelling blog post that summarizes the top tech news stories. Format it with proper headings, bullet points, and include brief commentary on each story's significance. Make it engaging and informative for a general tech audience."
},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "4006ddaa-e0ae-4b88-9ed8-bf83a7c6dce3",
"name": "Google Gemini聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
1072,
272
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"id": "wNw45YZvXXpeocJ2",
"name": "TST API"
}
},
"typeVersion": 1
},
{
"id": "446986b0-41ee-43c0-bec0-58db6c6530c0",
"name": "发布到 WordPress",
"type": "n8n-nodes-base.wordpress",
"position": [
1488,
48
],
"parameters": {
"title": "={{ $json.title }}",
"additionalFields": {
"tags": [
"technology",
"news",
"daily",
"automation"
],
"status": "publish",
"content": "={{ $json.content }}"
}
},
"typeVersion": 1
},
{
"id": "bc06c085-5fa9-495c-ad5c-0cfe0c0cd500",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
768,
48
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "97aa2d40-ad65-4570-bcda-45d13c67c07f",
"name": "标题和内容",
"type": "n8n-nodes-base.code",
"position": [
1264,
48
],
"parameters": {
"jsCode": "const items = $input.all();\n\nreturn items.map(item => {\n // Remove markdown code blocks and parse JSON\n let aiOutput = item.json.output;\n \n // Remove ```json and ``` markers\n aiOutput = aiOutput.replace(/```json\\s*/, '').replace(/```\\s*$/, '');\n \n // Parse the cleaned JSON\n const parsedOutput = JSON.parse(aiOutput.trim());\n \n return {\n json: {\n title: parsedOutput.title,\n content: parsedOutput.content,\n originalTitle: item.json.title,\n source: item.json.source,\n url: item.json.url\n }\n };\n});"
},
"typeVersion": 2
},
{
"id": "ac0c85f6-d554-40c0-8cd2-a5869367cb5a",
"name": "拆分文章",
"type": "n8n-nodes-base.code",
"position": [
544,
48
],
"parameters": {
"jsCode": "// Split the articles array and clean up the data\nconst articles = $input.first().json.articles;\n\n// Filter out articles with null/missing content and limit to top 5\nconst validArticles = articles\n .filter(article => \n article.title && \n article.description && \n article.content && \n article.content !== \"[Removed]\"\n )\n .slice(0, 5); // Limit to 5 articles to avoid rate limits\n\n// Return each article as a separate item\nreturn validArticles.map(article => ({\n json: {\n title: article.title,\n description: article.description,\n content: article.content,\n url: article.url,\n urlToImage: article.urlToImage,\n publishedAt: article.publishedAt,\n source: article.source.name\n }\n}));"
},
"typeVersion": 2
}
],
"pinData": {},
"connections": {
"Split Articles": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Fetch Tech News": {
"main": [
[
{
"node": "Split Articles",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "AI News Summarizer",
"type": "main",
"index": 0
}
]
]
},
"Daily 8AM Trigger": {
"main": [
[
{
"node": "Fetch Tech News",
"type": "main",
"index": 0
}
]
]
},
"Title and Content": {
"main": [
[
{
"node": "Publish to WordPress",
"type": "main",
"index": 0
}
]
]
},
"AI News Summarizer": {
"main": [
[
{
"node": "Title and Content",
"type": "main",
"index": 0
}
]
]
},
"Publish to WordPress": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI News Summarizer",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个中级难度的工作流,适用于Content Creation、Multimodal AI等场景。适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用Gemini AI将GitHub热门仓库自动生成周教程并发布到WordPress
使用Gemini AI将GitHub热门仓库自动生成周教程并发布到WordPress
Code
Split Out
Email Send
+6
9 节点David Olusola
Content Creation
使用GPT-5和fal.ai图像从关键词到WordPress自动化SEO博客流程
使用GPT-5和fal.ai图像从关键词到WordPress自动化SEO博客流程
Set
Code
Wait
+20
96 节点Paul
Content Creation
基于Gemini AI、Supabase和Nano-Banana的端到端博客创建自动化
使用Gemini AI、Supabase和Nano-Banana实现端到端博客创建自动化
If
Set
Code
+16
51 节点Muhammad Asadullah
Content Creation
使用特定工具为WordPress创建SEO优化博客
使用特定工具为WordPress创建SEO优化博客
Set
Code
Limit
+22
124 节点Paul
Content Creation
使用 Gemini AI 和 Flux 图像生成通过热门帖子分析自动创建 LinkedIn 内容
使用 Gemini AI 和 Flux 图像生成通过热门帖子分析自动创建 LinkedIn 内容
Code
Wait
Filter
+11
20 节点Roshan Ramani
Content Creation
WordPress博客自动化专业版(深度研究)v2.1市场
使用GPT-4o、Perplexity AI和多语言支持自动化SEO优化的博客创建
If
Set
Xml
+27
125 节点Daniel Ng
Content Creation
工作流信息
难度等级
中级
节点数量9
分类2
节点类型8
作者
David Olusola
@dae221I help ambitious businesses eliminate operational bottlenecks and scale faster with AI automation. My clients typically see 40-60% efficiency gains within 90 days. Currently accepting 3 new projects this quarter - david@daexai.com
外部链接
在 n8n.io 上查看 →
分享此工作流