8
n8n 中文网amn8n.com

使用 Gemini AI 和 Blotato 自动发布 WordPress 文章到社交媒体

中级

这是一个Social Media, Multimodal AI领域的自动化工作流,包含 11 个节点。主要使用 If, Code, SplitOut, Wordpress, Agent 等节点。 使用 Gemini AI 和 Blotato 自动发布 WordPress 文章到社交媒体

前置要求
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc"
  },
  "nodes": [
    {
      "id": "38f0d320-171c-4acb-aa3c-67d604d946a5",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -128
      ],
      "parameters": {
        "width": 400,
        "height": 804,
        "content": "## WordPress 到 Blotato 社交发布器"
      },
      "typeVersion": 1
    },
    {
      "id": "af350bce-1317-456c-95c1-5a8556bc1e27",
      "name": "每 30 分钟",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        224,
        128
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5f5c3758-f17e-4218-a9a7-41c1ba68c5c9",
      "name": "检查新文章",
      "type": "n8n-nodes-base.wordpress",
      "position": [
        448,
        128
      ],
      "parameters": {
        "options": {},
        "operation": "getAll"
      },
      "typeVersion": 1
    },
    {
      "id": "411cf856-72ff-474f-a928-f8ceb1b998ab",
      "name": "筛选新文章",
      "type": "n8n-nodes-base.if",
      "position": [
        672,
        128
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "new-post-check",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{$json.length}}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "7715a9a5-5f1c-44dd-834e-b225e72852b3",
      "name": "AI 社交内容创建器",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1120,
        128
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a social media manager. Based on the provided blog post, create platform-specific social media posts. Return ONLY valid JSON in this format: {\"twitter\": \"Tweet content with hashtags (280 chars max)\", \"linkedin\": \"Professional LinkedIn post with insights\", \"facebook\": \"Engaging Facebook post with call-to-action\"}. Make each post engaging and platform-appropriate."
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "119c13cf-458f-479e-9537-bb6631f8d6e0",
      "name": "解析社交内容",
      "type": "n8n-nodes-base.code",
      "position": [
        1472,
        128
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\n\nreturn items.map(item => {\n  // Parse AI output for social media content\n  let aiOutput = item.json.output;\n  \n  // Remove markdown code blocks if present\n  aiOutput = aiOutput.replace(/```json\\s*/, '').replace(/```\\s*$/, '');\n  \n  let socialContent;\n  try {\n    socialContent = JSON.parse(aiOutput.trim());\n  } catch (e) {\n    // Fallback if parsing fails\n    socialContent = {\n      twitter: `New post: ${item.json.title.rendered} ${item.json.link}`,\n      linkedin: `Check out our latest post: ${item.json.title.rendered} ${item.json.link}`,\n      facebook: `We just published: ${item.json.title.rendered} ${item.json.link}`\n    };\n  }\n  \n  return {\n    json: {\n      postTitle: item.json.title.rendered,\n      postUrl: item.json.link,\n      postId: item.json.id,\n      twitter: socialContent.twitter,\n      linkedin: socialContent.linkedin,\n      facebook: socialContent.facebook,\n      featuredImage: item.json.featured_media || null\n    }\n  };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "78c4e8d5-d5f3-4a84-b815-215b0a3872ef",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1192,
        352
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "wNw45YZvXXpeocJ2",
          "name": "TST API"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "204300e5-0706-4da8-8aa3-02592993ae8b",
      "name": "创建 Facebook 帖子",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        1696,
        304
      ],
      "parameters": {
        "options": {},
        "platform": "facebook",
        "accountId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "facebookPageId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "postContentText": "={{$json.facebook}}"
      },
      "typeVersion": 2
    },
    {
      "id": "7269a022-6da1-419d-b578-2ebd86ab3c38",
      "name": "创建 LinkedIn 帖子",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        1728,
        112
      ],
      "parameters": {
        "options": {},
        "platform": "linkedin",
        "accountId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "postContentText": "={{$json.linkedin}}"
      },
      "typeVersion": 2
    },
    {
      "id": "1c7a8945-942f-44e2-b8e0-e724a666a6e8",
      "name": "创建 Twitter 帖子",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        1696,
        -80
      ],
      "parameters": {
        "options": {},
        "platform": "linkedin",
        "accountId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "postContentText": "={{$json.twitter}}"
      },
      "typeVersion": 2
    },
    {
      "id": "fdac53ac-9cb4-42f2-a94e-830c4bd1b7d9",
      "name": "分离",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        896,
        96
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Split Out": {
      "main": [
        [
          {
            "node": "AI Social Content Creator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check New Posts": {
      "main": [
        [
          {
            "node": "Filter New Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Every 30 Minutes": {
      "main": [
        [
          {
            "node": "Check New Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter New Posts": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Social Content": {
      "main": [
        [
          {
            "node": "Create post Facebook",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create post LinkedIn",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create post twitter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Social Content Creator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Social Content Creator": {
      "main": [
        [
          {
            "node": "Parse Social Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 社交媒体, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量11
分类2
节点类型9
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
David Olusola

David Olusola

@dae221

I 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 查看

分享此工作流