LinkedIn带图帖子
高级
这是一个Social Media、Multimodal AI领域的自动化工作流,包含 17 个节点。主要使用 If、Code、Limit、GoogleDrive、HttpRequest 等节点。 使用Gemini AI自动生成LinkedIn内容:帖子和图片24/7
前置要求
- •Google Drive API 凭证
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
- •Google Gemini API Key
使用的节点 (17 个)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "gzBmk756EHzLlf9X",
"meta": {
"instanceId": "aa8f1cf0c4d8087e25a2eea962da249799481d2fb992314793977a97a5e71d77"
},
"name": "LinkedIn 带图帖子",
"tags": [],
"nodes": [
{
"id": "b8d099c6-f87c-46e7-97fb-892b54e9edc7",
"name": "Google Sheets 触发器",
"type": "n8n-nodes-base.googleSheetsTrigger",
"position": [
-704,
-400
],
"parameters": {
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 538465532,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM/edit#gid=538465532",
"cachedResultName": "Posts"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM/edit?usp=drivesdk",
"cachedResultName": "Linkedin Post"
}
},
"credentials": {
"googleSheetsTriggerOAuth2Api": {
"id": "7m0VyTZyXp0touOK",
"name": "Google Sheets Trigger account"
}
},
"typeVersion": 1
},
{
"id": "606cb9e6-b1c1-4315-b07b-9996c1547eeb",
"name": "如果",
"type": "n8n-nodes-base.if",
"position": [
-512,
-400
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "bc74b0c2-aa46-4bcd-91f3-1eb6b0720167",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.Status }}",
"rightValue": "pending"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "11ac155f-8ae3-44bc-9105-5ef28ca33efa",
"name": "限制",
"type": "n8n-nodes-base.limit",
"position": [
-272,
-416
],
"parameters": {},
"typeVersion": 1
},
{
"id": "70e4bd3a-68a0-4edd-8547-57c09789e4f2",
"name": "AI 代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-736,
-208
],
"parameters": {
"text": "=You are a LinkedIn post writer. You will be given a title and your task is to create an engaging LinkedIn post based on that title.\n\nYour post should:\n1. Begin with a compelling hook related to the title\n2. Include 3-4 paragraphs of informative content\n3. End with a question to encourage engagement\n4. Include 4-6 relevant hashtags\n5. Use appropiate emojis in between \n\nImportant formatting requirements:\n- Format all paragraphs with proper newline characters (\\n\\n) between them\n- Ensure the text is properly escaped for JSON\n- Do not use double quote (\"\") in response or any special character\n- Do not put asterisk\n- Keep the overall length appropriate for LinkedIn (under 3000 characters)\n\n\nNow, create a LinkedIn post based on the following title:\n{{ $json['LinkedIn Post Title'] }}\n\nRespond only with a JSON object in exactly this format:\n{\n \"title\": \"{{ $json['LinkedIn Post Title'] }}\",\n \"post\": \"<your LinkedIn post here>\"\n}",
"options": {},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.8
},
{
"id": "6de95faa-7591-4653-aec0-7909e34d8a46",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
-384,
-208
],
"parameters": {
"jsCode": "const items = $input.all();\nconst updatedItems = items.map((item) => {\n if (\n item.json &&\n item.json.output &&\n typeof item.json.output.post === \"string\"\n ) {\n item.json.output.post = item.json.output.post.replace(/\\n/g, \"\\\\n\");\n }\n return item;\n});\nreturn updatedItems;"
},
"typeVersion": 2
},
{
"id": "0e95749d-da5f-4b66-807c-5816527e89cf",
"name": "HTTP 请求",
"type": "n8n-nodes-base.httpRequest",
"position": [
-736,
240
],
"parameters": {
"url": "https://api.linkedin.com/v2/userinfo",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "gZliUVRX7RzQu1EP",
"name": "Linkedin Header"
}
},
"typeVersion": 4.2
},
{
"id": "79a6ea34-41f8-4de9-a073-6664d22b266d",
"name": "注册图像上传",
"type": "n8n-nodes-base.httpRequest",
"position": [
-592,
240
],
"parameters": {
"url": "https://api.linkedin.com/v2/assets?action=registerUpload",
"method": "POST",
"options": {},
"jsonBody": "={\n \"registerUploadRequest\": {\n \"recipes\": [\n \"urn:li:digitalmediaRecipe:feedshare-image\"\n ],\n \"owner\": \"urn:li:person:{{ $('HTTP Request').item.json.sub }}\",\n \"serviceRelationships\": [\n {\n \"relationshipType\": \"OWNER\",\n \"identifier\": \"urn:li:userGeneratedContent\"\n }\n ]\n }\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "gZliUVRX7RzQu1EP",
"name": "Linkedin Header"
}
},
"typeVersion": 4.2
},
{
"id": "fcffdaff-a992-4018-abb4-c05343e61ca2",
"name": "上传图像到 LinkedIn",
"type": "n8n-nodes-base.httpRequest",
"position": [
-304,
240
],
"parameters": {
"url": "={{$node[\"Register Image Upload\"].json.value.uploadMechanism[\"com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest\"].uploadUrl}}\n",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "binaryData",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "={{$binary.data.mimeType || 'image/png'}}"
}
]
},
"inputDataFieldName": "data"
},
"typeVersion": 4.2
},
{
"id": "6210d17b-8233-4c13-bdcf-eb3301610b06",
"name": "HTTP 请求2",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
-160,
240
],
"parameters": {
"url": "https://api.linkedin.com/v2/ugcPosts",
"method": "POST",
"options": {},
"jsonBody": "={\n \"author\": \"urn:li:person:{{ $('HTTP Request').item.json.sub }}\",\n \"lifecycleState\": \"PUBLISHED\",\n \"specificContent\": {\n \"com.linkedin.ugc.ShareContent\": {\n \"shareCommentary\": {\n \"text\": \"{{ $('Code').item.json.output.post }}\"\n },\n \"shareMediaCategory\": \"IMAGE\",\n \"media\": [\n {\n \"status\": \"READY\",\n \"description\": {\n \"text\": \"{{ $('AI Agent').item.json.output.title }}\"\n },\n \"media\": \"{{ $('Register Image Upload').item.json.value.asset }}\",\n \"title\": {\n \"text\": \"{{ $('AI Agent').item.json.output.title }}\"\n }\n }\n ]\n }\n },\n \"visibility\": {\n \"com.linkedin.ugc.MemberNetworkVisibility\": \"PUBLIC\"\n }\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "gZliUVRX7RzQu1EP",
"name": "Linkedin Header"
}
},
"typeVersion": 4.2
},
{
"id": "24897dbd-72cf-4027-bbd4-afd62788435d",
"name": "结构化输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
-592,
0
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"post\": { \"type\": \"string\" }\n },\n \"required\": [\"title\",\"post\"],\n \"additionalProperties\": false\n}\n"
},
"typeVersion": 1.3
},
{
"id": "9b4c0624-c6fa-4af6-a087-cd191e088e47",
"name": "在表格中更新行",
"type": "n8n-nodes-base.googleSheets",
"position": [
-16,
240
],
"parameters": {
"columns": {
"value": {
"ID": "={{ $('Limit').item.json.ID }}",
"Status": "posted"
},
"schema": [
{
"id": "ID",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "ID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Linkedin Post Title",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Linkedin Post Title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Status",
"type": "string",
"display": true,
"required": false,
"displayName": "Status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "string",
"display": true,
"removed": true,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"ID"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 538465532,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WhpYF60_oOtWxDlBAEgF5p_eefPrOR1hXLM/edit#gid=538465532",
"cachedResultName": "Posts"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM/edit?usp=drivesdk",
"cachedResultName": "Linkedin Post"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "bAnK8T185A3Wr7Kj",
"name": "Google Sheets account"
}
},
"retryOnFail": false,
"typeVersion": 4.5,
"alwaysOutputData": false
},
{
"id": "b4c6f44c-b13d-4418-b768-8fdd27eef946",
"name": "Google Gemini 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-736,
0
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"id": "gfe4ixwgGvXB6ixs",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "e1ddbeca-41e4-4a65-b2dc-90656b431a28",
"name": "使用 Gemini 生成图像",
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"position": [
-192,
-208
],
"parameters": {
"prompt": "=Create a high-quality, visually engaging image for a social media post based on the following text:\n\n\"{{ $json.output.post }}\"\n\nThe image should:\n• Depict a modern workspace with a person actively coding on a sleek MacBook laptop.\n• Surround the scene with Flutter development elements: Flutter logo-inspired shapes, Dart language motifs, mobile app UI mockups, performance graphs, and cross-platform design cues.\n• Show a bright, tech-focused environment with clean lighting and soft depth-of-field, suggesting focus and productivity.\n• Include subtle mobile development visuals such as smartphones, tablets, or floating app interface elements near the screen.\n• Use a professional, modern design aesthetic suitable for LinkedIn and Twitter audiences.\n• Apply a vibrant color palette with blues, whites, and gradients, inspired by Flutter’s branding, without using any copyrighted brand images.\n• Maintain a 16:9 aspect ratio, high resolution, and balanced composition.\n• **Do not include any text, captions, or lettering in the image under any circumstances.**\n",
"modelId": {
"__rl": true,
"mode": "list",
"value": "models/gemini-2.0-flash-exp-image-generation",
"cachedResultName": "models/gemini-2.0-flash-exp-image-generation"
},
"options": {},
"resource": "image"
},
"credentials": {
"googlePalmApi": {
"id": "gfe4ixwgGvXB6ixs",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "8a112d48-05e0-4923-bc99-69b97ab6321b",
"name": "上传文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
-432,
32
],
"parameters": {
"name": "=linkedin_{{$now.format('YYYYMMDD_HHmmss')}}.{{$binary.data.fileExtension || 'png'}}\n",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive",
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
"cachedResultName": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "19Q1PPe07QoE6hNXakiQ2nNU66MH85w5f",
"cachedResultUrl": "https://drive.google.com/drive/folders/19Q1PPe07QoE6hNXakiQ2nNU66MH85w5f",
"cachedResultName": "linkedin images"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "1Bnhm02w1dxE4FO6",
"name": "Farooq Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "90d858e6-91d9-4f85-a0f0-2b489ee277bf",
"name": "共享文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
-288,
32
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {},
"operation": "share",
"permissionsUi": {
"permissionsValues": {
"role": "reader",
"type": "anyone"
}
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "1Bnhm02w1dxE4FO6",
"name": "Farooq Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "fc8dcc39-9d98-4806-931a-9ba50c23133a",
"name": "在 sheet1 中更新行",
"type": "n8n-nodes-base.googleSheets",
"position": [
-144,
32
],
"parameters": {
"columns": {
"value": {
"ID": "={{ $('If').item.json.ID }}",
"imageUrl": "={{$node[\"Upload file\"].json.webViewLink}}"
},
"schema": [
{
"id": "ID",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "ID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "LinkedIn Post Title",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "LinkedIn Post Title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Status",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "imageUrl",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "imageUrl",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": true,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"ID"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 538465532,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM/edit#gid=538465532",
"cachedResultName": "Posts"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM/edit?usp=drivesdk",
"cachedResultName": "Linkedin Post"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "bAnK8T185A3Wr7Kj",
"name": "Google Sheets account"
}
},
"typeVersion": 4.7
},
{
"id": "89176dcd-2000-44ce-8b89-b4abb30b7479",
"name": "下载文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
-448,
240
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "url",
"value": "={{ $('Update row in sheet1').item.json.imageUrl }}"
},
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "1Bnhm02w1dxE4FO6",
"name": "Farooq Google Drive account"
}
},
"typeVersion": 3
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "7357510d-3512-4579-b966-9179eac8d63e",
"connections": {
"If": {
"main": [
[
{
"node": "Limit",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Generate Image with Gemini",
"type": "main",
"index": 0
}
]
]
},
"Limit": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Share file": {
"main": [
[
{
"node": "Update row in sheet1",
"type": "main",
"index": 0
}
]
]
},
"Upload file": {
"main": [
[
{
"node": "Share file",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Register Image Upload",
"type": "main",
"index": 0
}
]
]
},
"Download file": {
"main": [
[
{
"node": "Upload Image to LinkedIn",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request2": {
"main": [
[
{
"node": "Update row in sheet",
"type": "main",
"index": 0
}
]
]
},
"Update row in sheet1": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"Google Sheets Trigger": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Register Image Upload": {
"main": [
[
{
"node": "Download file",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Upload Image to LinkedIn": {
"main": [
[
{
"node": "HTTP Request2",
"type": "main",
"index": 0
}
]
]
},
"Generate Image with Gemini": {
"main": [
[
{
"node": "Upload file",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个高级难度的工作流,适用于Social Media、Multimodal AI等场景。适合高级用户,包含 16+ 个节点的复杂工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
壁纸
使用 Gemini 2.0、Google Sheets 和 Drive 从文本提示生成 AI 图像
If
Code
Limit
+7
12 节点Muhammad Farooq Iqbal
Content Creation
使用Gemini AI创建情感故事:生成图片和Veo3 JSON提示
使用Gemini AI创建情感故事:生成图片和Veo3 JSON提示
If
Set
Code
+12
35 节点Muhammad Farooq Iqbal
Content Creation
我的工作流9_旧版
使用MagicHour和Gemini从Google Sheets每日创建YouTube视频
If
Set
Code
+13
31 节点Divyansh Chauhan
Content Creation
使用Claude、OpenAI和Perplexity自动生成和安排品牌LinkedIn内容
使用Claude、OpenAI和Perplexity自动生成和安排品牌LinkedIn内容
Code
Limit
Linked In
+10
23 节点Abdul Mir
Social Media
使用Gemini AI从PDF提取发票数据到Google Sheets 📄
使用Gemini AI从PDF提取发票数据到Google Sheets 📄
Code
Gmail
Limit
+11
28 节点Louis
Content Creation
使用Google Gemini和Google Sheets的Shopify产品AI博客生成器
使用Google Gemini和Google Sheets的Shopify产品AI博客生成器
If
Code
Limit
+9
22 节点MANISH KUMAR
Miscellaneous