8
n8n 中文网amn8n.com

我的工作流 2

中级

这是一个Market Research, AI Summarization领域的自动化工作流,包含 12 个节点。主要使用 Code, ScheduleTrigger, ScrapegraphAi 等节点。 使用 ScrapeGraphAI 分析和 ROI 跟踪的 Instagram 网红内容监控

前置要求
  • 无特殊前置要求,导入即可使用
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "VhEwspDqzu7ssFVE",
  "meta": {
    "instanceId": "f4b0efaa33080e7774e0d9285c40c7abcd2c6f7cf1a8b901fa7106170dd4cda3",
    "templateCredsSetupCompleted": true
  },
  "name": "我的工作流 2",
  "tags": [
    {
      "id": "DxXGubfBzRKh6L8T",
      "name": "Revenue Optimization",
      "createdAt": "2025-07-25T16:24:30.370Z",
      "updatedAt": "2025-07-25T16:24:30.370Z"
    },
    {
      "id": "IxkcJ2IpYIxivoHV",
      "name": "Content Strategy",
      "createdAt": "2025-07-25T12:57:37.677Z",
      "updatedAt": "2025-07-25T12:57:37.677Z"
    },
    {
      "id": "PAKIJ2Mm9EvRcR3u",
      "name": "Trend Monitoring",
      "createdAt": "2025-07-25T12:57:37.670Z",
      "updatedAt": "2025-07-25T12:57:37.670Z"
    },
    {
      "id": "YtfXmaZk44MYedPO",
      "name": "Dynamic Pricing",
      "createdAt": "2025-07-25T16:24:30.369Z",
      "updatedAt": "2025-07-25T16:24:30.369Z"
    },
    {
      "id": "wJ30mjhtrposO8Qt",
      "name": "Simple RAG",
      "createdAt": "2025-07-28T12:55:14.424Z",
      "updatedAt": "2025-07-28T12:55:14.424Z"
    }
  ],
  "nodes": [
    {
      "id": "78600a1a-24f3-4383-a46c-cfedfdb8dc5d",
      "name": "每日计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -768,
        128
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 9 * * *"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3cbdaef1-0878-4dac-8bb1-c5d075d68b79",
      "name": "ScrapeGraphAI - 影响者资料",
      "type": "n8n-nodes-scrapegraphai.scrapegraphAi",
      "position": [
        -400,
        288
      ],
      "parameters": {
        "userPrompt": "Extract influencer profile data and recent posts. Use this schema: { \"profile\": { \"username\": \"@influencer\", \"followers\": \"100K\", \"following\": \"500\", \"posts_count\": \"1,234\", \"bio\": \"Lifestyle blogger\", \"verified\": true }, \"recent_posts\": [{ \"post_url\": \"https://instagram.com/p/...\", \"caption\": \"Post caption text\", \"likes\": \"5,000\", \"comments\": \"150\", \"date\": \"2024-01-15\", \"hashtags\": [\"#lifestyle\", \"#brand\"], \"mentions\": [\"@brandname\"] }] }",
        "websiteUrl": "https://www.instagram.com/{{ $json.influencer_username }}"
      },
      "typeVersion": 1
    },
    {
      "id": "1554c1d6-cd26-4cfe-8272-ac02d9041701",
      "name": "内容分析器",
      "type": "n8n-nodes-base.code",
      "position": [
        -64,
        240
      ],
      "parameters": {
        "jsCode": "// Content Analyzer - Analyzes post content for engagement and quality\nconst inputData = $input.all()[0].json;\nconst profile = inputData.result.profile || {};\nconst posts = inputData.result.recent_posts || [];\n\nfunction analyzeContent(posts) {\n  return posts.map(post => {\n    const likes = parseInt(post.likes?.replace(/[^0-9]/g, '') || '0');\n    const comments = parseInt(post.comments?.replace(/[^0-9]/g, '') || '0');\n    const engagementRate = likes > 0 ? ((likes + comments) / likes * 100).toFixed(2) : 0;\n    \n    // Content quality scoring based on caption length, hashtags, mentions\n    const captionScore = post.caption ? Math.min(post.caption.length / 100, 10) : 0;\n    const hashtagScore = post.hashtags ? Math.min(post.hashtags.length * 2, 10) : 0;\n    const mentionScore = post.mentions ? post.mentions.length * 5 : 0;\n    const qualityScore = (captionScore + hashtagScore + mentionScore) / 3;\n    \n    return {\n      ...post,\n      engagement_rate: `${engagementRate}%`,\n      content_quality_score: qualityScore.toFixed(1),\n      performance_tier: engagementRate > 5 ? 'High' : engagementRate > 2 ? 'Medium' : 'Low'\n    };\n  });\n}\n\nconst analyzedPosts = analyzeContent(posts);\nconst avgEngagement = analyzedPosts.length > 0 ? \n  (analyzedPosts.reduce((sum, post) => sum + parseFloat(post.engagement_rate), 0) / analyzedPosts.length).toFixed(2) : 0;\n\nreturn [{\n  json: {\n    profile,\n    analyzed_posts: analyzedPosts,\n    analytics: {\n      total_posts: posts.length,\n      average_engagement: `${avgEngagement}%`,\n      high_performing_posts: analyzedPosts.filter(p => p.performance_tier === 'High').length,\n      analysis_date: new Date().toISOString()\n    }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "e006e58a-fd2d-4b93-a8c7-51d0e490fb6f",
      "name": "品牌提及检测器",
      "type": "n8n-nodes-base.code",
      "position": [
        288,
        256
      ],
      "parameters": {
        "jsCode": "// Brand Mention Detector - Identifies brand mentions and sponsored content\nconst inputData = $input.all()[0].json;\nconst posts = inputData.analyzed_posts || [];\nconst profile = inputData.profile || {};\n\n// Define brand keywords to monitor\nconst brandKeywords = [\n  'nike', 'adidas', 'coca-cola', 'pepsi', 'apple', 'samsung',\n  'sponsored', '#ad', '#sponsored', '#partnership', '#collab'\n];\n\nfunction detectBrandMentions(posts) {\n  return posts.map(post => {\n    const caption = (post.caption || '').toLowerCase();\n    const hashtags = (post.hashtags || []).map(tag => tag.toLowerCase());\n    const mentions = post.mentions || [];\n    \n    // Detect brand mentions in caption\n    const brandMentionsInCaption = brandKeywords.filter(brand => \n      caption.includes(brand.toLowerCase())\n    );\n    \n    // Detect sponsored content indicators\n    const sponsoredIndicators = ['#ad', '#sponsored', '#partnership', '#collab'];\n    const isSponsored = sponsoredIndicators.some(indicator => \n      caption.includes(indicator) || hashtags.includes(indicator)\n    );\n    \n    // Extract mentioned brands from @ mentions\n    const mentionedBrands = mentions.filter(mention => \n      brandKeywords.some(brand => mention.toLowerCase().includes(brand))\n    );\n    \n    return {\n      ...post,\n      brand_mentions: brandMentionsInCaption,\n      mentioned_brands: mentionedBrands,\n      is_sponsored_content: isSponsored,\n      brand_mention_count: brandMentionsInCaption.length + mentionedBrands.length\n    };\n  });\n}\n\nconst postsWithBrands = detectBrandMentions(posts);\nconst sponsoredPosts = postsWithBrands.filter(post => post.is_sponsored_content);\nconst totalBrandMentions = postsWithBrands.reduce((sum, post) => sum + post.brand_mention_count, 0);\n\nreturn [{\n  json: {\n    profile,\n    analyzed_posts: postsWithBrands,\n    brand_analytics: {\n      total_brand_mentions: totalBrandMentions,\n      sponsored_posts_count: sponsoredPosts.length,\n      sponsored_content_ratio: posts.length > 0 ? (sponsoredPosts.length / posts.length * 100).toFixed(1) + '%' : '0%',\n      top_mentioned_brands: [...new Set(postsWithBrands.flatMap(post => post.brand_mentions))],\n      detection_date: new Date().toISOString()\n    }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "307a73f8-1c13-407b-971b-59b7de61bd59",
      "name": "活动性能跟踪器",
      "type": "n8n-nodes-base.code",
      "position": [
        640,
        240
      ],
      "parameters": {
        "jsCode": "// Campaign Performance Tracker - Tracks campaign metrics and KPIs\nconst inputData = $input.all()[0].json;\nconst posts = inputData.analyzed_posts || [];\nconst profile = inputData.profile || {};\nconst brandAnalytics = inputData.brand_analytics || {};\n\nfunction trackCampaignPerformance(posts, profile) {\n  const sponsoredPosts = posts.filter(post => post.is_sponsored_content);\n  \n  // Calculate campaign metrics\n  const totalReach = parseInt(profile.followers?.replace(/[^0-9]/g, '') || '0');\n  const totalEngagement = posts.reduce((sum, post) => {\n    const likes = parseInt(post.likes?.replace(/[^0-9]/g, '') || '0');\n    const comments = parseInt(post.comments?.replace(/[^0-9]/g, '') || '0');\n    return sum + likes + comments;\n  }, 0);\n  \n  const sponsoredEngagement = sponsoredPosts.reduce((sum, post) => {\n    const likes = parseInt(post.likes?.replace(/[^0-9]/g, '') || '0');\n    const comments = parseInt(post.comments?.replace(/[^0-9]/g, '') || '0');\n    return sum + likes + comments;\n  }, 0);\n  \n  // Performance metrics\n  const avgEngagementPerPost = posts.length > 0 ? (totalEngagement / posts.length).toFixed(0) : 0;\n  const sponsoredAvgEngagement = sponsoredPosts.length > 0 ? (sponsoredEngagement / sponsoredPosts.length).toFixed(0) : 0;\n  const engagementRate = totalReach > 0 ? (totalEngagement / totalReach * 100).toFixed(2) : 0;\n  \n  // Campaign performance score (0-100)\n  const performanceScore = Math.min(\n    (parseFloat(engagementRate) * 10) + \n    (sponsoredPosts.length * 5) + \n    (brandAnalytics.total_brand_mentions * 2), \n    100\n  ).toFixed(1);\n  \n  return {\n    campaign_metrics: {\n      total_posts: posts.length,\n      sponsored_posts: sponsoredPosts.length,\n      total_reach: totalReach.toLocaleString(),\n      total_engagement: totalEngagement.toLocaleString(),\n      avg_engagement_per_post: avgEngagementPerPost,\n      sponsored_avg_engagement: sponsoredAvgEngagement,\n      overall_engagement_rate: `${engagementRate}%`,\n      campaign_performance_score: performanceScore\n    },\n    top_performing_campaigns: sponsoredPosts\n      .sort((a, b) => parseInt(b.likes) - parseInt(a.likes))\n      .slice(0, 3)\n      .map(post => ({\n        post_url: post.post_url,\n        brand_mentions: post.brand_mentions,\n        engagement: `${post.likes} likes, ${post.comments} comments`,\n        performance_tier: post.performance_tier\n      }))\n  };\n}\n\nconst campaignData = trackCampaignPerformance(posts, profile);\n\nreturn [{\n  json: {\n    profile,\n    analyzed_posts: posts,\n    brand_analytics: brandAnalytics,\n    ...campaignData,\n    tracking_date: new Date().toISOString()\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "20dd7a96-c6cb-4924-ba7e-2a8d7f0f1b99",
      "name": "营销投资回报率计算器",
      "type": "n8n-nodes-base.code",
      "position": [
        976,
        208
      ],
      "parameters": {
        "jsCode": "// Marketing ROI Calculator - Calculates return on investment for campaigns\nconst inputData = $input.all()[0].json;\nconst campaignMetrics = inputData.campaign_metrics || {};\nconst profile = inputData.profile || {};\nconst sponsoredPosts = inputData.analyzed_posts?.filter(post => post.is_sponsored_content) || [];\n\n// Estimated costs and values (these would typically come from your campaign data)\nconst estimatedCosts = {\n  cost_per_sponsored_post: 500, // Average cost per sponsored post\n  campaign_management_cost: 200, // Monthly management cost\n  content_creation_cost: 100 // Per post content creation\n};\n\nfunction calculateROI(metrics, posts, costs) {\n  // Calculate total investment\n  const totalSponsoredPosts = parseInt(metrics.sponsored_posts || 0);\n  const contentCosts = totalSponsoredPosts * costs.cost_per_sponsored_post;\n  const managementCosts = costs.campaign_management_cost;\n  const creationCosts = totalSponsoredPosts * costs.content_creation_cost;\n  const totalInvestment = contentCosts + managementCosts + creationCosts;\n  \n  // Calculate estimated value/return\n  const totalEngagement = parseInt(metrics.total_engagement?.replace(/[^0-9]/g, '') || '0');\n  const reach = parseInt(metrics.total_reach?.replace(/[^0-9]/g, '') || '0');\n  \n  // Estimated value calculations\n  const valuePerEngagement = 0.05; // $0.05 per engagement\n  const valuePerReach = 0.001; // $0.001 per reach\n  const engagementValue = totalEngagement * valuePerEngagement;\n  const reachValue = reach * valuePerReach;\n  const totalEstimatedValue = engagementValue + reachValue;\n  \n  // ROI calculation\n  const roi = totalInvestment > 0 ? ((totalEstimatedValue - totalInvestment) / totalInvestment * 100).toFixed(1) : 0;\n  const costPerEngagement = totalEngagement > 0 ? (totalInvestment / totalEngagement).toFixed(2) : 0;\n  const costPerReach = reach > 0 ? (totalInvestment / reach * 1000).toFixed(2) : 0; // CPM\n  \n  return {\n    roi_analysis: {\n      total_investment: `$${totalInvestment.toLocaleString()}`,\n      estimated_value: `$${totalEstimatedValue.toLocaleString()}`,\n      roi_percentage: `${roi}%`,\n      cost_per_engagement: `$${costPerEngagement}`,\n      cost_per_thousand_reach: `$${costPerReach}`,\n      investment_efficiency: roi > 0 ? 'Positive' : 'Needs Optimization',\n      payback_period: roi > 0 ? 'Immediate' : 'Extended'\n    },\n    cost_breakdown: {\n      sponsored_content_costs: `$${contentCosts.toLocaleString()}`,\n      campaign_management_costs: `$${managementCosts.toLocaleString()}`,\n      content_creation_costs: `$${creationCosts.toLocaleString()}`,\n      total_costs: `$${totalInvestment.toLocaleString()}`\n    },\n    recommendations: [\n      roi > 50 ? \"Excellent ROI - Scale up campaigns\" : \n      roi > 0 ? \"Positive ROI - Continue with optimizations\" : \n      \"Negative ROI - Review targeting and content strategy\",\n      totalSponsoredPosts > 0 ? `Focus on top-performing content types` : \"Increase sponsored content volume\",\n      parseFloat(costPerEngagement) > 1 ? \"Optimize for lower cost per engagement\" : \"Good cost efficiency\"\n    ]\n  };\n}\n\nconst roiData = calculateROI(campaignMetrics, sponsoredPosts, estimatedCosts);\n\n// Create final report\nconst finalReport = {\n  influencer_profile: {\n    username: profile.username,\n    followers: profile.followers,\n    verification_status: profile.verified ? 'Verified' : 'Not Verified'\n  },\n  campaign_summary: campaignMetrics,\n  ...roiData,\n  report_generated: new Date().toISOString(),\n  next_review_date: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString() // 7 days from now\n};\n\nreturn [{\n  json: finalReport\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "29cc090f-82f1-4160-bbdf-72175bdcea72",
      "name": "触发器信息",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        -336
      ],
      "parameters": {
        "color": 4,
        "width": 350,
        "height": 784,
        "content": "# 步骤 1:每日计划触发器 ⏰"
      },
      "typeVersion": 1
    },
    {
      "id": "a1b3ad21-861e-4005-bee2-235853c1ddb5",
      "name": "爬虫信息",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        -336
      ],
      "parameters": {
        "color": 5,
        "width": 350,
        "height": 784,
        "content": "# 步骤 2:ScrapeGraphAI - 影响者资料 🤖"
      },
      "typeVersion": 1
    },
    {
      "id": "ebeea18f-631c-42ee-bdf4-a377fa7a93e8",
      "name": "分析器信息",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -176,
        -336
      ],
      "parameters": {
        "color": 6,
        "width": 350,
        "height": 784,
        "content": "# 步骤 3:内容分析器 📊"
      },
      "typeVersion": 1
    },
    {
      "id": "012494c9-de52-4dbb-b083-63e8944ffc09",
      "name": "品牌检测器信息",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        -336
      ],
      "parameters": {
        "color": 7,
        "width": 350,
        "height": 784,
        "content": "# 步骤 4:品牌提及检测器 🏷️"
      },
      "typeVersion": 1
    },
    {
      "id": "850a0774-631b-42a6-95cd-67d970ac3f54",
      "name": "性能跟踪器信息",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        -336
      ],
      "parameters": {
        "width": 350,
        "height": 784,
        "content": "# 步骤 5:活动性能跟踪器 📈"
      },
      "typeVersion": 1
    },
    {
      "id": "cd8888cf-691a-43ae-8642-6b405d91b6ab",
      "name": "投资回报率计算器信息",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        -336
      ],
      "parameters": {
        "color": 2,
        "width": 350,
        "height": 784,
        "content": "# 步骤 6:营销投资回报率计算器 💰"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "99ba7a8d-2728-4a46-a766-a6aa6abf738c",
  "connections": {
    "Content Analyzer": {
      "main": [
        [
          {
            "node": "Brand Mention Detector",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Brand Mention Detector": {
      "main": [
        [
          {
            "node": "Campaign Performance Tracker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Schedule Trigger": {
      "main": [
        [
          {
            "node": "ScrapeGraphAI - Influencer Profiles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Campaign Performance Tracker": {
      "main": [
        [
          {
            "node": "Marketing ROI Calculator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ScrapeGraphAI - Influencer Profiles": {
      "main": [
        [
          {
            "node": "Content Analyzer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流