8
n8n 中文网amn8n.com

使用AI评分和Gmail推广管理社交媒体影响者活动

中级

这是一个Social Media, AI Summarization领域的自动化工作流,包含 15 个节点。主要使用 If, Set, Code, Wait, Gmail 等节点。 使用AI评分和Gmail推广管理社交媒体影响者活动

前置要求
  • Google 账号和 Gmail API 凭证
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "nodes": [
    {
      "id": "1",
      "name": "活动简报 Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        240,
        300
      ],
      "parameters": {
        "path": "campaign-brief",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 1
    },
    {
      "id": "2",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        140,
        180
      ],
      "parameters": {
        "width": 240,
        "height": 160,
        "content": "## 网红活动设置"
      },
      "typeVersion": 1
    },
    {
      "id": "3",
      "name": "活动设置",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        300
      ],
      "parameters": {
        "values": {
          "number": [
            {
              "name": "totalBudget",
              "value": "{{ $json.budget }}"
            },
            {
              "name": "minFollowers",
              "value": 10000
            },
            {
              "name": "maxFollowers",
              "value": 500000
            },
            {
              "name": "minEngagementRate",
              "value": 3
            }
          ],
          "string": [
            {
              "name": "campaignName",
              "value": "{{ $json.campaign_name }}"
            },
            {
              "name": "targetAudience",
              "value": "{{ $json.target_audience }}"
            },
            {
              "name": "brandEmail",
              "value": "partnerships@yourbrand.com"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4",
      "name": "搜索 Instagram 网红",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        640,
        200
      ],
      "parameters": {
        "qs": {
          "q": "{{ $json.targetAudience }}",
          "count": 50
        },
        "url": "https://api.instagram.com/v1/users/search",
        "method": "GET",
        "headers": {
          "Authorization": "Bearer {{ $credentials.instagram.accessToken }}"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5",
      "name": "搜索 TikTok 网红",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        640,
        300
      ],
      "parameters": {
        "qs": {
          "limit": 50,
          "keyword": "{{ $json.targetAudience }}"
        },
        "url": "https://api.tiktok.com/v1/users/search",
        "method": "GET",
        "headers": {
          "Authorization": "Bearer {{ $credentials.tiktok.accessToken }}"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6",
      "name": "搜索 YouTube 网红",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        640,
        400
      ],
      "parameters": {
        "qs": {
          "q": "{{ $json.targetAudience }}",
          "type": "channel",
          "maxResults": 50
        },
        "url": "https://api.youtube.com/v3/search",
        "method": "GET",
        "headers": {
          "Authorization": "Bearer {{ $credentials.youtube.accessToken }}"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7",
      "name": "评分与资格筛选网红",
      "type": "n8n-nodes-base.code",
      "position": [
        840,
        300
      ],
      "parameters": {
        "jsCode": "// Advanced influencer scoring and qualification algorithm\nconst campaignSettings = $node['Campaign Settings'].json;\nconst allInfluencers = [];\n\n// Process Instagram influencers\nconst instagramData = $node['Search Instagram Influencers'].json;\nif (instagramData.data) {\n  instagramData.data.forEach(influencer => {\n    allInfluencers.push({\n      platform: 'instagram',\n      username: influencer.username,\n      follower_count: influencer.follower_count,\n      engagement_rate: influencer.engagement_rate,\n      profile_url: `https://instagram.com/${influencer.username}`,\n      bio: influencer.bio,\n      raw_data: influencer\n    });\n  });\n}\n\n// Process TikTok influencers\nconst tiktokData = $node['Search TikTok Influencers'].json;\nif (tiktokData.data) {\n  tiktokData.data.forEach(influencer => {\n    allInfluencers.push({\n      platform: 'tiktok',\n      username: influencer.username,\n      follower_count: influencer.follower_count,\n      engagement_rate: influencer.engagement_rate,\n      profile_url: `https://tiktok.com/@${influencer.username}`,\n      bio: influencer.bio,\n      raw_data: influencer\n    });\n  });\n}\n\n// Process YouTube influencers\nconst youtubeData = $node['Search YouTube Influencers'].json;\nif (youtubeData.items) {\n  youtubeData.items.forEach(channel => {\n    allInfluencers.push({\n      platform: 'youtube',\n      username: channel.snippet.channelTitle,\n      follower_count: channel.statistics?.subscriberCount || 0,\n      engagement_rate: (channel.statistics?.viewCount / channel.statistics?.subscriberCount) * 100,\n      profile_url: `https://youtube.com/channel/${channel.id}`,\n      bio: channel.snippet.description,\n      raw_data: channel\n    });\n  });\n}\n\n// Filter and score influencers\nconst qualifiedInfluencers = allInfluencers\n  .filter(influencer => {\n    return influencer.follower_count >= campaignSettings.minFollowers &&\n           influencer.follower_count <= campaignSettings.maxFollowers &&\n           influencer.engagement_rate >= campaignSettings.minEngagementRate;\n  })\n  .map(influencer => {\n    let score = 0;\n    \n    // Follower count scoring (30% weight)\n    const followerScore = Math.min((influencer.follower_count / campaignSettings.maxFollowers) * 30, 30);\n    score += followerScore;\n    \n    // Engagement rate scoring (40% weight)\n    const engagementScore = Math.min((influencer.engagement_rate / 10) * 40, 40);\n    score += engagementScore;\n    \n    // Platform preference scoring (20% weight)\n    const platformScores = { instagram: 20, tiktok: 15, youtube: 18 };\n    score += platformScores[influencer.platform] || 10;\n    \n    // Bio relevance scoring (10% weight)\n    const targetKeywords = campaignSettings.targetAudience.toLowerCase().split(' ');\n    const bioRelevance = targetKeywords.filter(keyword => \n      influencer.bio?.toLowerCase().includes(keyword)\n    ).length;\n    score += Math.min(bioRelevance * 3, 10);\n    \n    // Calculate estimated cost per post\n    let costPerPost = 0;\n    if (influencer.platform === 'instagram') {\n      costPerPost = (influencer.follower_count / 1000) * 10; // $10 per 1k followers\n    } else if (influencer.platform === 'tiktok') {\n      costPerPost = (influencer.follower_count / 1000) * 8; // $8 per 1k followers\n    } else if (influencer.platform === 'youtube') {\n      costPerPost = (influencer.follower_count / 1000) * 25; // $25 per 1k subscribers\n    }\n    \n    return {\n      ...influencer,\n      score: Math.round(score),\n      estimated_cost: Math.round(costPerPost),\n      cost_per_engagement: Math.round(costPerPost / (influencer.follower_count * influencer.engagement_rate / 100)),\n      campaign_id: `${campaignSettings.campaignName}_${Date.now()}`,\n      qualified_at: new Date().toISOString()\n    };\n  })\n  .sort((a, b) => b.score - a.score)\n  .slice(0, 20); // Top 20 influencers\n\nreturn qualifiedInfluencers;"
      },
      "typeVersion": 1
    },
    {
      "id": "8",
      "name": "筛选顶级网红",
      "type": "n8n-nodes-base.if",
      "position": [
        1040,
        300
      ],
      "parameters": {
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ $json.score }}",
              "rightValue": 70
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "9",
      "name": "生成外联内容",
      "type": "n8n-nodes-base.code",
      "position": [
        1240,
        300
      ],
      "parameters": {
        "jsCode": "// Generate personalized outreach email content\nconst influencer = $json;\nconst campaignSettings = $node['Campaign Settings'].json;\n\n// Create personalized subject line\nconst subjectLines = [\n  `Partnership Opportunity with ${campaignSettings.campaignName}`,\n  `Collaboration Proposal - ${influencer.platform.toUpperCase()} Creator`,\n  `Exciting Brand Partnership for ${influencer.username}`,\n  `${campaignSettings.campaignName} x ${influencer.username} - Let's Create Magic!`\n];\n\nconst randomSubject = subjectLines[Math.floor(Math.random() * subjectLines.length)];\n\n// Determine deliverables based on platform\nlet deliverables = [];\nif (influencer.platform === 'instagram') {\n  deliverables = ['1 Feed Post', '3 Stories', '1 Reel'];\n} else if (influencer.platform === 'tiktok') {\n  deliverables = ['1 Video Post', '2 Story Updates'];\n} else if (influencer.platform === 'youtube') {\n  deliverables = ['1 Sponsored Video', '1 Community Post'];\n}\n\n// Calculate campaign timeline\nconst startDate = new Date();\nconst endDate = new Date(startDate.getTime() + 14 * 24 * 60 * 60 * 1000); // 2 weeks\n\nreturn {\n  ...influencer,\n  outreach_subject: randomSubject,\n  deliverables: deliverables,\n  campaign_start: startDate.toISOString(),\n  campaign_end: endDate.toISOString(),\n  proposal_sent_at: new Date().toISOString()\n};"
      },
      "typeVersion": 1
    },
    {
      "id": "10",
      "name": "提取联系信息",
      "type": "n8n-nodes-base.code",
      "position": [
        1440,
        300
      ],
      "parameters": {
        "jsCode": "// Find or create influencer email\nconst influencer = $json;\nlet email = null;\n\n// Try to extract email from bio\nconst emailRegex = /\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b/;\nconst bioMatch = influencer.bio?.match(emailRegex);\n\nif (bioMatch) {\n  email = bioMatch[0];\n} else {\n  // Generate likely email patterns\n  const username = influencer.username.toLowerCase().replace(/[^a-z0-9]/g, '');\n  const possibleEmails = [\n    `${username}@gmail.com`,\n    `${username}@outlook.com`,\n    `${username}@yahoo.com`,\n    `contact@${username}.com`,\n    `hello@${username}.com`,\n    `${username}@${influencer.platform}.com`\n  ];\n  \n  // Use the first pattern as fallback\n  email = possibleEmails[0];\n}\n\nreturn {\n  ...influencer,\n  email: email,\n  email_verified: bioMatch ? true : false\n};"
      },
      "typeVersion": 1
    },
    {
      "id": "11",
      "name": "发送外联邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1640,
        300
      ],
      "parameters": {
        "sendTo": "={{ $json.email }}",
        "message": "=<!DOCTYPE html>\n<html>\n<head>\n  <style>\n    body { font-family: Arial, sans-serif; margin: 20px; background-color: #f8f9fa; }\n    .container { max-width: 600px; margin: 0 auto; background: white; padding: 30px; border-radius: 10px; }\n    .header { background: linear-gradient(45deg, #667eea, #764ba2); color: white; padding: 20px; text-align: center; margin: -30px -30px 30px -30px; border-radius: 10px 10px 0 0; }\n    .campaign-details { background: #e8f4f8; padding: 20px; margin: 20px 0; border-radius: 8px; }\n    .deliverables { background: #f8f9fa; padding: 15px; margin: 15px 0; border-radius: 5px; }\n    .compensation { background: #d4edda; padding: 15px; margin: 15px 0; border-radius: 5px; border-left: 4px solid #28a745; }\n    .cta { background: #007bff; color: white; padding: 15px 30px; text-decoration: none; border-radius: 5px; display: inline-block; margin: 20px 0; }\n    .stats { background: #fff3cd; padding: 15px; margin: 15px 0; border-radius: 5px; }\n  </style>\n</head>\n<body>\n  <div class=\"container\">\n    <div class=\"header\">\n      <h2>🤝 Partnership Opportunity</h2>\n      <p>We'd love to collaborate with you!</p>\n    </div>\n    \n    <p>Hi {{ $json.username }},</p>\n    \n    <p>We've been following your {{ $json.platform }} content and are impressed by your authentic engagement with your audience. We'd love to partner with you for our {{ $node['Campaign Settings'].json.campaignName }} campaign!</p>\n    \n    <div class=\"stats\">\n      <h3>📊 Why We Chose You</h3>\n      <p><strong>Engagement Rate:</strong> {{ $json.engagement_rate }}%</p>\n      <p><strong>Followers:</strong> {{ $json.follower_count.toLocaleString() }}</p>\n      <p><strong>Platform:</strong> {{ $json.platform.toUpperCase() }}</p>\n      <p><strong>Match Score:</strong> {{ $json.score }}/100</p>\n    </div>\n    \n    <div class=\"campaign-details\">\n      <h3>🎯 Campaign Details</h3>\n      <p><strong>Campaign:</strong> {{ $node['Campaign Settings'].json.campaignName }}</p>\n      <p><strong>Duration:</strong> {{ new Date($json.campaign_start).toLocaleDateString() }} - {{ new Date($json.campaign_end).toLocaleDateString() }}</p>\n      <p><strong>Target Audience:</strong> {{ $node['Campaign Settings'].json.targetAudience }}</p>\n    </div>\n    \n    <div class=\"deliverables\">\n      <h3>📝 What We're Looking For</h3>\n      <ul>\n        {{#each $json.deliverables}}\n        <li>{{ this }}</li>\n        {{/each}}\n      </ul>\n      <p><em>All content subject to approval, but we trust your creative vision!</em></p>\n    </div>\n    \n    <div class=\"compensation\">\n      <h3>💰 Compensation</h3>\n      <p><strong>Payment:</strong> ${{ $json.estimated_cost }} per campaign</p>\n      <p><strong>Cost per engagement:</strong> ${{ $json.cost_per_engagement }}</p>\n      <p><em>Payment processed within 7 days of content delivery</em></p>\n    </div>\n    \n    <div style=\"text-align: center;\">\n      <a href=\"mailto:{{ $node['Campaign Settings'].json.brandEmail }}?subject=Re: {{ $json.outreach_subject }}\" class=\"cta\">\n        💌 I'm Interested!\n      </a>\n    </div>\n    \n    <p>We're excited about the possibility of working together and would love to hear your thoughts!</p>\n    \n    <p style=\"color: #666; font-size: 14px; margin-top: 30px;\">\n      Best regards,<br>\n      {{ $node['Campaign Settings'].json.campaignName }} Team<br>\n      {{ $node['Campaign Settings'].json.brandEmail }}\n    </p>\n  </div>\n</body>\n</html>",
        "options": {
          "contentType": "html"
        },
        "subject": "={{ $json.outreach_subject }}"
      },
      "typeVersion": 1
    },
    {
      "id": "12",
      "name": "等待 3 天",
      "type": "n8n-nodes-base.wait",
      "position": [
        1840,
        300
      ],
      "parameters": {
        "unit": "days",
        "amount": 3
      },
      "typeVersion": 1
    },
    {
      "id": "13",
      "name": "发送跟进邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2040,
        300
      ],
      "parameters": {
        "sendTo": "={{ $json.email }}",
        "message": "=<!DOCTYPE html>\n<html>\n<head>\n  <style>\n    body { font-family: Arial, sans-serif; margin: 20px; background-color: #f8f9fa; }\n    .container { max-width: 600px; margin: 0 auto; background: white; padding: 30px; border-radius: 10px; }\n    .follow-up { background: #6f42c1; color: white; padding: 20px; text-align: center; margin: -30px -30px 30px -30px; border-radius: 10px 10px 0 0; }\n    .quick-recap { background: #e8f4f8; padding: 15px; margin: 15px 0; border-radius: 5px; }\n    .cta { background: #28a745; color: white; padding: 15px 30px; text-decoration: none; border-radius: 5px; display: inline-block; margin: 20px 0; }\n  </style>\n</head>\n<body>\n  <div class=\"container\">\n    <div class=\"follow-up\">\n      <h2>👋 Quick Follow-up</h2>\n      <p>Just checking in about our partnership opportunity</p>\n    </div>\n    \n    <p>Hi {{ $json.username }},</p>\n    \n    <p>I wanted to follow up on the collaboration opportunity I sent a few days ago. I know you probably get a lot of partnership requests, but I genuinely think this could be a great fit for your audience.</p>\n    \n    <div class=\"quick-recap\">\n      <h3>📋 Quick Recap</h3>\n      <p><strong>Campaign:</strong> {{ $node['Campaign Settings'].json.campaignName }}</p>\n      <p><strong>Compensation:</strong> ${{ $json.estimated_cost }}</p>\n      <p><strong>Timeline:</strong> 2 weeks</p>\n      <p><strong>Deliverables:</strong> {{ $json.deliverables.join(', ') }}</p>\n    </div>\n    \n    <p>Would you be interested in a quick 15-minute call to discuss this further? I'm flexible with timing and would love to answer any questions you might have.</p>\n    \n    <div style=\"text-align: center;\">\n      <a href=\"mailto:{{ $node['Campaign Settings'].json.brandEmail }}?subject=Re: {{ $json.outreach_subject }}\" class=\"cta\">\n        📞 Let's Chat\n      </a>\n    </div>\n    \n    <p>Thanks for considering, and I look forward to hearing from you!</p>\n    \n    <p style=\"color: #666; font-size: 14px; margin-top: 30px;\">\n      Best,<br>\n      {{ $node['Campaign Settings'].json.campaignName }} Team\n    </p>\n  </div>\n</body>\n</html>",
        "options": {
          "contentType": "html"
        },
        "subject": "Following up on our collaboration opportunity"
      },
      "typeVersion": 1
    },
    {
      "id": "14",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1940,
        160
      ],
      "parameters": {
        "width": 240,
        "height": 160,
        "content": "## 活动跟踪"
      },
      "typeVersion": 1
    },
    {
      "id": "15",
      "name": "跟踪活动进度",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1640,
        450
      ],
      "parameters": {
        "values": {
          "values": [
            "={{ $json.campaign_id }}",
            "={{ $json.username }}",
            "={{ $json.platform }}",
            "={{ $json.follower_count }}",
            "={{ $json.engagement_rate }}",
            "={{ $json.score }}",
            "={{ $json.estimated_cost }}",
            "={{ $json.email }}",
            "={{ $json.proposal_sent_at }}",
            "pending_response"
          ]
        },
        "resource": "sheet",
        "operation": "appendRow",
        "sheetName": "Influencer Outreach Tracking",
        "documentId": "your-google-sheet-id"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Wait 3 Days": {
      "main": [
        [
          {
            "node": "Send Follow-up Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Campaign Settings": {
      "main": [
        [
          {
            "node": "Search Instagram Influencers",
            "type": "main",
            "index": 0
          },
          {
            "node": "Search TikTok Influencers",
            "type": "main",
            "index": 0
          },
          {
            "node": "Search YouTube Influencers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Outreach Email": {
      "main": [
        [
          {
            "node": "Wait 3 Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Contact Info": {
      "main": [
        [
          {
            "node": "Send Outreach Email",
            "type": "main",
            "index": 0
          },
          {
            "node": "Track Campaign Progress",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Campaign Brief Webhook": {
      "main": [
        [
          {
            "node": "Campaign Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Top Influencers": {
      "main": [
        [
          {
            "node": "Generate Outreach Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Outreach Content": {
      "main": [
        [
          {
            "node": "Extract Contact Info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search TikTok Influencers": {
      "main": [
        [
          {
            "node": "Score & Qualify Influencers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search YouTube Influencers": {
      "main": [
        [
          {
            "node": "Score & Qualify Influencers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Score & Qualify Influencers": {
      "main": [
        [
          {
            "node": "Filter Top Influencers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Instagram Influencers": {
      "main": [
        [
          {
            "node": "Score & Qualify Influencers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 社交媒体, AI 摘要总结

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流