This workflow corresponds to n8n.io template #16551 — we link there as the canonical source.
This workflow follows the Agent → 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 →
{
"meta": {
"builderVariant": "mcp",
"aiBuilderAssisted": true
},
"nodes": [
{
"id": "8059abb2-4606-45b2-9452-6b1757fc6d7b",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2128,
-112
],
"parameters": {
"width": 480,
"height": 768,
"content": "## Untitled workflow\n\n### How it works\n\nThis workflow runs every day at 8 AM, selects a topic, researches it with Tavily, and uses a Groq-powered AI agent to draft a LinkedIn post. It then builds a Pollinations.ai image URL, attempts to download the generated image, and emails the finished post to the user either with the image attached or through a no-image fallback path.\n\n### Setup steps\n\n- Configure the schedule trigger for the desired timezone and run time.\n- Add credentials or API keys for Tavily Search and Groq Chat Model.\n- Configure the Gmail nodes with the sender account and recipient email address.\n- Review the topic-selection code and Pollinations.ai image URL generation code to ensure prompts and parameters match your needs.\n\n### Customization\n\nUpdate the topic list, Tavily search parameters, AI agent instructions, image prompt construction, and Gmail message templates to change the content style or delivery format."
},
"typeVersion": 1
},
{
"id": "ff79cc1e-31ff-43c0-9019-77f59d41faf8",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1568,
-64
],
"parameters": {
"color": 7,
"width": 624,
"height": 304,
"content": "## Select and research topic\n\nStarts the daily run, chooses the day's topic, and queries Tavily for fresh research context before content generation."
},
"typeVersion": 1
},
{
"id": "3c44a434-fa02-478b-b9f5-e809a8e359a9",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-912,
-96
],
"parameters": {
"color": 7,
"width": 464,
"height": 544,
"content": "## Generate LinkedIn post\n\nUses the LinkedIn Post Agent with the connected Groq chat model to turn the researched topic into a draft LinkedIn post."
},
"typeVersion": 1
},
{
"id": "b1279157-1b68-4ea6-a773-cf289e626501",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-256,
-112
],
"parameters": {
"color": 7,
"width": 432,
"height": 432,
"content": "## Create and download image\n\nBuilds a Pollinations.ai image URL from the generated content and attempts to download the resulting image asset."
},
"typeVersion": 1
},
{
"id": "fc75d6bc-dd35-437d-9f97-6418b8dfbed0",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
208,
0
],
"parameters": {
"color": 7,
"width": 512,
"height": 432,
"content": "## Email final post\n\nSends the completed LinkedIn post to the user, either with the generated image attached or via a fallback email when no image is available."
},
"typeVersion": 1
},
{
"id": "4d725a49-54bb-4afb-9e92-233b66b82a05",
"name": "When 8 AM Daily",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-1520,
64
],
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 8 * * *"
}
]
}
},
"typeVersion": 1.3
},
{
"id": "31f9cadf-f23e-4ec4-b933-ec1a36c17e21",
"name": "Select Daily Topic",
"type": "n8n-nodes-base.code",
"position": [
-1296,
64
],
"parameters": {
"jsCode": "const topics = [\n 'AI tools that boost productivity',\n 'Lessons learned from automating workflows',\n 'The future of remote work and AI',\n 'Personal branding tips for professionals',\n 'Cybersecurity habits everyone should build',\n 'How no-code tools are changing tech careers',\n 'Mistakes people make early in their career'\n];\n\nconst now = new Date();\nconst start = new Date(now.getFullYear(), 0, 0);\nconst diff = now - start;\nconst oneDay = 1000 * 60 * 60 * 24;\nconst dayOfYear = Math.floor(diff / oneDay);\n\nconst todayTopic = topics[dayOfYear % topics.length];\n\nreturn [{\n json: {\n topic: todayTopic,\n date: now.toISOString().split('T')[0]\n }\n}];"
},
"typeVersion": 2
},
{
"id": "1e949ff9-19bc-4d8f-93cf-230b4070cd04",
"name": "Define LinkedIn Strategy Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-752,
64
],
"parameters": {
"text": "=Write a powerful, engaging LinkedIn post about this topic: {{ $('Pick Today\\'s Topic').item.json.topic }}.\n\nHere are current web search results to ground the post in real, up-to-date information:\n{{ JSON.stringify($json.results || $json) }}\n\nRequirements for the post:\n- Strong hook in the very first line (max 12 words)\n- 3 to 6 short paragraphs, each 1 to 3 lines, written in a natural human tone\n- Use line breaks generously (LinkedIn style)\n- Weave in one relevant fact, statistic, or insight from the search results above\n- End with a question to spark comments\n- Add a maximum of 3 relevant hashtags at the very end\n- Use 2 to 4 emojis maximum, not excessive\n- Keep total length between 150 and 250 words\n\nAlso provide a short one-sentence visual description for an image generator describing a clean, professional, modern illustration concept related to the topic, with no text in the image.\n\nRespond with ONLY a raw JSON object in exactly this format, with no markdown formatting, no code fences, and no extra commentary before or after it:\n{ \"post_text\": \"the full linkedin post text here, with \\\\n for line breaks\", \"image_prompt\": \"a short visual description for an image generator, no text in image\" }",
"options": {
"maxIterations": 5,
"systemMessage": "You are an expert LinkedIn ghostwriter who writes high-engagement, scroll-stopping posts. You are given current web search results directly in the prompt to ground your writing in real information rather than generic statements. Use at least one relevant current fact, trend, or statistic from those results. Write in a natural, human, slightly informal tone. You must respond with ONLY a single valid JSON object matching the requested format \u2014 no markdown code fences, no explanation, no text outside the JSON."
},
"promptType": "define"
},
"typeVersion": 3.1
},
{
"id": "cbbf449a-92ff-49ba-afe4-a9946caf711f",
"name": "Generate Image URL",
"type": "n8n-nodes-base.code",
"onError": "continueErrorOutput",
"position": [
-208,
160
],
"parameters": {
"jsCode": "let parsed;\ntry {\n const raw = String($json.output || '').replace(/```json\\n?|```/g, '').trim();\n parsed = JSON.parse(raw);\n} catch (e) {\n parsed = {\n post_text: String($json.output || '').trim(),\n image_prompt: 'professional minimalist business illustration'\n };\n}\n\nconst prompt = (parsed && parsed.image_prompt) || 'professional minimalist business illustration';\nconst encodedPrompt = encodeURIComponent(prompt + ', high quality, professional, clean, no text, no watermark');\nconst imageUrl = `https://image.pollinations.ai/prompt/${encodedPrompt}?width=1024&height=1024&nologo=true`;\n\nreturn [{\n json: {\n post_text: parsed.post_text,\n image_prompt: parsed.image_prompt,\n image_url: imageUrl,\n topic: $('Pick Today\\'s Topic').item.json.topic,\n date: $('Pick Today\\'s Topic').item.json.date\n }\n}];"
},
"typeVersion": 2
},
{
"id": "3a16005c-908a-409b-b7f3-bbd44b4aceac",
"name": "Fetch Image from URL",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueErrorOutput",
"position": [
32,
48
],
"parameters": {
"url": "={{ $json.image_url }}",
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
}
},
"typeVersion": 4.4
},
{
"id": "c73616f5-1d75-4c33-8aee-4cd0f6e07fc5",
"name": "Groq Conversational Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGroq",
"position": [
-832,
304
],
"parameters": {
"model": "llama-3.3-70b-versatile",
"options": {}
},
"credentials": {
"groqApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "e8f4a316-bc05-4305-bc97-9cef44057af0",
"name": "Send Email with Image",
"type": "n8n-nodes-base.gmail",
"position": [
576,
160
],
"parameters": {
"sendTo": "user@example.com",
"message": "=<div style=\"font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto; line-height: 1.6;\">\n <h2 style=\"color: #0a66c2;\">Today's Topic: {{ $('Generate Image URL').item.json.topic }}</h2>\n <p style=\"white-space: pre-line; background:#f3f6f8; padding: 16px; border-radius: 8px;\">{{ $('Generate Image URL').item.json.post_text }}</p>\n <p style=\"color:#666; font-size: 13px;\">This post was researched and written by an AI agent using live web search. Image is attached below. Review both, then post manually to LinkedIn.</p>\n</div>",
"options": {
"attachmentsUi": {
"attachmentsBinary": [
{}
]
}
},
"subject": "=Your LinkedIn Post for {{ $('Generate Image URL').item.json.date }} \u2014 Ready to Review"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.2
},
{
"id": "698698c8-9809-4f26-a6e3-a1b3ac9d4bdb",
"name": "Send Email No Image Fallback",
"type": "n8n-nodes-base.gmail",
"position": [
256,
272
],
"parameters": {
"sendTo": "user@example.com",
"message": "=<div style=\"font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto; line-height: 1.6;\">\n <h2 style=\"color: #d93025;\">\u26a0\ufe0f Image generation failed \u2014 here's your post text</h2>\n <p style=\"color:#666; font-size: 13px;\">The image step timed out or failed, so this is a fallback with text only. You can generate an image manually using the prompt below.</p>\n <p style=\"white-space: pre-line; background:#f3f6f8; padding: 16px; border-radius: 8px;\">{{ $('Generate Image URL').item.json.post_text }}</p>\n <h3>Image Prompt (for manual generation):</h3>\n <p style=\"background:#fff7e6; padding: 12px; border-radius: 8px; font-style: italic;\">{{ $('Generate Image URL').item.json.image_prompt }}</p>\n</div>",
"options": {},
"subject": "=Your LinkedIn Post for {{ $now.format('yyyy-MM-dd') }} \u2014 Image generation failed, text only"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.2
},
{
"id": "b662bb26-81d6-4867-8162-3e04bba7b455",
"name": "Post to Tavily API",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1088,
64
],
"parameters": {
"url": "https://api.tavily.com/search",
"method": "POST",
"options": {},
"jsonBody": "={\n \"query\": \"{{ $json.topic }}\",\n \"max_results\": 5,\n \"search_depth\": \"basic\"\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.4
}
],
"connections": {
"When 8 AM Daily": {
"main": [
[
{
"node": "Select Daily Topic",
"type": "main",
"index": 0
}
]
]
},
"Generate Image URL": {
"main": [
[
{
"node": "Fetch Image from URL",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Email No Image Fallback",
"type": "main",
"index": 0
}
]
]
},
"Post to Tavily API": {
"main": [
[
{
"node": "Define LinkedIn Strategy Agent",
"type": "main",
"index": 0
}
]
]
},
"Select Daily Topic": {
"main": [
[
{
"node": "Post to Tavily API",
"type": "main",
"index": 0
}
]
]
},
"Fetch Image from URL": {
"main": [
[
{
"node": "Send Email with Image",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Email No Image Fallback",
"type": "main",
"index": 0
}
]
]
},
"Groq Conversational Model": {
"ai_languageModel": [
[
{
"node": "Define LinkedIn Strategy Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Define LinkedIn Strategy Agent": {
"main": [
[
{
"node": "Generate Image URL",
"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.
gmailOAuth2groqApihttpHeaderAuth
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow runs daily at 8 AM to rotate through a topic list, research it with Tavily web search, generate a LinkedIn post and image prompt with Groq (Llama 3.3 70B), create a Pollinations.ai image URL, and email you the post with the image attached via Gmail. Runs every day…
Source: https://n8n.io/workflows/16551/ — 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 invoicing and payment follow-ups using Google Sheets, PDFShift, Groq (LLM), Gmail, and Telegram, sending initial invoices with PDF attachments, scheduling overdue reminders at
This scheduled workflow pulls recent resolved procurement tickets and chat queries, clusters similar issues, and uses Groq LLMs to analyze patterns and draft Markdown knowledge base articles, then ema
This workflow automatically monitors competitor product prices stored in Google Sheets. It scrapes product pages, extracts pricing and offer data using AI, and compares it with historical values. Base
Supplier Capacity Risk Alert Workflow. Uses httpRequest, lmChatGroq, agent, gmail. Scheduled trigger; 28 nodes.
This workflow automatically generates 2–3 high-quality Indian stock investment ideas daily by combining trending stock data + latest market news, processing it with AI (Groq/OpenAI), avoiding duplicat