使用AI和Google Sheets跨平台生成并安排社交媒体内容
高级
这是一个Multimodal AI领域的自动化工作流,包含 16 个节点。主要使用 If, Set, Code, Cron, HttpRequest 等节点。 使用GPT-4和Buffer从Google Sheets生成并安排社交媒体内容
前置要求
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
- •OpenAI API Key
- •HTTP Webhook 端点(n8n 会自动生成)
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"name": "使用 AI 和 Google Sheets 跨平台生成并安排社交媒体内容",
"tags": [
{
"id": "social-media",
"name": "Social Media",
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-01T00:00:00.000Z"
},
{
"id": "ai-content",
"name": "AI Content",
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-01T00:00:00.000Z"
}
],
"nodes": [
{
"id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"name": "每日内容生成触发器",
"type": "n8n-nodes-base.cron",
"position": [
240,
300
],
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 9 * * *"
}
]
}
},
"typeVersion": 1
},
{
"id": "b2c3d4e5-f6g7-8901-2345-678901bcdefg",
"name": "工作流说明",
"type": "n8n-nodes-base.stickyNote",
"position": [
-200,
100
],
"parameters": {
"color": 4,
"width": 432,
"height": 464,
"content": "## 📱 AI 社交媒体内容自动化"
},
"typeVersion": 1
},
{
"id": "c3d4e5f6-g7h8-9012-3456-789012cdefgh",
"name": "配置变量",
"type": "n8n-nodes-base.set",
"position": [
480,
300
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "GOOGLE_SHEET_ID",
"name": "GOOGLE_SHEET_ID",
"type": "string",
"value": "your-sheet-id-here"
},
{
"id": "CONTENT_WORKSHEET",
"name": "CONTENT_WORKSHEET",
"type": "string",
"value": "Content Calendar"
},
{
"id": "BRAND_VOICE",
"name": "BRAND_VOICE",
"type": "string",
"value": "professional, engaging, and informative"
},
{
"id": "COMPANY_NAME",
"name": "COMPANY_NAME",
"type": "string",
"value": "Your Company"
},
{
"id": "TARGET_AUDIENCE",
"name": "TARGET_AUDIENCE",
"type": "string",
"value": "marketing professionals and business owners"
}
]
}
},
"typeVersion": 3.2
},
{
"id": "d4e5f6g7-h8i9-0123-4567-890123defghi",
"name": "读取日历说明",
"type": "n8n-nodes-base.stickyNote",
"position": [
640,
120
],
"parameters": {
"width": 280,
"height": 180,
"content": "📊 **步骤 1:读取内容日历**"
},
"typeVersion": 1
},
{
"id": "e5f6g7h8-i9j0-1234-5678-901234efghij",
"name": "读取内容日历",
"type": "n8n-nodes-base.googleSheets",
"position": [
720,
300
],
"parameters": {
"options": {
"range": "A:G"
},
"sheetName": {
"__rl": true,
"mode": "name",
"value": "={{ $('Configuration Variables').first().json.CONTENT_WORKSHEET }}"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Configuration Variables').first().json.GOOGLE_SHEET_ID }}"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "YOUR_GOOGLE_SHEETS_CREDENTIAL_ID",
"name": "Google Sheets OAuth2"
}
},
"typeVersion": 4.4
},
{
"id": "f6g7h8i9-j0k1-2345-6789-012345fghijk",
"name": "过滤内容说明",
"type": "n8n-nodes-base.stickyNote",
"position": [
880,
120
],
"parameters": {
"width": 280,
"height": 160,
"content": "🎯 **步骤 2:过滤今日内容**"
},
"typeVersion": 1
},
{
"id": "g7h8i9j0-k1l2-3456-7890-123456ghijkl",
"name": "过滤今日内容",
"type": "n8n-nodes-base.code",
"position": [
960,
300
],
"parameters": {
"jsCode": "// Filter content calendar for today's posts\nconst today = new Date().toISOString().split('T')[0];\nconst calendarData = $input.all();\n\n// Skip header row and filter for today's content\nconst todaysContent = calendarData.slice(1).filter(row => {\n const rowData = row.json;\n \n if (!rowData.Date || !rowData.Topic) return false;\n \n let postDate;\n if (rowData.Date.includes('/')) {\n const [month, day, year] = rowData.Date.split('/');\n postDate = `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`;\n } else {\n postDate = rowData.Date;\n }\n \n return postDate === today && \n rowData.Status !== 'Completed' && \n rowData.Status !== 'Posted' &&\n rowData.Topic.trim() !== '';\n});\n\nif (todaysContent.length === 0) {\n return [{\n json: {\n message: \"No content scheduled for today\",\n date: today,\n hasContent: false\n }\n }];\n}\n\n// Process each content item\nreturn todaysContent.map((item, index) => {\n const rowData = item.json;\n \n return {\n json: {\n rowIndex: index + 2,\n topic: rowData.Topic || '',\n platforms: rowData.Platforms || 'Twitter,LinkedIn',\n contentType: rowData['Content Type'] || 'Educational',\n keywords: rowData.Keywords || '',\n date: today,\n hasContent: true,\n brandVoice: $('Configuration Variables').first().json.BRAND_VOICE,\n companyName: $('Configuration Variables').first().json.COMPANY_NAME,\n targetAudience: $('Configuration Variables').first().json.TARGET_AUDIENCE\n }\n };\n});"
},
"typeVersion": 2
},
{
"id": "h8i9j0k1-l2m3-4567-8901-234567hijklm",
"name": "检查内容是否存在",
"type": "n8n-nodes-base.if",
"position": [
1200,
300
],
"parameters": {
"options": {},
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "has_content",
"operator": {
"type": "boolean",
"operation": "equal"
},
"leftValue": "={{ $json.hasContent }}",
"rightValue": true
}
]
}
},
"typeVersion": 2
},
{
"id": "i9j0k1l2-m3n4-5678-9012-345678ijklmn",
"name": "AI 内容说明",
"type": "n8n-nodes-base.stickyNote",
"position": [
1360,
120
],
"parameters": {
"width": 280,
"height": 180,
"content": "🤖 **步骤 3:生成 AI 内容**"
},
"typeVersion": 1
},
{
"id": "j0k1l2m3-n4o5-6789-0123-456789jklmno",
"name": "使用 AI 生成社交媒体内容",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1440,
260
],
"parameters": {
"options": {
"maxTokens": 1000,
"temperature": 0.7
},
"resource": "chat",
"chatInput": {
"messages": {
"values": [
{
"role": "system",
"content": "You are an expert social media content creator. Generate platform-specific content that drives engagement.\n\nFor each platform:\n\n**TWITTER:**\n- Max 280 characters\n- Include 2-3 hashtags\n- Engaging hooks\n- Strategic emojis\n\n**LINKEDIN:**\n- Professional tone, 1000-1300 characters\n- Industry insights\n- 3-5 hashtags\n- Call-to-action\n\n**INSTAGRAM:**\n- Visual-first, up to 2200 characters\n- Storytelling format\n- 5-10 hashtags\n- Questions for engagement\n\nReturn JSON:\n{\n \"twitter\": {\n \"text\": \"content\",\n \"hashtags\": [\"tag1\", \"tag2\"],\n \"character_count\": number\n },\n \"linkedin\": {\n \"text\": \"content\",\n \"hashtags\": [\"tag1\", \"tag2\"],\n \"character_count\": number\n },\n \"instagram\": {\n \"text\": \"content\",\n \"hashtags\": [\"tag1\", \"tag2\"],\n \"character_count\": number\n }\n}"
},
{
"role": "user",
"content": "Create social media content for:\n\n**Topic:** {{ $json.topic }}\n**Content Type:** {{ $json.contentType }}\n**Brand Voice:** {{ $json.brandVoice }}\n**Company:** {{ $json.companyName }}\n**Target Audience:** {{ $json.targetAudience }}\n**Keywords:** {{ $json.keywords }}\n**Platforms:** {{ $json.platforms }}"
}
]
}
},
"operation": "create"
},
"credentials": {
"openAiApi": {
"id": "YOUR_OPENAI_CREDENTIAL_ID",
"name": "OpenAI API"
}
},
"typeVersion": 1.3
},
{
"id": "k1l2m3n4-o5p6-7890-1234-567890klmnop",
"name": "处理与安排说明",
"type": "n8n-nodes-base.stickyNote",
"position": [
1600,
120
],
"parameters": {
"width": 280,
"height": 160,
"content": "✅ **步骤 4:处理与安排**"
},
"typeVersion": 1
},
{
"id": "l2m3n4o5-p6q7-8901-2345-678901lmnopq",
"name": "处理生成的内容",
"type": "n8n-nodes-base.code",
"position": [
1680,
260
],
"parameters": {
"jsCode": "// Process AI content and prepare for scheduling\nconst contentInput = $('Generate Social Content with AI').first();\nconst originalData = $('Filter Today\\'s Content').first();\n\nlet socialContent;\ntry {\n const aiResponse = contentInput.json.choices[0].message.content;\n socialContent = JSON.parse(aiResponse);\n} catch (error) {\n // Fallback content\n socialContent = {\n twitter: {\n text: `Sharing insights about ${originalData.json.topic}! 🚀`,\n hashtags: [\"business\", \"insights\"],\n character_count: 80\n },\n linkedin: {\n text: `Today let's explore ${originalData.json.topic}. What are your thoughts?`,\n hashtags: [\"business\", \"leadership\"],\n character_count: 120\n },\n instagram: {\n text: `✨ ${originalData.json.topic} ✨\\n\\nWhat's your experience? Share below! 👇`,\n hashtags: [\"business\", \"motivation\"],\n character_count: 100\n }\n };\n}\n\n// Process platforms\nconst requestedPlatforms = originalData.json.platforms.toLowerCase().split(',').map(p => p.trim());\nconst results = [];\n\nrequerestedPlatforms.forEach(platform => {\n const platformKey = platform === 'twitter' ? 'twitter' : \n platform === 'linkedin' ? 'linkedin' : \n platform === 'instagram' ? 'instagram' : null;\n \n if (platformKey && socialContent[platformKey]) {\n results.push({\n json: {\n platform: platform,\n content: socialContent[platformKey].text,\n hashtags: socialContent[platformKey].hashtags || [],\n topic: originalData.json.topic,\n row_index: originalData.json.rowIndex,\n date: originalData.json.date,\n scheduled_time: new Date().toISOString()\n }\n });\n }\n});\n\nreturn results.length > 0 ? results : [{\n json: {\n error: \"No valid platforms found\",\n topic: originalData.json.topic\n }\n}];"
},
"typeVersion": 2
},
{
"id": "m3n4o5p6-q7r8-9012-3456-789012mnopqr",
"name": "通过 Buffer 安排帖子",
"type": "n8n-nodes-base.httpRequest",
"position": [
1920,
260
],
"parameters": {
"url": "https://api.bufferapp.com/1/updates/create.json",
"method": "POST",
"sendBody": true,
"contentType": "form-urlencoded",
"sendHeaders": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "text",
"value": "={{ $json.content }}"
},
{
"name": "profile_ids[]",
"value": "YOUR_PROFILE_ID_HERE"
},
{
"name": "now",
"value": "false"
}
]
},
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/x-www-form-urlencoded"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "YOUR_BUFFER_CREDENTIAL_ID",
"name": "Buffer API"
}
},
"typeVersion": 4.2
},
{
"id": "n4o5p6q7-r8s9-0123-4567-890123nopqrs",
"name": "更新表格状态",
"type": "n8n-nodes-base.googleSheets",
"position": [
2160,
260
],
"parameters": {
"fieldsUi": {
"values": [
{
"column": "F",
"fieldValue": "Scheduled"
},
{
"column": "G",
"fieldValue": "{{ $json.content.substring(0, 100) }}..."
}
]
},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "name",
"value": "={{ $('Configuration Variables').first().json.CONTENT_WORKSHEET }}"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Configuration Variables').first().json.GOOGLE_SHEET_ID }}"
},
"valueToMatchOn": "={{ $json.date }}",
"columnToMatchOn": "A"
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "YOUR_GOOGLE_SHEETS_CREDENTIAL_ID",
"name": "Google Sheets OAuth2"
}
},
"typeVersion": 4.4
},
{
"id": "o5p6q7r8-s9t0-1234-5678-901234opqrst",
"name": "设置说明",
"type": "n8n-nodes-base.stickyNote",
"position": [
240,
500
],
"parameters": {
"color": 6,
"width": 400,
"height": 320,
"content": "⚙️ **需要配置**"
},
"typeVersion": 1
},
{
"id": "p6q7r8s9-t0u1-2345-6789-012345pqrstu",
"name": "无内容响应",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
1200,
420
],
"parameters": {
"options": {},
"respondWith": "json",
"responseBody": "{\n \"status\": \"no_content\",\n \"message\": \"No content scheduled for today\",\n \"date\": \"{{ $json.date }}\"\n}"
},
"typeVersion": 1
}
],
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"updatedAt": "2025-01-01T00:00:00.000Z",
"versionId": "auto-generate",
"staticData": {},
"connections": {
"Read Content Calendar": {
"main": [
[
{
"node": "Filter Today's Content",
"type": "main",
"index": 0
}
]
]
},
"Filter Today's Content": {
"main": [
[
{
"node": "Check if Content Exists",
"type": "main",
"index": 0
}
]
]
},
"Check if Content Exists": {
"main": [
[
{
"node": "Generate Social Content with AI",
"type": "main",
"index": 0
}
],
[
{
"node": "No Content Response",
"type": "main",
"index": 0
}
]
]
},
"Configuration Variables": {
"main": [
[
{
"node": "Read Content Calendar",
"type": "main",
"index": 0
}
]
]
},
"Schedule Post via Buffer": {
"main": [
[
{
"node": "Update Sheet Status",
"type": "main",
"index": 0
}
]
]
},
"Process Generated Content": {
"main": [
[
{
"node": "Schedule Post via Buffer",
"type": "main",
"index": 0
}
]
]
},
"Generate Social Content with AI": {
"main": [
[
{
"node": "Process Generated Content",
"type": "main",
"index": 0
}
]
]
},
"Daily Content Generation Trigger": {
"main": [
[
{
"node": "Configuration Variables",
"type": "main",
"index": 0
}
]
]
}
},
"triggerCount": 1
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用GPT-4分析和Slack警报对Zendesk工单进行优先级排序
使用GPT-4分析和Slack警报对Zendesk工单进行优先级排序
If
Set
Code
+6
18 节点PhilanthropEAK Automation
AI 摘要总结
使用 GPT-4o Vision 和 Claude 3.5 + 销售分析生成 Shopify 产品描述
使用 GPT-4o Vision 和 Claude 3.5 + 销售分析生成 Shopify 产品描述
If
Set
Code
+17
43 节点Kumar Shivam
内容创作
AI驱动视频创作与上传至Instagram、TikTok和YouTube
从云端硬盘进行AI驱动视频创作并上传至Instagram、TikTok和YouTube
If
Set
Code
+14
53 节点DevCode Journey
内容创作
基于AI的潜在客户生成(Apollo、LinkedIn研究和4步个性化邮件)
基于AI的潜在客户生成:使用Apollo、LinkedIn研究和4步个性化邮件
If
Set
Code
+8
30 节点Gain FLow AI
潜在客户开发
竞争对手内容差距分析器:自动化网站主题映射
使用Gemini AI、Apify和Google Sheets分析竞争对手内容差距
If
Set
Code
+10
30 节点Mychel Garzon
杂项
使用OpenAI gpt-image-1和AI字幕创建并发布Instagram轮播图
从Google Sheets使用GPT-Image-1和AI字幕自动生成Instagram轮播图
If
Set
Code
+12
32 节点Jorge Martínez
多模态 AI
工作流信息
难度等级
高级
节点数量16
分类1
节点类型9
作者
PhilanthropEAK Automation
@philanthropeakAI-powered automation specialist building practical, accessible workflows for businesses of all sizes. We design solutions that save time, cut errors, and boost customer experience—without complexity. Specialties include AI-driven customer support, social media scheduling, e-commerce automation, beginner-friendly workflows, and free templates. Every workflow is tested, documented, and ready to deliver real business value.
外部链接
在 n8n.io 查看 →
分享此工作流