AI Social Media Publisher from WordPress
工作流概述
这是一个包含20个节点的复杂工作流,主要用于自动化处理各种任务。
工作流源代码
{
"id": "U9RofpXSIIUg12f9",
"meta": {
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
"templateCredsSetupCompleted": true
},
"name": "AI Social Media Publisher from WordPress",
"tags": [
{
"id": "2VG6RbmUdJ2VZbrj",
"name": "Google Drive",
"createdAt": "2024-12-04T16:50:56.177Z",
"updatedAt": "2024-12-04T16:50:56.177Z"
},
{
"id": "EtObDwELrdVvzOcI",
"name": "OpenRouter",
"createdAt": "2024-12-04T16:53:26.886Z",
"updatedAt": "2024-12-04T16:53:26.886Z"
},
{
"id": "OVXRgoTzbRrrYmBB",
"name": "X",
"createdAt": "2025-02-24T15:47:38.855Z",
"updatedAt": "2025-02-24T15:47:38.855Z"
},
{
"id": "PLbmcn8OyqnoHrYE",
"name": "Instagram",
"createdAt": "2025-02-24T15:47:48.325Z",
"updatedAt": "2025-02-24T15:47:48.325Z"
},
{
"id": "QsjuqQbwRJaxuGB4",
"name": "Facebook",
"createdAt": "2025-02-24T15:47:42.574Z",
"updatedAt": "2025-02-24T15:47:42.574Z"
},
{
"id": "oK8zaSe2Q5RG7qNe",
"name": "Linkedin",
"createdAt": "2025-02-24T15:47:45.129Z",
"updatedAt": "2025-02-24T15:47:45.129Z"
},
{
"id": "paTcf5QZDJsC2vKY",
"name": "OpenAI",
"createdAt": "2024-12-04T16:52:10.768Z",
"updatedAt": "2024-12-04T16:52:10.768Z"
}
],
"nodes": [
{
"id": "f5bb7898-44eb-45bf-b199-2146c8e901f6",
"name": "When clicking ‘Test workflow’",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-220,
-80
],
"parameters": {},
"typeVersion": 1
},
{
"id": "b1977304-fbbf-4bb5-924a-e5db036bca91",
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
0,
-80
],
"parameters": {
"options": {
"returnFirstMatch": true
},
"filtersUI": {
"values": [
{
"lookupColumn": "TWITTER"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U/edit#gid=0",
"cachedResultName": "Foglio1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U/edit?usp=drivesdk",
"cachedResultName": "Social Media post"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "JYR6a64Qecd6t8Hb",
"name": "Google Sheets account"
}
},
"typeVersion": 4.5
},
{
"id": "1451692d-8e8d-4da7-be3e-b4dd20319c7a",
"name": "OpenRouter Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
400,
140
],
"parameters": {
"model": "google/gemini-2.0-flash-exp:free",
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "pb06rfB4xmxzVe3Q",
"name": "OpenRouter"
}
},
"typeVersion": 1
},
{
"id": "6768f867-666d-4c41-b77a-1bfb389b0329",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
620,
140
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{
\"type\": \"object\",
\"properties\": {
\"twitter\": {
\"type\": \"string\"
},
\"facebook\": {
\"type\": \"string\"
},
\"linkedin\": {
\"type\": \"string\"
},
\"instagram\": {
\"type\": \"string\"
}
}
}"
},
"typeVersion": 1.2
},
{
"id": "05cf81ec-bb25-447a-9c54-183132b8804c",
"name": "Image Instagram",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
940,
280
],
"parameters": {
"prompt": "={{ $json.output.instagram }}",
"options": {
"size": "1024x1024",
"returnImageUrls": true
},
"resource": "image"
},
"credentials": {
"openAiApi": {
"id": "CDX6QM4gLYanh0P4",
"name": "OpenAi account"
}
},
"typeVersion": 1.8
},
{
"id": "2ae8be2c-28a3-4f55-aee3-2fff3517b149",
"name": "Image Facebook e Linkedin",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
940,
-140
],
"parameters": {
"prompt": "={{ $json.output.facebook }}",
"options": {
"size": "1792x1024",
"returnImageUrls": false
},
"resource": "image"
},
"credentials": {
"openAiApi": {
"id": "CDX6QM4gLYanh0P4",
"name": "OpenAi account"
}
},
"typeVersion": 1.8
},
{
"id": "583a8459-3574-44e6-85bf-a33b9a4bf9f4",
"name": "Social Media Manager",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
440,
-80
],
"parameters": {
"text": "=Generate social content from the following text with title \"{{ $json.title.rendered }}\" (in the same language):
'''
{{ $json.content.rendered }}
'''",
"messages": {
"messageValues": [
{
"message": "=Your goal is to create engaging and informative content for LinkedIn, Instagram, Facebook, Twitter (X) while ensuring each post aligns with the platform’s audience, tone, and style. Content should reflect the company’s expertise, providing value-driven insights, tutorials, reviews, and discussions that resonate with tech professionals, enthusiasts, and businesses.
Each post should be optimized for engagement, using platform-specific hashtags to improve reach and SEO. Maintain a professional yet approachable tone that promotes trust and authority in the tech space.
Content Creation Best Practices:
Post Optimization: Adapt content format, style, and hashtags based on each social media platform’s algorithm and audience engagement patterns.
SEO & Hashtags: Use a balanced mix of general hashtags and platform-specific trending hashtags to maximize reach.
Engagement-driven content: Focus on tech tutorials, IT industry updates, comparisons, reviews, and in-depth discussions that spark engagement.
Consistency: Maintain a consistent tone and visual identity across all platforms, while tailoring content to each audience.
Data-driven trends: Regularly analyze post performance and adjust your hashtag strategy to reflect trending discussions within your topic. High-quality, relevant, and engaging copy that appeals to professionals, businesses, and enthusiasts of your topic must be provided.
### Platform-specific requirements:
1. **LinkedIn**:
- Style: Professional and informative.
- Tone: Focus on business results, employee gratitude, and community impact.
- Content length: 3-4 sentences, detailed and insightful.
- Hashtags: Create hashtags that are compatible with your topic.
- Call to action: Engage businesses and professionals by encouraging comments or visits to Al Ansari's website.
2. **Instagram**:
- Style: Visual storytelling.
- Tone: Inspiring and engaging.
- Content length: 2-3 sentences, paired with creative captions and emojis.
- Images: Highlight events, giveaways, and milestones (e.g., 50th anniversary keychains, eco-friendly tote bags).
- Call to action: Use phrases like “Swipe to see more,” “Tag your coworkers,” or “Celebrate with us!”
- Hashtags: Create hashtags that resonate with your topic
3. **Facebook**:
- Style: Friendly and relevant.
- Tone: Community-focused, sharing employee stories, accomplishments, or event updates.
- Content length: 2-3 sentences, slightly informal but still reflective of your company’s values.
- Call to Action: Encourage likes, shares, and comments from connected families and communities
4. **Twitter (X)**:
- Style: Concise and impactful.
- Tone: Crisp, engaging, and catchy.
- Content Length: 150 characters or less, including hashtags.
- Create hashtags that are compatible with the topic being discussed
- Call to Action: Focus on rapid engagement through retweets, likes, and replies.
With this guide, generate posts for all platforms for the inputs below by inserting them into the specified json structure;"
}
]
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.5
},
{
"id": "634af127-cd08-4beb-99a8-daa626793736",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-60,
-160
],
"parameters": {
"width": 420,
"height": 260,
"content": "Get the Post ID of the Wordpress article on which you want to generate the caption for social media"
},
"typeVersion": 1
},
{
"id": "dbdb39dc-02b2-4fe6-8b70-f38b86c9d9e3",
"name": "Linkedin OK",
"type": "n8n-nodes-base.googleSheets",
"position": [
1480,
-260
],
"parameters": {
"columns": {
"value": {
"LINKEDIN": "x",
"row_number": "={{ $('Google Sheets').item.json.row_number }}"
},
"schema": [
{
"id": "POST ID",
"type": "string",
"display": true,
"required": false,
"displayName": "POST ID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "TESTO",
"type": "string",
"display": true,
"required": false,
"displayName": "TESTO",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "TWITTER",
"type": "string",
"display": true,
"required": false,
"displayName": "TWITTER",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "FACEBOOK",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "FACEBOOK",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "INSTAGRAM",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "INSTAGRAM",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "LINKEDIN",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "LINKEDIN",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "string",
"display": true,
"removed": false,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"row_number"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U/edit#gid=0",
"cachedResultName": "Foglio1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U/edit?usp=drivesdk",
"cachedResultName": "Social Media post"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "JYR6a64Qecd6t8Hb",
"name": "Google Sheets account"
}
},
"typeVersion": 4.5
},
{
"id": "07aba718-fb10-48d4-bedb-0c19315acfe1",
"name": "Facebook Ok",
"type": "n8n-nodes-base.googleSheets",
"position": [
1480,
0
],
"parameters": {
"columns": {
"value": {
"FACEBOOK": "x",
"row_number": "={{ $('Google Sheets').item.json.row_number }}"
},
"schema": [
{
"id": "POST ID",
"type": "string",
"display": true,
"required": false,
"displayName": "POST ID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "TESTO",
"type": "string",
"display": true,
"required": false,
"displayName": "TESTO",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "TWITTER",
"type": "string",
"display": true,
"required": false,
"displayName": "TWITTER",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "FACEBOOK",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "FACEBOOK",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "INSTAGRAM",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "INSTAGRAM",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "LINKEDIN",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "LINKEDIN",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "string",
"display": true,
"removed": false,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"row_number"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U/edit#gid=0",
"cachedResultName": "Foglio1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U/edit?usp=drivesdk",
"cachedResultName": "Social Media post"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "JYR6a64Qecd6t8Hb",
"name": "Google Sheets account"
}
},
"typeVersion": 4.5
},
{
"id": "7fda8841-4b46-4f3b-9ba0-aa728ba7943f",
"name": "Instagram OK",
"type": "n8n-nodes-base.googleSheets",
"position": [
1480,
280
],
"parameters": {
"columns": {
"value": {
"INSTAGRAM": "x",
"row_number": "={{ $('Google Sheets').item.json.row_number }}"
},
"schema": [
{
"id": "POST ID",
"type": "string",
"display": true,
"required": false,
"displayName": "POST ID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "TESTO",
"type": "string",
"display": true,
"required": false,
"displayName": "TESTO",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "TWITTER",
"type": "string",
"display": true,
"required": false,
"displayName": "TWITTER",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "FACEBOOK",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "FACEBOOK",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "INSTAGRAM",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "INSTAGRAM",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "LINKEDIN",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "LINKEDIN",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "string",
"display": true,
"removed": false,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"row_number"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U/edit#gid=0",
"cachedResultName": "Foglio1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U/edit?usp=drivesdk",
"cachedResultName": "Social Media post"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "JYR6a64Qecd6t8Hb",
"name": "Google Sheets account"
}
},
"typeVersion": 4.5
},
{
"id": "fe599e8f-ff45-4aec-b70e-f0dc75b929d5",
"name": "Get Post",
"type": "n8n-nodes-base.wordpress",
"position": [
220,
-80
],
"parameters": {
"postId": "={{ $json['POST ID'] }}",
"options": {},
"operation": "get"
},
"credentials": {
"wordpressApi": {
"id": "OE4AgquSkMWydRqn",
"name": "Wordpress (wp.test.7hype.com)"
}
},
"typeVersion": 1
},
{
"id": "09059725-47dd-44ff-bcbd-f83d3bb3941d",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
380,
-160
],
"parameters": {
"width": 360,
"height": 260,
"content": "The SMM Chain analyses the content of the post and creates the most suitable caption based on the destination social network.
"
},
"typeVersion": 1
},
{
"id": "89a0deab-b55a-4eb6-8251-538f5f216d56",
"name": "Publish on X",
"type": "n8n-nodes-base.twitter",
"position": [
1220,
-500
],
"parameters": {
"text": "={{ $json.output.twitter }}",
"additionalFields": {}
},
"credentials": {
"twitterOAuth2Api": {
"id": "qex5DVfLnCShvOC4",
"name": "X account"
}
},
"typeVersion": 2
},
{
"id": "d0a618f3-48e0-4ba1-9525-e15663b38d9f",
"name": "X OK",
"type": "n8n-nodes-base.googleSheets",
"position": [
1480,
-500
],
"parameters": {
"columns": {
"value": {
"TWITTER": "x",
"row_number": "={{ $('Google Sheets').item.json.row_number }}"
},
"schema": [
{
"id": "POST ID",
"type": "string",
"display": true,
"required": false,
"displayName": "POST ID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "TESTO",
"type": "string",
"display": true,
"required": false,
"displayName": "TESTO",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "TWITTER",
"type": "string",
"display": true,
"required": false,
"displayName": "TWITTER",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "FACEBOOK",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "FACEBOOK",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "INSTAGRAM",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "INSTAGRAM",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "LINKEDIN",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "LINKEDIN",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "string",
"display": true,
"removed": false,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"row_number"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U/edit#gid=0",
"cachedResultName": "Foglio1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U/edit?usp=drivesdk",
"cachedResultName": "Social Media post"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "JYR6a64Qecd6t8Hb",
"name": "Google Sheets account"
}
},
"typeVersion": 4.5
},
{
"id": "8f19c32b-ab02-4098-a165-a3c9c6ff05c4",
"name": "Publish on LinkedIn",
"type": "n8n-nodes-base.linkedIn",
"position": [
1220,
-260
],
"parameters": {
"text": "={{ $('Social Media Manager').item.json.output.linkedin }}",
"postAs": "organization",
"organization": "xxxxxxx",
"additionalFields": {},
"shareMediaCategory": "IMAGE"
},
"credentials": {
"linkedInOAuth2Api": {
"id": "K5XMG4dK4jY43PJ3",
"name": "LinkedIn account"
}
},
"typeVersion": 1
},
{
"id": "69324bfa-ce6e-42e7-9598-13d8dbd13ae7",
"name": "Publish on Facebook",
"type": "n8n-nodes-base.facebookGraphApi",
"position": [
1220,
0
],
"parameters": {
"edge": "photos",
"node": "433770813646235",
"options": {
"queryParameters": {
"parameter": [
{
"name": "message",
"value": "={{ $('Social Media Manager').item.json.output.facebook }}"
},
{
"name": "link",
"value": "={{ $('Get Post').item.json.link }}"
}
]
}
},
"sendBinaryData": true,
"graphApiVersion": "v21.0",
"httpRequestMethod": "POST",
"binaryPropertyName": "data"
},
"credentials": {
"facebookGraphApi": {
"id": "q5gZW6hdEvqTFPup",
"name": "Facebook Graph account (Fantaera)"
}
},
"typeVersion": 1
},
{
"id": "ccc7bb23-2a26-42c6-9ac4-16a2cce77f66",
"name": "Publish on Instagram",
"type": "n8n-nodes-base.httpRequest",
"position": [
1220,
280
],
"parameters": {
"url": "https://graph.facebook.com/v20.0/433770813646235/media",
"method": "POST",
"options": {},
"sendQuery": true,
"authentication": "predefinedCredentialType",
"queryParameters": {
"parameters": [
{
"name": "image_url",
"value": "={{ $json.url }}"
},
{
"name": "caption",
"value": "={{ $('Social Media Manager').item.json.output.instagram }}"
}
]
},
"nodeCredentialType": "facebookGraphApi"
},
"credentials": {
"facebookGraphApi": {
"id": "q5gZW6hdEvqTFPup",
"name": "Facebook Graph account (Fantaera)"
}
},
"typeVersion": 4.2
},
{
"id": "687cf808-1355-4bec-aad3-2395efd5a41c",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-220,
-680
],
"parameters": {
"color": 3,
"width": 960,
"height": 320,
"content": "## STEP 1
This workflow automates the process of creating and publishing social media posts across multiple platforms (Twitter/X, Facebook, LinkedIn, and Instagram) based on content from a WordPress post. It uses AI models to generate platform-specific captions and images, and integrates with Google Sheets, WordPress, and various social media APIs.
Get the API Keys of the social networks you want to publish on
- [X (Twitter)](https://docs.x.com/x-api/getting-started/getting-access)
- [Linkedin](https://learn.microsoft.com/en-us/linkedin/marketing/community-management/shares/posts-api?view=li-lms-2025-02&tabs=http)
- [Facebook](https://developers.facebook.com/docs/facebook-login/guides/access-tokens#portabletokens)
- [Instagram](https://developers.facebook.com/docs/instagram-platform/instagram-api-with-facebook-login/content-publishing/)
Authenticate on social media nodes with the access tokens obtained"
},
"typeVersion": 1
},
{
"id": "f74d071d-cb55-48f0-8cea-1cc24fa34061",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-220,
-320
],
"parameters": {
"color": 3,
"width": 960,
"height": 100,
"content": "## STEP 2
Clone [this Sheet](https://docs.google.com/spreadsheets/d/1suPQNdgoAzrklleN4ok2mZnsq0GK1dt59oIHv8JWX5U/edit?usp=sharing) and set ONLY the WordPress Post ID id in the right column
"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "31616cbf-fe93-445c-8224-ea0b3afc4696",
"connections": {
"Get Post": {
"main": [
[
{
"node": "Social Media Manager",
"type": "main",
"index": 0
}
]
]
},
"Publish on X": {
"main": [
[
{
"node": "X OK",
"type": "main",
"index": 0
}
]
]
},
"Google Sheets": {
"main": [
[
{
"node": "Get Post",
"type": "main",
"index": 0
}
]
]
},
"Image Instagram": {
"main": [
[
{
"node": "Publish on Instagram",
"type": "main",
"index": 0
}
]
]
},
"Publish on Facebook": {
"main": [
[
{
"node": "Facebook Ok",
"type": "main",
"index": 0
}
]
]
},
"Publish on LinkedIn": {
"main": [
[
{
"node": "Linkedin OK",
"type": "main",
"index": 0
}
]
]
},
"Publish on Instagram": {
"main": [
[
{
"node": "Instagram OK",
"type": "main",
"index": 0
}
]
]
},
"Social Media Manager": {
"main": [
[
{
"node": "Image Instagram",
"type": "main",
"index": 0
},
{
"node": "Image Facebook e Linkedin",
"type": "main",
"index": 0
},
{
"node": "Publish on X",
"type": "main",
"index": 0
}
]
]
},
"OpenRouter Chat Model": {
"ai_languageModel": [
[
{
"node": "Social Media Manager",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "Social Media Manager",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Image Facebook e Linkedin": {
"main": [
[
{
"node": "Publish on LinkedIn",
"type": "main",
"index": 0
},
{
"node": "Publish on Facebook",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Test workflow’": {
"main": [
[
{
"node": "Google Sheets",
"type": "main",
"index": 0
}
]
]
}
}
}
功能特点
- 自动检测新邮件
- AI智能内容分析
- 自定义分类规则
- 批量处理能力
- 详细的处理日志
技术分析
节点类型及作用
- Manualtrigger
- Googlesheets
- @N8N/N8N Nodes Langchain.Lmchatopenrouter
- @N8N/N8N Nodes Langchain.Outputparserstructured
- @N8N/N8N Nodes Langchain.Openai
复杂度评估
配置难度:
维护难度:
扩展性:
实施指南
前置条件
- 有效的Gmail账户
- n8n平台访问权限
- Google API凭证
- AI分类服务订阅
配置步骤
- 在n8n中导入工作流JSON文件
- 配置Gmail节点的认证信息
- 设置AI分类器的API密钥
- 自定义分类规则和标签映射
- 测试工作流执行
- 配置定时触发器(可选)
关键参数
| 参数名称 | 默认值 | 说明 |
|---|---|---|
| maxEmails | 50 | 单次处理的最大邮件数量 |
| confidenceThreshold | 0.8 | 分类置信度阈值 |
| autoLabel | true | 是否自动添加标签 |
最佳实践
优化建议
- 定期更新AI分类模型以提高准确性
- 根据邮件量调整处理批次大小
- 设置合理的分类置信度阈值
- 定期清理过期的分类规则
安全注意事项
- 妥善保管API密钥和认证信息
- 限制工作流的访问权限
- 定期审查处理日志
- 启用双因素认证保护Gmail账户
性能优化
- 使用增量处理减少重复工作
- 缓存频繁访问的数据
- 并行处理多个邮件分类任务
- 监控系统资源使用情况
故障排除
常见问题
邮件未被正确分类
检查AI分类器的置信度阈值设置,适当降低阈值或更新训练数据。
Gmail认证失败
确认Google API凭证有效且具有正确的权限范围,重新进行OAuth授权。
调试技巧
- 启用详细日志记录查看每个步骤的执行情况
- 使用测试邮件验证分类逻辑
- 检查网络连接和API服务状态
- 逐步执行工作流定位问题节点
错误处理
工作流包含以下错误处理机制:
- 网络超时自动重试(最多3次)
- API错误记录和告警
- 处理失败邮件的隔离机制
- 异常情况下的回滚操作