8
n8n 中文网amn8n.com

影响者每日建议

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 10 个节点。主要使用 Code, Gmail, ManualTrigger, ChainLlm, LmChatAzureOpenAi 等节点。 使用GPT-4o-mini和Gmail投递为影响者生成LinkedIn内容创意

前置要求
  • Google 账号和 Gmail API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "4Mr57mBTiQiphFDX",
  "meta": {
    "instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177",
    "templateCredsSetupCompleted": true
  },
  "name": "影响者每日建议",
  "tags": [
    {
      "id": "HE1ilnFaryfUZjCN",
      "name": "LinkedIn Automation",
      "createdAt": "2025-08-07T12:32:17.084Z",
      "updatedAt": "2025-08-07T12:32:17.084Z"
    }
  ],
  "nodes": [
    {
      "id": "47228c55-bd7e-459f-93ea-5c4185c4863f",
      "name": "处理并识别热门话题",
      "type": "n8n-nodes-base.code",
      "position": [
        592,
        -128
      ],
      "parameters": {
        "jsCode": "// Advanced Professional LinkedIn Trending Topics Report Generator\n// Enhanced with Outlook compatibility for consistent email rendering\n\nconst items = $input.all();\nconst currentDate = new Date().toLocaleDateString('en-US', {\n  weekday: 'long',\n  year: 'numeric',\n  month: 'long',\n  day: 'numeric'\n});\n\nconst currentTime = new Date().toLocaleTimeString('en-US', {\n  hour: '2-digit',\n  minute: '2-digit',\n  timeZoneName: 'short'\n});\n\n// Extract trending topics from input with enhanced error handling\nlet trendingTopics = [];\ntry {\n  if (items[0]?.json?.text) {\n    const jsonMatch = items[0].json.text.match(/```json(.+?)```/s);\n    if (jsonMatch && jsonMatch[1]) {\n      trendingTopics = JSON.parse(jsonMatch[1].trim());\n    }\n  } else if (items[0]?.json && Array.isArray(items[0].json)) {\n    trendingTopics = items[0].json;\n  } else if (Array.isArray(items)) {\n    trendingTopics = items.map(item => item.json);\n  }\n} catch (error) {\n  console.error('Error parsing trending topics:', error);\n  trendingTopics = [];\n}\n\n// Generate hashtags function\nconst generateHashtags = (title, description) => {\n  const text = (title + ' ' + description).toLowerCase();\n  const stopWords = ['the', 'a', 'an', 'and', 'or', 'but', 'in', 'on', 'at', 'to', 'for', 'of', 'with', 'by'];\n  \n  const industryHashtags = {\n    'ai|artificial intelligence|machine learning|ml': ['#AI', '#MachineLearning', '#ArtificialIntelligence', '#TechInnovation'],\n    'remote work|wfh|work from home|hybrid': ['#RemoteWork', '#WFH', '#HybridWork', '#DigitalNomad', '#FlexibleWork'],\n    'leadership|management|executive': ['#Leadership', '#Management', '#ExecutiveInsights', '#LeadershipDevelopment'],\n    'data|analytics|big data|data science': ['#Data', '#DataScience', '#Analytics', '#BigData', '#DataDriven'],\n    'marketing|digital marketing|brand': ['#Marketing', '#DigitalMarketing', '#Branding', '#ContentMarketing'],\n    'startup|entrepreneur|innovation': ['#Startup', '#Entrepreneur', '#Innovation', '#Entrepreneurship'],\n    'mental health|wellness|wellbeing': ['#MentalHealth', '#Wellness', '#WorkLifeBalance', '#EmployeeWellbeing'],\n    'diversity|inclusion|dei': ['#Diversity', '#Inclusion', '#DEI', '#WorkplaceCulture'],\n    'finance|fintech|investment': ['#Finance', '#FinTech', '#Investment', '#FinancialTech'],\n    'sales|revenue|growth': ['#Sales', '#SalesStrategy', '#RevenueGrowth', '#BusinessDevelopment'],\n    'customer|client|service': ['#CustomerExperience', '#CustomerSuccess', '#ClientService'],\n    'technology|tech|digital transformation': ['#Technology', '#Tech', '#DigitalTransformation', '#TechTrends'],\n    'team|collaboration|workplace': ['#Teamwork', '#Collaboration', '#WorkplaceCulture', '#TeamBuilding'],\n    'skill|training|learning|development': ['#SkillDevelopment', '#Learning', '#ProfessionalDevelopment', '#Training'],\n    'productivity|efficiency|automation': ['#Productivity', '#Efficiency', '#Automation', '#WorkSmart']\n  };\n  \n  let hashtags = new Set(['#LinkedIn', '#Professional']);\n  \n  Object.entries(industryHashtags).forEach(([pattern, tags]) => {\n    const regex = new RegExp(pattern, 'i');\n    if (regex.test(text)) {\n      tags.forEach(tag => hashtags.add(tag));\n    }\n  });\n  \n  const titleWords = title.split(/[\\s\\-_]+/)\n    .filter(word => word.length > 3 && !stopWords.includes(word.toLowerCase()))\n    .slice(0, 3);\n    \n  titleWords.forEach(word => {\n    const cleanWord = word.replace(/[^\\w]/g, '');\n    if (cleanWord.length > 2) {\n      hashtags.add('#' + cleanWord.charAt(0).toUpperCase() + cleanWord.slice(1).toLowerCase());\n    }\n  });\n  \n  return Array.from(hashtags).slice(0, 10).join(' ');\n};\n\n// Calculate engagement potential score\nconst calculateEngagementScore = (topic) => {\n  const text = (topic.title + ' ' + topic.description).toLowerCase();\n  let score = 50; // Base score\n  \n  const highEngagementWords = ['ai', 'future', 'trend', 'innovation', 'success', 'growth', 'leadership', 'strategy'];\n  highEngagementWords.forEach(word => {\n    if (text.includes(word)) score += 10;\n  });\n  \n  if (topic.description.length > 100 && topic.description.length < 300) score += 15;\n  \n  if (topic.title.split(' ').length >= 3 && topic.title.split(' ').length <= 8) score += 10;\n  \n  return Math.min(100, score);\n};\n\n// Generate the Outlook-compatible HTML report\nconst htmlReport = `\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>LinkedIn Trending Topics Report</title>\n    <!--[if mso]>\n    <noscript>\n        <xml>\n            <o:OfficeDocumentSettings>\n                <o:AllowPNG/>\n                <o:PixelsPerInch>96</o:PixelsPerInch>\n            </o:OfficeDocumentSettings>\n        </xml>\n    </noscript>\n    <![endif]-->\n    <style type=\"text/css\">\n        /* Reset and base styles */\n        body, table, td, p, a, li, blockquote {\n            -webkit-text-size-adjust: 100%;\n            -ms-text-size-adjust: 100%;\n        }\n        \n        table, td {\n            mso-table-lspace: 0pt;\n            mso-table-rspace: 0pt;\n            border-collapse: collapse !important;\n        }\n        \n        body {\n            margin: 0 !important;\n            padding: 0 !important;\n            background-color: #f5f7fa;\n            font-family: Arial, sans-serif;\n            font-size: 14px;\n            line-height: 1.4;\n            color: #333333;\n        }\n        \n        /* Outlook-specific fixes */\n        .outlook-group-fix {\n            width: 100% !important;\n        }\n        \n        /* Main container */\n        .email-container {\n            max-width: 650px;\n            margin: 0 auto;\n            background-color: #ffffff;\n        }\n        \n        /* Header styles */\n        .header {\n            background-color: #0077b5;\n            padding: 30px 20px;\n            text-align: center;\n        }\n        \n        .header h1 {\n            margin: 0 0 10px 0;\n            color: #ffffff;\n            font-size: 28px;\n            font-weight: bold;\n            line-height: 1.2;\n        }\n        \n        .header-subtitle {\n            margin: 0 0 10px 0;\n            color: #ffffff;\n            font-size: 16px;\n            opacity: 0.9;\n        }\n        \n        .header-time {\n            margin: 0;\n            color: #ffffff;\n            font-size: 14px;\n            opacity: 0.8;\n        }\n        \n        /* Stats section */\n        .stats-section {\n            padding: 20px;\n            background-color: #ffffff;\n        }\n        \n        .stats-table {\n            width: 100%;\n            border-collapse: collapse;\n        }\n        \n        .stat-cell {\n            width: 25%;\n            padding: 15px;\n            text-align: center;\n            background-color: #f8f9fa;\n            border: 1px solid #e9ecef;\n            vertical-align: top;\n        }\n        \n        .stat-number {\n            display: block;\n            font-size: 24px;\n            font-weight: bold;\n            color: #0077b5;\n            margin-bottom: 5px;\n            line-height: 1.1;\n        }\n        \n        .stat-label {\n            color: #666666;\n            font-size: 12px;\n            font-weight: normal;\n            margin: 0;\n        }\n        \n        /* Content section */\n        .content-section {\n            padding: 20px;\n            background-color: #ffffff;\n        }\n        \n        /* Main data table */\n        .data-table {\n            width: 100%;\n            border-collapse: collapse;\n            margin: 0;\n        }\n        \n        .data-table th {\n            background-color: #0077b5;\n            color: #ffffff;\n            padding: 12px 8px;\n            text-align: left;\n            font-weight: bold;\n            font-size: 13px;\n            border: 1px solid #005b8c;\n        }\n        \n        .data-table td {\n            padding: 12px 8px;\n            border: 1px solid #e9ecef;\n            vertical-align: top;\n            font-size: 13px;\n            line-height: 1.4;\n        }\n        \n        .data-table tr:nth-child(even) td {\n            background-color: #f8f9fa;\n        }\n        \n        .topic-rank {\n            display: inline-block;\n            background-color: #e3f2fd;\n            color: #0077b5;\n            padding: 3px 8px;\n            font-size: 11px;\n            font-weight: bold;\n            border-radius: 3px;\n            margin-right: 5px;\n        }\n        \n        .topic-title {\n            font-weight: bold;\n            color: #005b8c;\n            margin: 0 0 5px 0;\n        }\n        \n        .engagement-score {\n            display: inline-block;\n            background-color: #e6f7ee;\n            color: #28a745;\n            padding: 3px 8px;\n            font-size: 11px;\n            font-weight: bold;\n            border-radius: 3px;\n            margin-top: 8px;\n        }\n        \n        .hashtags {\n            font-size: 12px;\n            color: #666666;\n            line-height: 1.3;\n            word-break: break-word;\n        }\n        \n        /* Footer */\n        .footer {\n            background-color: #f8f9fa;\n            padding: 20px;\n            text-align: center;\n            color: #666666;\n            font-size: 13px;\n        }\n        \n        /* Mobile responsiveness */\n        @media only screen and (max-width: 600px) {\n            .email-container {\n                width: 100% !important;\n                max-width: 100% !important;\n            }\n            \n            .header h1 {\n                font-size: 24px !important;\n            }\n            \n            .stat-cell {\n                width: 50% !important;\n                display: block !important;\n            }\n            \n            .data-table th,\n            .data-table td {\n                padding: 8px 5px !important;\n                font-size: 12px !important;\n            }\n        }\n    </style>\n</head>\n<body>\n    <!-- Main container table -->\n    <table role=\"presentation\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n        <tr>\n            <td align=\"center\" style=\"padding: 20px 0; background-color: #f5f7fa;\">\n                \n                <!-- Email container -->\n                <table role=\"presentation\" class=\"email-container\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"650\" style=\"max-width: 650px;\">\n                    \n                    <!-- Header -->\n                    <tr>\n                        <td class=\"header\">\n                            <h1>📊 LinkedIn Trends Report</h1>\n                            <p class=\"header-subtitle\">Professional insights in structured format</p>\n                            <p class=\"header-time\">${currentDate} • Generated at ${currentTime}</p>\n                        </td>\n                    </tr>\n                    \n                    <!-- Stats Section -->\n                    <tr>\n                        <td class=\"stats-section\">\n                            <table role=\"presentation\" class=\"stats-table\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n                                <tr>\n                                    <td class=\"stat-cell\">\n                                        <span class=\"stat-number\">${trendingTopics.length}</span>\n                                        <p class=\"stat-label\">Trending Topics</p>\n                                    </td>\n                                    <td class=\"stat-cell\">\n                                        <span class=\"stat-number\">${Math.round(trendingTopics.reduce((acc, topic) => acc + calculateEngagementScore(topic), 0) / trendingTopics.length)}%</span>\n                                        <p class=\"stat-label\">Avg Engagement</p>\n                                    </td>\n                                    <td class=\"stat-cell\">\n                                        <span class=\"stat-number\">${trendingTopics.length * 10}+</span>\n                                        <p class=\"stat-label\">Hashtags</p>\n                                    </td>\n                                    <td class=\"stat-cell\">\n                                        <span class=\"stat-number\">100%</span>\n                                        <p class=\"stat-label\">Ready to Use</p>\n                                    </td>\n                                </tr>\n                            </table>\n                        </td>\n                    </tr>\n                    \n                    <!-- Content Section -->\n                    <tr>\n                        <td class=\"content-section\">\n                            <table role=\"presentation\" class=\"data-table\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n                                <thead>\n                                    <tr>\n                                        <th width=\"8%\">Rank</th>\n                                        <th width=\"25%\">Topic</th>\n                                        <th width=\"35%\">Description</th>\n                                        <th width=\"32%\">Hashtags</th>\n                                    </tr>\n                                </thead>\n                                <tbody>\n                                    ${trendingTopics.map((topic, index) => {\n                                        const hashtags = generateHashtags(topic.title, topic.description);\n                                        const engagementScore = calculateEngagementScore(topic);\n                                        \n                                        return `\n                                        <tr>\n                                            <td align=\"center\">\n                                                <span class=\"topic-rank\">#${index + 1}</span>\n                                            </td>\n                                            <td>\n                                                <p class=\"topic-title\">${topic.title}</p>\n                                            </td>\n                                            <td>\n                                                ${topic.description}\n                                                <div class=\"engagement-score\">${engagementScore}% Engagement</div>\n                                            </td>\n                                            <td>\n                                                <div class=\"hashtags\">${hashtags}</div>\n                                            </td>\n                                        </tr>\n                                        `;\n                                    }).join('')}\n                                </tbody>\n                            </table>\n                        </td>\n                    </tr>\n                    \n                    <!-- Footer -->\n                    <tr>\n                        <td class=\"footer\">\n                            <p>🤖 Automated LinkedIn Intelligence System • Generated on ${currentDate}</p>\n                        </td>\n                    </tr>\n                    \n                </table>\n                \n            </td>\n        </tr>\n    </table>\n</body>\n</html>\n`;\n\n// Enhanced email subject with personalization\nconst emailSubject = `📊 ${trendingTopics.length} LinkedIn Trends - Structured Report ${currentDate}`;\n\n// Enhanced summary with engagement metrics\nconst topicsSummary = trendingTopics.map((topic, index) => \n  `${index + 1}. ${topic.title} (${calculateEngagementScore(topic)}% engagement)`\n).join('\\n');\n\n// Return comprehensive data package\nreturn [{\n  json: {\n    email_html: htmlReport,\n    email_subject: emailSubject,\n    topics_summary: topicsSummary,\n    topics_count: trendingTopics.length,\n    generation_date: new Date().toISOString(),\n    average_engagement_score: Math.round(trendingTopics.reduce((acc, topic) => acc + calculateEngagementScore(topic), 0) / trendingTopics.length),\n    total_hashtags: trendingTopics.length * 10,\n    trending_topics: trendingTopics.map((topic, index) => ({\n      ...topic,\n      engagement_score: calculateEngagementScore(topic),\n      rank: index + 1,\n      hashtags: generateHashtags(topic.title, topic.description),\n      content_suggestion: topic.description.length > 200 ? topic.description.substring(0, 200) + '...' : topic.description\n    }))\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "adab755d-3887-4773-9fdb-d772506fef71",
      "name": "基础LLM链",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        208,
        -240
      ],
      "parameters": {
        "text": "=Fetch the latest trending topics from LinkedIn along with a short, relevant description for each topic. Return the results as an array of objects, where each object contains a `title` and `description`. Ensure the topics are current, professional, and suitable for a business or corporate audience.\n",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "You are an AI assistant integrated into an automation workflow designed to extract trending professional topics from LinkedIn. Your task is to return a list of 3–5 currently trending LinkedIn topics, each with a brief but informative description (1–2 sentences). These results will be used in a later step to generate a formatted newsletter email for professionals. Ensure the language is clear, concise, and professional."
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "3f0985b6-926d-4cdf-ade6-653cec0c5b50",
      "name": "Azure OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        336,
        -16
      ],
      "parameters": {
        "model": "gpt-4o-mini",
        "options": {}
      },
      "credentials": {
        "azureOpenAiApi": {
          "id": "C3WzT18XqF8OdVM6",
          "name": "Azure Open AI account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0d3852aa-ace4-49bb-80ff-b30734ed63af",
      "name": "当点击“执行工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -64,
        -80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c3f5df3f-80a2-4c4b-be02-a513c636e98d",
      "name": "发送每日报告邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        864,
        -128
      ],
      "parameters": {
        "toList": [
          "vivek.patidar@techdome.net.in"
        ],
        "message": "Linkedin Report",
        "subject": "=LinkedIn Report",
        "resource": "message",
        "htmlMessage": "={{ $json.email_html }}",
        "includeHtml": true,
        "additionalFields": {}
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "gEIaWCTvGfYjMSb3",
          "name": "Gmail credentials"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ed694b5e-7459-44bb-ac07-cf932155470d",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        592,
        -400
      ],
      "parameters": {
        "height": 256,
        "content": "将 AI 生成的主题转换为专业的 HTML 邮件报告。"
      },
      "typeVersion": 1
    },
    {
      "id": "a09844ee-68e7-4432-b687-86fce5fe7531",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        64,
        -512
      ],
      "parameters": {
        "color": 6,
        "height": 240,
        "content": "处理当前市场数据以识别 LinkedIn 热门话题。"
      },
      "typeVersion": 1
    },
    {
      "id": "1329a8eb-038a-4734-9199-67901e8c97b4",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        -368
      ],
      "parameters": {
        "color": 3,
        "height": 224,
        "content": "通过邮件发送专业格式的热门话题报告。"
      },
      "typeVersion": 1
    },
    {
      "id": "895e14da-77f0-453e-92ae-3d28bd75aba4",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        -288
      ],
      "parameters": {
        "color": 3,
        "height": 208,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "100757f0-63ec-4d48-abac-686169a9316e",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        128
      ],
      "parameters": {
        "color": 2,
        "height": 240,
        "content": "为企业级 AI 处理提供 LLM Chain 支持。"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d01ed6ff-a30e-4156-add5-025a40d51e8b",
  "connections": {
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Process and Identify Top Topics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Process and Identify Top Topics": {
      "main": [
        [
          {
            "node": "Send Daily Report Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 内容创作, 多模态 AI

需要付费吗?

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

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

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

作者
Rahul Joshi

Rahul Joshi

@rahul08

Rahul Joshi is a seasoned technology leader specializing in the n8n automation tool and AI-driven workflow automation. With deep expertise in building open-source workflow automation and self-hosted automation platforms, he helps organizations eliminate manual processes through intelligent n8n ai agent automation solutions.

外部链接
在 n8n.io 查看

分享此工作流