使用Perplexity和OpenAI为社交媒体创建AI新闻视频内容创意
高级
这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 18 个节点。主要使用 Set, Code, Gmail, Merge, HttpRequest 等节点。 使用Perplexity和OpenAI为社交媒体创建AI新闻视频内容创意
前置要求
- •Google 账号和 Gmail API 凭证
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "28099d2544433ae0f39c65315a4d4c531947fcb0f060a94d6047d7be5df31063",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "ba46fd37-7223-4bf4-9ee2-48d25c415f09",
"name": "计划触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
1140,
480
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 6
}
]
}
},
"typeVersion": 1.2
},
{
"id": "18aac787-d988-4505-876d-72dc2c5e8056",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
1780,
500
],
"parameters": {
"numberInputs": 3
},
"typeVersion": 3.1
},
{
"id": "233798de-74b0-42bb-83ef-2151fbce1f8b",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1800,
840
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "91253544-dba4-4055-ac8c-b5c0a0ac8077",
"name": "关于我",
"type": "n8n-nodes-base.set",
"position": [
2100,
500
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "e1fa7dff-0850-4743-a503-85c234802478",
"name": "Name",
"type": "string",
"value": "John Doe"
},
{
"id": "a2452ec6-4130-4057-bd6f-26512fbc3dd9",
"name": "Niche",
"type": "string",
"value": "a tech founder"
},
{
"id": "89ec4977-fd00-432f-b71c-73ee2d2d89a0",
"name": "Business Name",
"type": "string",
"value": "John Doe AI"
},
{
"id": "2ff18a0a-45a8-45c2-9a99-0f051d294e61",
"name": "Busines Type",
"type": "string",
"value": "Marketing Agency"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "c152e25f-4f81-4277-a58f-c60933f2ffdd",
"name": "内容生成",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
2260,
500
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "GPT-4.1-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=Your Role:\nYou are \"CreatorAI,\" an expert short-form video content strategist and scriptwriter specializing in AI.\n\nUser & Objectives:\nYour user is {{ $json.Name }}, a tech founder aiming to build authority and attract inbound interest for {{ $json['Business Name'] }}, their {{ $json['Busines Type'] }}. Content should educate, entertain, and establish {{ $json.Name }} as a thought leader, leading to client acquisition naturally.\n\n{{ $json.Name }}'s Desired Content Tone:\nExpert, Approachable & Connecting, Friendly & Conversational (like a 25-year-old peer), Concise & Smart (with dry humor), Value-Driven.\n\nInput Material:\nYou will receive relevant stories, news, or raw information under a \"[INPUT STORIES/NEWS]:\" heading (e.g., {{ $('Combine items').item.json.combinedContent }} and citations: {{ $('Combine items').item.json.combinedCitations }}). Use this for content generation.\n\nCore Task: Create Content Packages (Up to 10 per input batch)\nFor each input, generate a content package including a Video Script, Caption Text, and Text Overlay. All content must focus on tangible business benefits and solutions.\n\nUnique Angle: Identify a distinct, interesting angle or insight from the input.\n\nContent Pillars Alignment: Prioritize angles aligned with:\n\nAI news as a game-changer.\n\nAI automation solving business pain points (time, cost, efficiency).\n\nSpecific AI automation use cases/applications.\n\nAI agents/custom workflows transforming operations.\n\nFuture of work with AI.\n\nSales process automation benefits.\n\nQuick AI tool tips/productivity hacks.\n\nDebunking AI myths.\n\nBroader implications of AI for founders/professionals.\n\nReinforce: Every piece must address a business need or offer a clear, compelling advantage.\n\nOutput Requirements (Per Content Package):\n\nA. Video Script:\nStyle & Tone: First-person narration, expert sharing insights (not selling). Mention [{{ $json['Business Name'] }}] organically as a reference, not a direct pitch.\n\nEngagement: Powerful hook (first 3 seconds).\n\nMini-Narrative: Problem/event → generic AI solution/strategy → potential impact. DO NOT mention [{{ $json['Business Name'] }}] here.\n\nClarity: Single, clear takeaway. Simple language, no jargon unless clarified.\n\nShow, Don't Tell: Vivid language, concrete examples, micro-stories (struggle → AI turning point → positive outcome).\n\nHuman-Centric: Focus on impact on employees/founders.\n\nPacing & Conciseness: UNDER 700 CHARACTERS. Short, impactful sentences, natural line breaks.\n\nFormatting: NEVER use triple quotes (\"\"\").\n\nB. Caption Text:\nTone: Friendly, expert, funny, approachable.\n\nStructure: Engaging hook/question, more context/value than script.\n\nCall to Action (CTA): Clear, direct engagement. Ask for a specific keyword comment (e.g., \"Comment 'Workflow' for more\"). Add \"Follow for more.\"\n\nHashtags: 3-5 relevant, space-separated (e.g., #AIautomation #BusinessGrowth).\n\nC. Text Overlay:\nPurpose: Short, punchy core message (for thumbnail/first screen).\n\nFormat: Extremely concise (3-7 words), ALL CAPS or Title Case.\n\nContent: Intriguing hook, benefit, or core idea from video's angle.\n\nStrict Final Output Format (For EACH Package):\nAdhere precisely to this format. Do not add any extra formatting, explanations, or markdown around these lines:\n\nText Overlay: [YOUR GENERATED TEXT OVERLAY HERE]\nVideo Script: [YOUR GENERATED VIDEO SCRIPT HERE]\nCaption Text: [YOUR GENERATED CAPTION TEXT HERE]"
}
]
}
},
"credentials": {
"openAiApi": {
"id": "ZohahxqrnEz33IQQ",
"name": "OpenAi account 2"
}
},
"typeVersion": 1.8
},
{
"id": "15a10fc1-c346-4baf-aeb8-361ec819aa6d",
"name": "主题 1(例如-AI 新闻)",
"type": "n8n-nodes-base.httpRequest",
"position": [
1340,
480
],
"parameters": {
"url": "https://api.perplexity.ai/chat/completions",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"sonar-pro\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"Be precise and concise.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Find me 5 new, interesting, and relevant stories and news related to artificial intelligence from today or yesterday. Label them 1 through 5\"\n }\n ]\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer <YOUR_API_KEY>"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"typeVersion": 4.1
},
{
"id": "0f2cc14b-72d2-44ed-92e7-1c203caf6bc5",
"name": "主题 2(例如 - AI 市场趋势)",
"type": "n8n-nodes-base.httpRequest",
"position": [
1340,
680
],
"parameters": {
"url": "https://api.perplexity.ai/chat/completions",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"sonar-pro\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"Be precise and concise.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Find me 5 new, interesting, and relevant stories and news related to market and industry trends in artificial intelligence from today or yesterday. Label them 1 through 5\"\n }\n ]\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer <YOUR_API_KEY>"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"typeVersion": 4.1
},
{
"id": "232d6065-7132-4e10-9b09-cee1a8238b8d",
"name": "主题 3(例如- AI 业务自动化)",
"type": "n8n-nodes-base.httpRequest",
"position": [
1340,
880
],
"parameters": {
"url": "https://api.perplexity.ai/chat/completions",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"sonar-pro\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"Be precise and concise.\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Find me 5 new, interesting, and relevant stories related to automation of business using artificial intelligence from today or yesterday. Label them 1 through 5\"\n }\n ]\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer <YOUR_API_KEY>"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"typeVersion": 4.1
},
{
"id": "8b31dda9-a7a6-43c4-a00f-4322a17ac110",
"name": "整理内容",
"type": "n8n-nodes-base.code",
"position": [
1540,
480
],
"parameters": {
"jsCode": "return items.map(item => {\n const choice = item.json.choices?.[0];\n const message = \n choice?.message?.content || \"No message content found\";\n const citations = \n item.json?.citations || [];\n\n return {\n json: {\n index: choice?.index ?? null,\n role: choice?.message?.role ?? null,\n finish_reason: \n choice?.finish_reason ?? null,\n content: message,\n citations: citations,\n },\n };\n});"
},
"typeVersion": 2
},
{
"id": "efcb202e-4fcc-40c0-93a9-5ae6ca3ccf12",
"name": "整理内容1",
"type": "n8n-nodes-base.code",
"position": [
1540,
680
],
"parameters": {
"jsCode": "return items.map(item => {\n const choice = item.json.choices?.[0];\n const message = \n choice?.message?.content || \"No message content found\";\n const citations = \n item.json?.citations || [];\n\n return {\n json: {\n index: choice?.index ?? null,\n role: choice?.message?.role ?? null,\n finish_reason: \n choice?.finish_reason ?? null,\n content: message,\n citations: citations,\n },\n };\n});"
},
"typeVersion": 2
},
{
"id": "13edb6e8-878a-4fbd-893b-747f5f020b6a",
"name": "整理内容2",
"type": "n8n-nodes-base.code",
"position": [
1540,
880
],
"parameters": {
"jsCode": "return items.map(item => {\n const choice = item.json.choices?.[0];\n const message = \n choice?.message?.content || \"No message content found\";\n const citations = \n item.json?.citations || [];\n\n return {\n json: {\n index: choice?.index ?? null,\n role: choice?.message?.role ?? null,\n finish_reason: \n choice?.finish_reason ?? null,\n content: message,\n citations: citations,\n },\n };\n});"
},
"typeVersion": 2
},
{
"id": "6bbdb827-729b-437c-a1b2-751fc391999b",
"name": "合并项目",
"type": "n8n-nodes-base.code",
"position": [
1940,
500
],
"parameters": {
"jsCode": "const combinedContent =\n items.map(item =>\n item.json.content).join('\\n\\n');\n\n// Flatten and dedupe citations\nconst combinedCitations = [\n ...new Set(\n items\n .flatMap(item =>\n item.json.citations || [])\n .filter(url => typeof url ===\n 'string' && url.startsWith('http'))\n )\n];\n\nreturn [{\n json: {\n combinedContent,\n combinedCitations\n }\n}];"
},
"typeVersion": 2
},
{
"id": "4417ab22-ab3b-4a68-93e5-9eab2ea7509a",
"name": "提取数据",
"type": "n8n-nodes-base.code",
"position": [
1800,
680
],
"parameters": {
"jsCode": "const results = [];\n\nfor (const item of items) {\n // Ensure the input item has the expected structure and content\n if (!item.json || !item.json.message || typeof item.json.message.content !== 'string') {\n console.warn(\"Skipping item: Invalid structure or missing AI content.\", item);\n continue;\n }\n\n const aiResponse = item.json.message.content;\n\n // Skip placeholder messages if the AI didn't generate actual content\n if (aiResponse.includes(\"Please provide the collection of relevant stories\")) {\n console.log(\"Skipping instruction/placeholder message from AI.\");\n continue;\n }\n\n const lines = aiResponse.split('\\n');\n\n let currentPackage = {\n text_overlay_output: \"\",\n video_script_output: \"\",\n caption_text_output: \"\"\n };\n let currentSection = \"\"; // 'overlay', 'script', 'caption'\n\n for (const line of lines) {\n const trimmedLine = line.trim();\n\n // Skip empty lines unless they are part of a multi-line content (unlikely for this format)\n if (!trimmedLine && currentSection !== \"\") {\n // Allow empty lines within content if needed, but for strict format, they usually indicate a break\n // For this specific format, an empty line usually means end of a section if not followed by data\n continue;\n }\n\n if (trimmedLine.startsWith(\"Text Overlay:\")) {\n // If we've already collected data for a package, push it before starting a new one\n if (currentPackage.text_overlay_output || currentPackage.video_script_output || currentPackage.caption_text_output) {\n results.push({ json: { ...currentPackage } }); // Push a copy of the current package\n currentPackage = { // Reset for the new package\n text_overlay_output: \"\",\n video_script_output: \"\",\n caption_text_output: \"\"\n };\n }\n currentPackage.text_overlay_output = trimmedLine.substring(\"Text Overlay:\".length).trim();\n currentSection = \"overlay\";\n } else if (trimmedLine.startsWith(\"Video Script:\")) {\n currentPackage.video_script_output = trimmedLine.substring(\"Video Script:\".length).trim();\n currentSection = \"script\";\n } else if (trimmedLine.startsWith(\"Caption Text:\")) {\n currentPackage.caption_text_output = trimmedLine.substring(\"Caption Text:\".length).trim();\n currentSection = \"caption\";\n } else {\n // Append content to the current section if it's a continuation\n // Add a space or newline depending on desired handling of multi-line content.\n // Given the prompt's strict output, these are usually single lines.\n // Let's assume continuation means adding a space or newline.\n // For short-form content, it's safer to append with a space if it's not a new key.\n if (currentSection === \"video_script_output\") {\n currentPackage.video_script_output += (currentPackage.video_script_output ? \" \" : \"\") + trimmedLine;\n } else if (currentSection === \"caption_text_output\") {\n currentPackage.caption_text_output += (currentPackage.caption_text_output ? \"\\\\n\" : \"\") + trimmedLine; // Captions might have line breaks for hashtags etc.\n }\n // No need to append to text_overlay_output as it's typically a single, short line.\n }\n }\n\n // After the loop, push the last collected package\n if (currentPackage.text_overlay_output || currentPackage.video_script_output || currentPackage.caption_text_output) {\n // Final check for triple quotes in the last script\n if (currentPackage.video_script_output) {\n currentPackage.video_script_output = currentPackage.video_script_output.replace(/\\\"\\\"\\\"/g, \"'''\");\n }\n results.push({ json: { ...currentPackage } });\n }\n}\n\nreturn results;"
},
"typeVersion": 2
},
{
"id": "508e2c05-b2db-4b01-a131-98b10cfff657",
"name": "保存数据",
"type": "n8n-nodes-base.googleSheets",
"position": [
2120,
860
],
"parameters": {
"columns": {
"value": {
"Caption": "={{ $json.caption_text_output }}",
"Text Overlay": "={{ $json.text_overlay_output }}",
"Video Script": "={{ $json.video_script_output }}"
},
"schema": [
{
"id": "Text Overlay",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Text Overlay",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Video Script",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Video Script",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Caption",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Caption",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Approval",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Approval",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Published",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Published",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 285661820,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1elN8QyRUOSISUTfTNBCMRiVfS6NtW23Kh0ZS8y2P66o/edit#gid=285661820",
"cachedResultName": "Content Idea"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1PIb-YOYMKuVxFiGmpRgNvAMwVlG7nrG8gRiU2R1y6bk",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1PIb-YOYMKuVxFiGmpRgNvAMwVlG7nrG8gRiU2R1y6bk/edit?usp=drivesdk",
"cachedResultName": "Content "
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "NdBpgqV7UHdZ3CZc",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "4c4fb796-c957-4569-9666-a27e6a04207d",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
1100,
400
],
"parameters": {
"width": 1480,
"height": 680,
"content": "# 内容生成"
},
"typeVersion": 1
},
{
"id": "a19169e7-ded8-4053-9a25-3b10220ad1cf",
"name": "通知用户",
"type": "n8n-nodes-base.gmail",
"position": [
2120,
700
],
"webhookId": "b095003a-0562-42b5-8fe0-ac2e1b5e38e0",
"parameters": {
"sendTo": "example@domain.com",
"message": "10 new articles are added in the google sheets.",
"options": {},
"subject": "Content Generated"
},
"credentials": {
"gmailOAuth2": {
"id": "Fd6oTce3HQiRi3dG",
"name": "electrabot.info@gmail.com"
}
},
"typeVersion": 2.1
},
{
"id": "6a7b6154-e1be-4fb2-8e61-1f4c2d2bbaef",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
740,
400
],
"parameters": {
"width": 360,
"height": 680,
"content": "## 1. 资源"
},
"typeVersion": 1
},
{
"id": "5db8228f-3254-4ef0-8d42-32aa54aa2615",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1300,
460
],
"parameters": {
"color": 3,
"width": 180,
"height": 600,
"content": ""
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Merge": {
"main": [
[
{
"node": "Combine items",
"type": "main",
"index": 0
}
]
]
},
"About me": {
"main": [
[
{
"node": "Content Generation",
"type": "main",
"index": 0
}
]
]
},
"Save Data": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Extract Data": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Combine items": {
"main": [
[
{
"node": "About me",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[
{
"node": "Notify user",
"type": "main",
"index": 0
}
],
[
{
"node": "Save Data",
"type": "main",
"index": 0
}
]
]
},
"Organise Content": {
"main": [
[
{
"node": "Topic 2 (eg - AI Market Trends)",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Topic 1 (eg-AI News)",
"type": "main",
"index": 0
}
]
]
},
"Organise Content1": {
"main": [
[
{
"node": "Topic 3 (eg- AI Business Automation)",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Organise Content2": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 2
}
]
]
},
"Content Generation": {
"main": [
[
{
"node": "Extract Data",
"type": "main",
"index": 0
}
]
]
},
"Topic 1 (eg-AI News)": {
"main": [
[
{
"node": "Organise Content",
"type": "main",
"index": 0
}
]
]
},
"Topic 2 (eg - AI Market Trends)": {
"main": [
[
{
"node": "Organise Content1",
"type": "main",
"index": 0
}
]
]
},
"Topic 3 (eg- AI Business Automation)": {
"main": [
[
{
"node": "Organise Content2",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 内容创作, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
基于AI的潜在客户生成(Apollo、LinkedIn研究和4步个性化邮件)
基于AI的潜在客户生成:使用Apollo、LinkedIn研究和4步个性化邮件
If
Set
Code
+8
30 节点Gain FLow AI
潜在客户开发
基于 YouTube 视频的自主博客发布
使用 ChatGPT、Sheets、Apify、Pexels 和 WordPress 从 YouTube 视频自主发布博客
If
Set
Code
+18
80 节点Oriol Seguí
内容创作
批量SEO内容生成与带AI图片的Webflow草稿创建(模板)
使用GPT、Gemini图片和Webflow草稿创建进行批量SEO内容生成
If
Set
Code
+18
54 节点Dahiana
内容创作
使用GPT 5 Nano和Google Sheets的网站SEO常见问题生成器
使用GPT 5 Nano和Google Sheets的网站SEO常见问题生成器
Set
Xml
Code
+11
35 节点Oriol Seguí
内容创作
AI驱动视频创作与上传至Instagram、TikTok和YouTube
从云端硬盘进行AI驱动视频创作并上传至Instagram、TikTok和YouTube
If
Set
Code
+14
53 节点DevCode Journey
内容创作
使用Dumpling AI从YouTube视频自动生成平台特定帖子
使用GPT-4o和Dumpling AI从YouTube视频自动生成Instagram、Facebook和LinkedIn帖子
Set
Code
Merge
+6
20 节点Yang
内容创作
工作流信息
难度等级
高级
节点数量18
分类2
节点类型10
作者
Gain FLow AI
@gain-flowGainFlow AI is your go-to AI automation agency, specializing in Python and no-code solutions to eliminate repetitive tasks for individuals and businesses. Free up your time and boost efficiency. For inquiries, Fill this form - https://docs.google.com/forms/d/e/1FAIpQLSfIiXdw4HMcI2HM-Obng13j_RFiKv7X-mjOVm_mcy2ucRA8EA/viewform or reach out to us at info.gainflow@gmail.com.
外部链接
在 n8n.io 查看 →
分享此工作流