8
n8n 中文网amn8n.com

创作者社交媒体趋势页面

中级

这是一个Market Research, AI Summarization领域的自动化工作流,包含 15 个节点。主要使用 Set, Code, Merge, HttpRequest, ManualTrigger 等节点。 使用 Reddit、Twitter 和 GPT-4o 追踪社交媒体趋势,同步至 SharePoint/Drive

前置要求
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "WEsO2dwjCaN6NwQT",
  "meta": {
    "instanceId": "2cf742429c2e3ee4e5a20069d3d8a75208519303b864f026a79464efa726bd95",
    "templateCredsSetupCompleted": true
  },
  "name": "创作者社交媒体趋势页面",
  "tags": [
    {
      "id": "wpMIpESnBZpdPCpj",
      "name": "Marketing",
      "createdAt": "2025-06-03T11:38:37.020Z",
      "updatedAt": "2025-06-03T11:38:37.020Z"
    }
  ],
  "nodes": [
    {
      "id": "a4dd01b9-57d6-41ff-9630-1bc6276f48da",
      "name": "Reddit API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -336,
        48
      ],
      "parameters": {
        "url": "https://oauth.reddit.com/r/artificial/hot",
        "options": {},
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "redditOAuth2Api"
      },
      "credentials": {
        "redditOAuth2Api": {
          "id": "QfwNxnbWZe2Y5RSa",
          "name": "Reddit account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "fd03075f-7e22-48a8-b92a-ef397a7d74e6",
      "name": "合并数据",
      "type": "n8n-nodes-base.merge",
      "position": [
        -96,
        192
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "b5dd36d6-a175-4695-8a02-0e92237bc0d3",
      "name": "聚合内容",
      "type": "n8n-nodes-base.code",
      "position": [
        80,
        192
      ],
      "parameters": {
        "jsCode": "const allData = $input.all();\nlet content = '\\n';\n\nallData.forEach(item => {\n  if (item.json.data?.children) {\n    // Reddit data\n    item.json.data.children.slice(0,3).forEach((post, i) => {\n      content += `${i+1}. ${post.data.title}\\n`;\n    });\n  }\n  content += '\\n';\n});\n\n// Output in `aggregatedContent`\nreturn [{\n  json: {\n    aggregatedContent: content,\n    output: $('Get Twitter Trends').first().json.output\n  }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "aa228c26-feb4-4d9e-9535-2da2b4aa3635",
      "name": "准备 Excel",
      "type": "n8n-nodes-base.code",
      "position": [
        608,
        192
      ],
      "parameters": {
        "jsCode": "const aiResponse = $input.first().json.output;\nconst dateToday = $('Set Config').first().json.dateToday;\n\nlet trendsData;\ntry {\n  const jsonMatch = aiResponse.match(/\\{[\\s\\S]*\\}/);\n  trendsData = jsonMatch ? JSON.parse(jsonMatch[0]) : { trends: [] };\n} catch {\n  trendsData = {\n    trends: [{\n      rank: 1,\n      trend: 'AI Innovation',\n      description: 'AI continues to innovate',\n      platforms: ['Multiple']\n    }]\n  };\n}\n\n// Return one item per row\nreturn trendsData.trends.map(trend => ({\n  json: {\n    Rank: trend.rank,\n    Trend: trend.trend,\n    Description: trend.description,\n    Platforms: Array.isArray(trend.platforms) ? trend.platforms.join(', ') : trend.platforms,\n    Date: dateToday\n  }\n}));\n"
      },
      "typeVersion": 2
    },
    {
      "id": "ada69f9a-3b99-4c41-98df-9fed26498184",
      "name": "创建 Excel",
      "type": "n8n-nodes-base.spreadsheetFile",
      "position": [
        832,
        192
      ],
      "parameters": {
        "options": {},
        "operation": "toFile"
      },
      "typeVersion": 2
    },
    {
      "id": "f6df2ff4-fd06-4073-bc41-a71d2c614010",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        288,
        -16
      ],
      "parameters": {
        "text": "=Analyze these social media trends and extract the top 5 trends in JSON format:\n\nTRENDS FROM REDDIT:\n{{$json.aggregatedContent}}\n\nTRENDS FROM X:\n{{ $json.output }}\n\nRespond with:\n{\n  \"trends\": [\n    {\"rank\": 1, \"trend\": \"Trend Name\", \"description\": \"Description\", \"platforms\": [\"Platform1\"]}\n  ]\n}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "9fc152ce-46e6-45c2-8d3f-72a9e34f5b3a",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        288,
        192
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "E4PFATctY0kV00hl",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "302e51be-be21-4883-b62a-21c8fc6c4ca4",
      "name": "当点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -768,
        192
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c625cc58-a4aa-4090-9b31-53c92fda8d37",
      "name": "Microsoft SharePoint",
      "type": "n8n-nodes-base.microsoftSharePoint",
      "position": [
        1040,
        192
      ],
      "parameters": {
        "site": {
          "__rl": true,
          "mode": "list",
          "value": "plemeo.sharepoint.com,f304c34c-1252-4b99-a852-059c2036c718,c3bf26ab-bf44-4334-8e5b-e8b680bb9e1d",
          "cachedResultName": "plemeo"
        },
        "folder": {
          "__rl": true,
          "mode": "list",
          "value": "01M45PWAZCILJ3WHMIXBGZA2UP2JMQ5CXO",
          "cachedResultName": "Newsletter Workflow"
        },
        "fileName": "social-media-trends.xls",
        "operation": "upload",
        "fileContents": "data",
        "requestOptions": {}
      },
      "credentials": {
        "microsoftSharePointOAuth2Api": {
          "id": "jZkLTQXyVEzxtmp3",
          "name": "Microsoft SharePoint account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fd72d6de-d25d-4bb1-922b-8a4f0d3d7bca",
      "name": "获取 Twitter 趋势",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -336,
        320
      ],
      "parameters": {
        "url": "=<YOUR_SERVICE_URL>",
        "method": "POST",
        "options": {
          "allowUnauthorizedCerts": true
        },
        "jsonBody": "={\n  \"workflow_to_run\": \"python <PATH_TO_YOUR_SCRIPT>\\\\\\\\twitter_bot_dynamic.py --topic \\\"{{ $json.topic }}\\\"\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "71e4af0b-959f-48ee-9554-73d08a13abc2",
      "name": "设置配置",
      "type": "n8n-nodes-base.set",
      "position": [
        -560,
        192
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9b3e9f6d-6ddb-4871-b4e0-d135d5f82189",
              "name": "dateToday",
              "type": "string",
              "value": "={{ $now.setLocale('en').toFormat('yyyy-MM-dd') }}"
            },
            {
              "id": "308da6fe-c718-4e5e-a309-c276bdfc6658",
              "name": "topic",
              "type": "string",
              "value": "Artificial Intelligence"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5915a721-4aca-4f8f-892e-df152dc2b9a0",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        -208
      ],
      "parameters": {
        "width": 432,
        "height": 304,
        "content": "### 数据源分支"
      },
      "typeVersion": 1
    },
    {
      "id": "e7497dd8-57ed-4ffd-94a3-f04bb18da3c4",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        -336
      ],
      "parameters": {
        "width": 560,
        "height": 272,
        "content": "### AI 分析分支"
      },
      "typeVersion": 1
    },
    {
      "id": "0101f056-16c6-41ba-a9cc-c5778d3ca64d",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -112
      ],
      "parameters": {
        "width": 416,
        "height": 256,
        "content": "### 电子表格创建分支"
      },
      "typeVersion": 1
    },
    {
      "id": "39c76494-1a64-4756-9f20-81c087c24342",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        384
      ],
      "parameters": {
        "width": 496,
        "height": 288,
        "content": "### 存储分支"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b5041345-234a-450f-85ee-e8f6e1ad045d",
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Prepare Excel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Data": {
      "main": [
        [
          {
            "node": "Aggregate Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reddit API": {
      "main": [
        [
          {
            "node": "Merge Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Config": {
      "main": [
        [
          {
            "node": "Reddit API",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Twitter Trends",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Excel": {
      "main": [
        [
          {
            "node": "Microsoft SharePoint",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Excel": {
      "main": [
        [
          {
            "node": "Create Excel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Content": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get Twitter Trends": {
      "main": [
        [
          {
            "node": "Merge Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Set Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 市场调研, AI 摘要总结

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流