This workflow corresponds to n8n.io template #7277 — we link there as the canonical source.
This workflow follows the Chainllm → Gmail recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "4Mr57mBTiQiphFDX",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Influencer daily suggestion",
"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": "Process and Identify Top Topics",
"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>\ud83d\udcca LinkedIn Trends Report</h1>\n <p class=\"header-subtitle\">Professional insights in structured format</p>\n <p class=\"header-time\">${currentDate} \u2022 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>\ud83e\udd16 Automated LinkedIn Intelligence System \u2022 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 = `\ud83d\udcca ${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": "Basic LLM Chain",
"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\u20135 currently trending LinkedIn topics, each with a brief but informative description (1\u20132 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 Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
"position": [
336,
-16
],
"parameters": {
"model": "gpt-4o-mini",
"options": {}
},
"credentials": {
"azureOpenAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "0d3852aa-ace4-49bb-80ff-b30734ed63af",
"name": "When clicking \u2018Execute workflow\u2019",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-64,
-80
],
"parameters": {},
"typeVersion": 1
},
{
"id": "c3f5df3f-80a2-4c4b-be02-a513c636e98d",
"name": "Send Daily Report Email",
"type": "n8n-nodes-base.gmail",
"position": [
864,
-128
],
"parameters": {
"toList": [
"user@example.com"
],
"message": "Linkedin Report",
"subject": "=LinkedIn Report",
"resource": "message",
"htmlMessage": "={{ $json.email_html }}",
"includeHtml": true,
"additionalFields": {}
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "ed694b5e-7459-44bb-ac07-cf932155470d",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
592,
-400
],
"parameters": {
"height": 256,
"content": "Transforms AI-generated topics into professional HTML email reports.\nFeatures: Dynamic hashtag generation, engagement scoring, visual styling.\nCreates: Ready-to-post content snippets, strategic hashtags, professional layouts.\nOutput: Complete HTML email with embedded analytics and user-friendly design."
},
"typeVersion": 1
},
{
"id": "a09844ee-68e7-4432-b687-86fce5fe7531",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
64,
-512
],
"parameters": {
"color": 6,
"height": 240,
"content": "Processes current market data to identify trending LinkedIn topics.\n\nAnalyzes engagement patterns, content themes, and professional discussions.\nOutputs: Structured JSON with topic titles, descriptions, and relevance scores.\n\nModel: Optimized for business/professional content analysis."
},
"typeVersion": 1
},
{
"id": "1329a8eb-038a-4734-9199-67901e8c97b4",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
944,
-368
],
"parameters": {
"color": 3,
"height": 224,
"content": "Sends professionally formatted trending topics report via email.\nIncludes: Interactive content, copy-paste ready posts, engagement metrics.\nRecipients: Stakeholders, content teams, marketing professionals.\nTiming: Configurable for optimal delivery windows (morning preferred)."
},
"typeVersion": 1
},
{
"id": "895e14da-77f0-453e-92ae-3d28bd75aba4",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-256,
-288
],
"parameters": {
"color": 3,
"height": 208,
"content": "\nManually starts the LinkedIn trending topics analysis workflow.\n \nUse this to test the workflow or run ad-hoc reports.\n\nPerfect for initial setup and troubleshooting."
},
"typeVersion": 1
},
{
"id": "100757f0-63ec-4d48-abac-686169a9316e",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
144,
128
],
"parameters": {
"color": 2,
"height": 240,
"content": "Powers the LLM Chain with enterprise-grade AI processing.\nConfigured for: Professional content analysis, trend identification.\nHandles: Natural language processing, content categorization, sentiment analysis.\nEnsures consistent, high-quality topic extraction and insights."
},
"typeVersion": 1
}
],
"active": false,
"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 \u2018Execute workflow\u2019": {
"main": [
[
{
"node": "Basic LLM Chain",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
azureOpenAiApigmailOAuth2
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Description
Source: https://n8n.io/workflows/7277/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow automates the candidate rejection process after interviews. It retrieves interview feedback from Google Sheets, uses AI to structure and score candidate data, applies a scoring threshold
This workflow automates personalized candidate communication for both shortlisted and rejected applicants. It fetches candidate details, processes resumes, checks for errors, and uses GPT-4o to genera
This workflow automates Zendesk ticket handling with AI-powered auto-replies. It pulls in new support tickets, checks against a Google Sheets FAQ database, and generates accurate responses using GPT-4
This workflow automates employee retention analytics by combining candidate performance data with trait-level retention statistics. It scores candidates, validates data, and generates a polished Reten
Description: Automate your personal email management with this AI-powered inbox triage system built entirely in n8n. This template connects Gmail, Azure OpenAI (GPT-4o-mini), and Notion to classify, s