KI-generierter E-Mail-Newsletter
Dies ist ein AI, Marketing-Bereich Automatisierungsworkflow mit 8 Nodes. Hauptsächlich werden Set, Code, Gmail, Agent, ScheduleTrigger und andere Nodes verwendet, kombiniert mit KI-Technologie für intelligente Automatisierung. Automatisches Generieren und Versenden von AI-Newslettern mit GPT und Gmail
- •Google-Konto + Gmail API-Anmeldedaten
- •OpenAI API Key
Verwendete Nodes (8)
Kategorie
{
"id": "DSxmKG8H861zKUw8",
"meta": {
"instanceId": "18c9b77a7db94bab09d77f4a9c44dd94853695bba1618cb7bc3c4bc412c07c1e",
"templateCredsSetupCompleted": true
},
"name": "AI Generated Email Newsletter",
"tags": [],
"nodes": [
{
"id": "a915b64b-1052-4cd1-aca9-0325c1b2c29d",
"name": "Workflow-Dokumentation",
"type": "n8n-nodes-base.stickyNote",
"position": [
-120,
-140
],
"parameters": {
"color": 6,
"width": 450,
"height": 420,
"content": "## Daily AI News Summary Workflow\n\nThis workflow runs every day at 9 AM to:\n\n1. **Fetch Latest AI News**: Uses Perplexity to find recent AI developments\n2. **Categorize Content**: Organizes news into three key areas:\n - 🚀 New Technology (breakthroughs, models, research)\n - 💡 Tips & Tricks (practical applications, tutorials)\n - 🛡️ AI Ethics & Security (privacy, safety, regulations)\n3. **Format & Send**: Creates a beautiful HTML email with summaries and links\n\n### Setup Required:\n- Perplexity API credentials\n- SMTP email credentials\n- Update recipient email address\n\n### Customization:\n- Change schedule time in Daily Trigger\n- Modify categories in Perplexity prompt\n- Adjust email styling in Format Email Content node"
},
"typeVersion": 1
},
{
"id": "3c6ef52a-3c4b-4d0e-be08-d496c407fa66",
"name": "Setzenup-Anleitung",
"type": "n8n-nodes-base.stickyNote",
"position": [
480,
0
],
"parameters": {
"color": 3,
"width": 580,
"height": 280,
"content": "⚙️ **Configuration Needed:**\n\n1. **AI Agent**: Add your Chat Model API key to the \"AI Agent\"\n\n2. **Email Settings**: \n - Add your Gmail Credentials\n - Add subject and message seperately\n - Email should be in HTML format\n\n3. **Timing**: Modify schedule in \"Daily Trigger\" if you want different timing\n\n4. **Content**: Customize the news categories or add more in the AI Agent prompt"
},
"typeVersion": 1
},
{
"id": "2f165ff5-7666-4f7b-93e0-73556ad9ed7a",
"name": "Daten festlegen1",
"type": "n8n-nodes-base.set",
"position": [
60,
360
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "current-date",
"name": "currentDate",
"type": "string",
"value": "={{ $now.format('yyyy-MM-dd') }}"
},
{
"id": "yesterday-date",
"name": "lastweekDate",
"type": "string",
"value": "={{ $now.minus({days: 7}).format('yyyy-MM-dd') }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "419a0eac-33f1-4349-ba54-a0a428ef8c1b",
"name": "Gmail1",
"type": "n8n-nodes-base.gmail",
"position": [
880,
360
],
"webhookId": "6e5776e8-b6b9-4c56-8b3a-812f68959433",
"parameters": {
"sendTo": "jyothi.swarup@techdome.net.in",
"message": "={{ $json.html }}",
"options": {},
"subject": "={{ $json.subject }}"
},
"credentials": {
"gmailOAuth2": {
"id": "kqndcZ7sNbQqDrJF",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "57cb8666-b3ff-489b-a6a5-be329ad82ab5",
"name": "E-Mail-Inhalt formatieren",
"type": "n8n-nodes-base.code",
"position": [
660,
360
],
"parameters": {
"jsCode": "// n8n Code Node - Email Formatter for AI Newsletter\n// This code formats the AI agent output for email sending\n\n// Get the AI agent output from the previous node\nconst aiOutput = $input.all()[0].json.output || $input.all()[0].json.text || $input.all()[0].json;\n\n// Extract the newsletter content (remove the prefix text)\nlet newsletterContent = '';\nif (typeof aiOutput === 'object' && aiOutput.content) {\n newsletterContent = aiOutput.content;\n} else if (typeof aiOutput === 'string') {\n // Remove the \"this is the output from the ai agent:\" prefix if it exists\n newsletterContent = aiOutput.replace(/^this is the output from the ai agent:\\s*/i, '');\n} else {\n newsletterContent = JSON.stringify(aiOutput);\n}\n\n// Clean up the newsletter content - remove \\n literals and format properly\nnewsletterContent = newsletterContent\n .replace(/\\\\n/g, '\\n') // Convert literal \\n to actual newlines\n .replace(/^\\s+|\\s+$/g, '') // Trim whitespace\n .replace(/\\n{3,}/g, '\\n\\n'); // Replace multiple newlines with double newlines\n\n// Generate email subject with current date\nfunction generateEmailSubject() {\n const currentDate = new Date().toLocaleDateString('en-US', { \n year: 'numeric', \n month: 'long', \n day: 'numeric' \n });\n return `🤖 AI Weekly Pulse - ${currentDate}: ChatGPT Voice Update & Latest AI News`;\n}\n\n// Generate email body with proper formatting\nfunction generateEmailBody() {\n const emailBody = `Hi there!\n\nI hope this email finds you well. Here's this week's AI newsletter with the latest updates from the AI world:\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n${newsletterContent}\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\nHope you found this week's AI updates valuable! Feel free to reply with your thoughts or questions.\n\nBest regards,\nAI Weekly Pulse Team\n\n---\n📧 This newsletter was automatically generated and sent via n8n automation.\n🔗 Want to unsubscribe or have questions? Just reply to this email.`;\n\n return emailBody;\n}\n\n// Generate HTML version of the email for better formatting\nfunction generateHTMLEmailBody() {\n // Convert markdown-like content to basic HTML\n let htmlContent = newsletterContent\n .replace(/^# (.*$)/gm, '<h1 style=\"color: #333; border-bottom: 2px solid #667eea; padding-bottom: 10px;\">$1</h1>')\n .replace(/^## (.*$)/gm, '<h2 style=\"color: #444; margin-top: 30px; margin-bottom: 15px;\">$1</h2>')\n .replace(/^### (.*$)/gm, '<h3 style=\"color: #555; margin-top: 20px; margin-bottom: 10px;\">$1</h3>')\n .replace(/\\*\\*(.*?)\\*\\*/g, '<strong>$1</strong>')\n .replace(/\\*(.*?)\\*/g, '<em>$1</em>')\n .replace(/\\[([^\\]]+)\\]\\(([^)]+)\\)/g, '<a href=\"$2\" style=\"color: #667eea; text-decoration: none;\">$1</a>')\n .replace(/^- (.*$)/gm, '<li style=\"margin-bottom: 8px;\">$1</li>')\n .replace(/^> (.*$)/gm, '<blockquote style=\"border-left: 4px solid #667eea; padding-left: 20px; margin: 20px 0; font-style: italic; color: #666;\">$1</blockquote>')\n .replace(/---/g, '<hr style=\"border: none; border-top: 2px solid #eee; margin: 30px 0;\">')\n .replace(/\\n\\n/g, '</p><p style=\"line-height: 1.6; margin-bottom: 15px;\">')\n .replace(/\\n/g, '<br>');\n\n // Wrap list items in ul tags\n htmlContent = htmlContent.replace(/(<li[^>]*>.*?<\\/li>)/gs, '<ul style=\"padding-left: 20px; margin-bottom: 20px;\">$1</ul>');\n\n const htmlBody = `\n<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>AI Weekly Pulse</title>\n</head>\n<body style=\"font-family: Arial, sans-serif; line-height: 1.6; color: #333; max-width: 800px; margin: 0 auto; padding: 20px; background-color: #f9f9f9;\">\n <div style=\"background: white; padding: 40px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.1);\">\n <div style=\"text-align: center; margin-bottom: 30px; padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 8px; color: white;\">\n <h1 style=\"margin: 0; font-size: 24px;\">🤖 AI Weekly Pulse</h1>\n <p style=\"margin: 10px 0 0 0; opacity: 0.9;\">Your Weekly Dose of AI Innovation</p>\n </div>\n \n <div style=\"margin-bottom: 30px;\">\n <p style=\"font-size: 16px; color: #555;\">Hi there!</p>\n <p style=\"font-size: 16px; color: #555;\">Hope this email finds you well. Here's this week's AI newsletter with the latest updates from the AI world:</p>\n </div>\n \n <div style=\"background: #fafafa; padding: 30px; border-radius: 8px; margin: 20px 0;\">\n <p style=\"line-height: 1.6; margin-bottom: 15px;\">${htmlContent}</p>\n </div>\n \n <div style=\"margin-top: 40px; padding: 30px; background: #f0f4ff; border-radius: 8px; text-align: center;\">\n <p style=\"font-size: 16px; color: #555; margin-bottom: 15px;\">Hope you found this week's AI updates valuable!</p>\n <p style=\"font-size: 16px; color: #555; margin-bottom: 20px;\">Feel free to reply with your thoughts or questions.</p>\n <p style=\"font-size: 18px; color: #333; margin: 0;\"><strong>Best regards,<br>AI Weekly Pulse Team</strong></p>\n </div>\n \n <div style=\"margin-top: 30px; padding: 20px; background: #e8f2ff; border-radius: 8px; font-size: 14px; color: #666; text-align: center;\">\n <p style=\"margin: 5px 0;\">📧 This newsletter was automatically generated and sent via n8n automation.</p>\n <p style=\"margin: 5px 0;\">🔗 Want to unsubscribe or have questions? Just reply to this email.</p>\n </div>\n </div>\n</body>\n</html>`;\n\n return htmlBody;\n}\n\n// Generate the formatted output for the email node\nconst emailSubject = generateEmailSubject();\nconst emailBodyText = generateEmailBody();\nconst emailBodyHTML = generateHTMLEmailBody();\n\n// Return the formatted data for the next node (email sender)\nreturn [\n {\n json: {\n subject: emailSubject,\n text: emailBodyText,\n html: emailBodyHTML,\n // Additional metadata\n newsletter_content: newsletterContent,\n generated_at: new Date().toISOString(),\n email_type: \"ai_weekly_pulse\"\n }\n }\n];"
},
"typeVersion": 2
},
{
"id": "9a9676bb-d645-49fc-84ab-5a5c0cd92645",
"name": "KI-Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
280,
360
],
"parameters": {
"text": "=Newsletter Structure\n1. Title\nEngaging and punchy (under 10 words).\n\nIncludes a relevant keyword (e.g., “AI”, “ChatGPT”, “Machine Learning”).\n\n2. Editor’s Note (Optional but preferred)\nA short 2–3 sentence personal note to the readers.\n\nTone: Conversational and warm.\n\nSummarize the theme of this issue or highlight an AI trend to watch.\n\n3. 🧠 AI in Focus (Main Story)\nOne key development or trend in AI this week.\n\nCould be about a breakthrough, a major product launch, a regulatory move, or a case study.\n\n3–5 paragraphs long.\n\nInclude context (why it matters), impact, and your analysis.\n\n4. 📰 Headlines in AI (News Roundup)\nList 3–5 bite-sized headlines with 1–2 sentence summaries for each. Include:\n\nDate (optional).\n\nSource (e.g., OpenAI, Google, MIT, etc.).\n\nLink (if available).\n\nExample:\n\nOpenAI Releases GPT-5 Preview – OpenAI teased major upgrades in language understanding and reasoning. Read more\n\n5. 🔍 Tool of the Week\nIntroduce one new or underrated AI tool.\n\nInclude what it does, who it’s for, and how it works (2–3 sentences).\n\nInclude a link if available.\n\n6. 📚 Learning Corner\nRecommend one AI resource: a blog post, YouTube video, podcast, free course, or paper.\n\nMention why it’s worth reading/listening/watching.\n\n7. 🤖 Prompt of the Week\nShare a powerful or creative prompt users can try with ChatGPT or any LLM.\n\nExplain what it does and when to use it.\n\n8. 📈 AI Stat of the Week\nShare one interesting stat about AI.\n\nCite the source and explain the takeaway in 1–2 sentences.\n\n9. 👥 Community Shoutout (Optional)\nHighlight a person, open-source project, or discussion in the AI community.\n\n10. 👀 What to Watch Next Week\nPreview an upcoming event, release, or expected trend in AI.\n\nKeep it short (1–2 sentences).\n\n🧾 Style Guidelines\nUse markdown for formatting: **bold**, # headers, - lists, etc.\n\nKeep tone informative, clear, and slightly casual.\n\nAvoid jargon unless explained.\n\nUse bullet points and subheaders for readability.\n\nProvide citations for all the topics immediately ",
"options": {
"systemMessage": "You are an AI writing assistant tasked with creating a weekly newsletter about artificial intelligence (AI). The goal is to inform, engage, and educate readers ranging from tech-savvy professionals to curious enthusiasts. Follow the structure below and ensure the tone is professional yet accessible."
},
"promptType": "define"
},
"typeVersion": 1.9
},
{
"id": "4e5e19a9-b05f-4ef0-a432-a0e72c479095",
"name": "Azure OpenAI Chat-Modell",
"type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
"position": [
260,
520
],
"parameters": {
"model": "gpt-4.1",
"options": {}
},
"credentials": {
"azureOpenAiApi": {
"id": "gDiLXmZSX0q3CyLu",
"name": "Azure Open AI account"
}
},
"typeVersion": 1
},
{
"id": "e7dbd62a-6580-4a28-ab85-5fdf885dacf0",
"name": "Zeitplan-Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-140,
360
],
"parameters": {
"rule": {
"interval": [
{}
]
}
},
"typeVersion": 1.2
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "e0cf8d41-3776-4aab-a5ec-fd16b8bc7457",
"connections": {
"9a9676bb-d645-49fc-84ab-5a5c0cd92645": {
"main": [
[
{
"node": "57cb8666-b3ff-489b-a6a5-be329ad82ab5",
"type": "main",
"index": 0
}
]
]
},
"2f165ff5-7666-4f7b-93e0-73556ad9ed7a": {
"main": [
[
{
"node": "9a9676bb-d645-49fc-84ab-5a5c0cd92645",
"type": "main",
"index": 0
}
]
]
},
"e7dbd62a-6580-4a28-ab85-5fdf885dacf0": {
"main": [
[
{
"node": "2f165ff5-7666-4f7b-93e0-73556ad9ed7a",
"type": "main",
"index": 0
}
]
]
},
"57cb8666-b3ff-489b-a6a5-be329ad82ab5": {
"main": [
[
{
"node": "419a0eac-33f1-4349-ba54-a0a428ef8c1b",
"type": "main",
"index": 0
}
]
]
},
"4e5e19a9-b05f-4ef0-a432-a0e72c479095": {
"ai_languageModel": [
[
{
"node": "9a9676bb-d645-49fc-84ab-5a5c0cd92645",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}Wie verwende ich diesen Workflow?
Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.
Für welche Szenarien ist dieser Workflow geeignet?
Fortgeschritten - Künstliche Intelligenz, Marketing
Ist es kostenpflichtig?
Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.
Verwandte Workflows
Rahul Joshi
@rahul08Rahul 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.
Diesen Workflow teilen