This workflow corresponds to n8n.io template #13148 — 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 →
{
"id": "iEukTpPVxxcUz2pZ",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Generate a summary from Gmail and upload it into Notion",
"tags": [],
"nodes": [
{
"id": "0325b696-6f36-4a1c-9cb6-272d34488ad1",
"name": "Get many messages",
"type": "n8n-nodes-base.gmail",
"position": [
0,
48
],
"parameters": {
"filters": {
"sender": "=newer_than:7d (from:xxx@xxx.ai OR from:yyy@yyy.com)\n"
},
"operation": "getAll"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.2
},
{
"id": "18b63ac5-4d3f-4b9a-917d-578779325e1a",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
480,
352
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-5.2",
"cachedResultName": "gpt-5.2"
},
"options": {},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "b069ac1d-ac3e-4fae-afc1-637b9dbce185",
"name": "Get a message",
"type": "n8n-nodes-base.gmail",
"position": [
224,
144
],
"parameters": {
"simple": false,
"options": {},
"messageId": "={{ $json.id }}",
"operation": "get"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.2
},
{
"id": "b9dcd907-09bf-4fd9-98b9-e20fa54a6b7b",
"name": "Code in JavaScript",
"type": "n8n-nodes-base.code",
"position": [
800,
144
],
"parameters": {
"jsCode": "// 1. Retrieve items\nconst allItems = $input.all();\n\n// 2. Merge texts\nlet mergedText = allItems\n .map(item => item.json.output) \n .join('\\n\\n---\\n\\n'); \n\n// 3. Check length\nconst MAX_LENGTH = 1800;\n\nif (mergedText && mergedText.length > MAX_LENGTH) {\n // Cut 1800 characters \n let trimmed = mergedText.substring(0, MAX_LENGTH);\n \n \n const lastDotIndex = trimmed.lastIndexOf('.');\n if (lastDotIndex > 0) {\n trimmed = trimmed.substring(0, lastDotIndex + 1);\n }\n \n mergedText = trimmed + \"\\n\\n(Testo troncato per limiti di lunghezza...)\";\n}\n\n// 4. Result\nreturn { json: { final_summary: mergedText } };"
},
"typeVersion": 2
},
{
"id": "231988ad-751e-4c01-bd2e-feb1ed7e2d83",
"name": "OpenAI Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1024,
352
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-5.2",
"cachedResultName": "gpt-5.2"
},
"options": {},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "45909224-3ad6-4282-bc89-39ebef31529e",
"name": "Import body emails",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
448,
144
],
"parameters": {
"text": "=Act as a personal editor. Analyze the text of the provided emails ({{ $json.text }}) and create a concise summary of the key news or information.\n\nFormatting rules for Notion:\n\nUse UPPERCASE for section titles (DO NOT use # or ##).\n\nUse bullet points (-) for details.\n\nAvoid complex markdown symbols such as tables or code blocks.\n\nBe brief and direct.\n\nThe final result must be a maximum of 1600 characters.\n\nAt the beginning of the summary, include (only once) the date (the Monday of the week you are considering).\n\nExclude events from the summary.",
"options": {},
"promptType": "define"
},
"typeVersion": 3
},
{
"id": "302e0a61-27e3-4045-b032-69079f2ad8da",
"name": "Final Summary",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
992,
144
],
"parameters": {
"text": "=You are the editor-in-chief of a weekly newsletter.\nBelow you will find a series of raw summaries from various emails received this week.\nYour task is to create a SINGLE final narrative text (Weekly Recap) that merges the most important news.\n\nCORE RULES:\n\nThe final text MUST be under 1500 characters (including spaces). Be concise.\n\nUse a conversational yet structured style (use bullet points if needed).\n\nDo not use Markdown formatting (UPPERCASE for titles, bold for emphasis).\n\nIgnore emails that appear to be spam or not important if you need to save space.\n\nStart with a title: \"WEEKLY RECAP:\" and add the date of the Monday of the relevant week.\n\nHere are the raw summaries:\n{{ $json.final_summary }}",
"options": {},
"promptType": "define"
},
"typeVersion": 3
},
{
"id": "4dac71ea-62cd-45bc-9e4e-b807fefaf60b",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-112,
-144
],
"parameters": {
"color": 4,
"width": 528,
"height": 448,
"content": "## Gmail flow \nRetrieve emails with AI subjects.\nTag as READ\n"
},
"typeVersion": 1
},
{
"id": "a4897f69-c303-4a7c-a23b-a69a9ef72e59",
"name": "Convert text to speech",
"type": "@elevenlabs/n8n-nodes-elevenlabs.elevenLabs",
"onError": "continueErrorOutput",
"position": [
1376,
288
],
"parameters": {
"text": "={{ $json.output }}",
"voice": {
"__rl": true,
"mode": "id",
"value": "SAz9YHcvj6GT2YYXdXww"
},
"resource": "speech",
"requestOptions": {},
"additionalOptions": {}
},
"credentials": {
"elevenLabsApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "46c1800b-3168-4929-b181-b73270260261",
"name": "Upload file",
"type": "n8n-nodes-base.googleDrive",
"position": [
1760,
272
],
"parameters": {
"name": "=News{{$now.format(\"yyyyMMdd\")}}.mp3",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive",
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
"cachedResultName": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "1pSgLdNHT-v1WVLB1X8vb1g8OPmw7Zx6C",
"cachedResultUrl": "https://drive.google.com/drive/folders/1pSgLdNHT-v1WVLB1X8vb1g8OPmw7Zx6C",
"cachedResultName": "Audio News"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 3
},
{
"id": "63de5534-b5e6-4799-8c11-3d7872f020f3",
"name": "Share file",
"type": "n8n-nodes-base.googleDrive",
"position": [
1936,
272
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {},
"operation": "share",
"permissionsUi": {
"permissionsValues": {
"role": "reader",
"type": "anyone"
}
}
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 3
},
{
"id": "113aefe6-115c-476a-a94a-a142a93cf80d",
"name": "Generate audio",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1568,
384
],
"parameters": {
"input": "={{ $('Final Summary').item.json.output }}",
"model": "tts-1-hd",
"voice": "nova",
"options": {},
"resource": "audio"
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "2bb1e530-418e-4973-b027-70a274317c0e",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1328,
192
],
"parameters": {
"color": 6,
"width": 1184,
"height": 400,
"content": "## Audio transcript\n**Generate an audio transcript and upload to Google Drive\n"
},
"typeVersion": 1
},
{
"id": "33a53595-4a99-4f71-93d3-698b337f184b",
"name": "Weekly trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-224,
48
],
"parameters": {
"rule": {
"interval": [
{
"field": "weeks",
"triggerAtDay": [
6
],
"triggerAtHour": 12,
"triggerAtMinute": 32
}
]
}
},
"typeVersion": 1.3
},
{
"id": "956e80b8-5f6a-4d41-8c3e-87c48dac8a74",
"name": "Mark as read",
"type": "n8n-nodes-base.gmail",
"position": [
224,
-48
],
"parameters": {
"labelIds": [
"UNREAD"
],
"messageId": "={{ $json.id }}",
"operation": "removeLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.2
},
{
"id": "1258c34e-46a9-476b-a9e7-6bdb09e8f811",
"name": "Create Google Drive URL",
"type": "n8n-nodes-base.set",
"position": [
2112,
272
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "0d8162c6-b239-44cb-9f47-db6ca9fe357d",
"name": "audio_url",
"type": "string",
"value": "=https://drive.google.com/uc?export=download&id={{ $('Upload file').item.json.id }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "22cf0bd5-b9d1-4c33-b4a3-426081f1b2f7",
"name": "Create a link to audio file in Notion",
"type": "n8n-nodes-base.notion",
"position": [
2320,
272
],
"parameters": {
"blockId": {
"__rl": true,
"mode": "url",
"value": "https://www.notion.so/ZZZZZZ"
},
"blockUi": {
"blockValues": [
{
"text": {
"text": [
{
"text": "=\ud83c\udfa7 Audio Summary: {{ $json.audio_url }}",
"isLink": true,
"textLink": "={{ $json.audio_url }}",
"annotationUi": {}
}
]
},
"richText": true
}
]
},
"resource": "block"
},
"credentials": {
"notionApi": {
"name": "<your credential>"
}
},
"typeVersion": 2.2
},
{
"id": "aceed0fb-dff0-4e0f-8a79-0115dfdbaf7b",
"name": "Create a text block Notion",
"type": "n8n-nodes-base.notion",
"position": [
1392,
0
],
"parameters": {
"blockId": {
"__rl": true,
"mode": "url",
"value": "https://www.notion.so/ZZZZZZZ"
},
"blockUi": {
"blockValues": [
{
"text": {
"text": [
{
"text": "={{ $json.output }}",
"annotationUi": {}
}
]
},
"richText": true
}
]
},
"resource": "block"
},
"credentials": {
"notionApi": {
"name": "<your credential>"
}
},
"typeVersion": 2.2
},
{
"id": "e4ed1f7b-27f3-478a-8b2e-0bed4fa10b02",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-960,
-192
],
"parameters": {
"color": 3,
"width": 528,
"height": 848,
"content": "## How it works\n\nThis workflow automates the entire journey from inbox noise to a clean, shareable audio summary. It starts with a weekly trigger that scans Gmail for emails matching specific subjects. Each message is fetched, marked as read, and its body is extracted and normalized to avoid formatting chaos.\n\nThe cleaned content is then passed to an OpenAI Chat Model, which generates a concise written summary. A short JavaScript step acts as glue logic: it aggregates content, enforces structure, and prepares the final prompt. A second OpenAI step produces the polished \u201cFinal Summary,\u201d designed to be readable and narration-friendly.\n\nThat summary is saved directly into Notion as a text block, creating a permanent written log. From there, the flow branches into audio mode: the text is converted to speech, an audio file is generated, and the file is uploaded to Google Drive. Permissions are applied automatically, a public URL is created, and that link is appended back into the same Notion page. Result: text + audio, always paired, always traceable.\n\n### Setup steps\n\n- Configure the Gmail node with subject filters and enable \u201cmark as read.\u201d\n\n- Connect OpenAI credentials for both summarization and text-to-speech.\n\n- Adjust the JavaScript node only if you want different aggregation rules.\n\n- Set the Notion database/page where summaries should be appended.\n\n- Configure Google Drive upload, sharing, and link creation.\n\n- Run once manually to validate permissions, then let the weekly trigger do its thing.\n\nCompact, deterministic, and low-maintenance\u2014this flow quietly turns emails into knowledge you can read or listen to."
},
"typeVersion": 1
},
{
"id": "bea6f5fe-22b5-4422-9b41-41fb5f171623",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
432,
0
],
"parameters": {
"width": 848,
"height": 496,
"content": "## Create summary text\n\nSummarize with LLM\n"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"callerPolicy": "workflowsFromSameOwner",
"errorWorkflow": "7TaexhgP7sonxvTB",
"timeSavedMode": "fixed",
"availableInMCP": false,
"executionOrder": "v1"
},
"versionId": "4ea20f1e-5df8-4f7f-b2d8-2dfd9276ba1b",
"connections": {
"Share file": {
"main": [
[
{
"node": "Create Google Drive URL",
"type": "main",
"index": 0
}
]
]
},
"Upload file": {
"main": [
[
{
"node": "Share file",
"type": "main",
"index": 0
}
]
]
},
"Final Summary": {
"main": [
[
{
"node": "Create a text block Notion",
"type": "main",
"index": 0
},
{
"node": "Convert text to speech",
"type": "main",
"index": 0
}
]
]
},
"Get a message": {
"main": [
[
{
"node": "Import body emails",
"type": "main",
"index": 0
}
]
]
},
"Generate audio": {
"main": [
[
{
"node": "Upload file",
"type": "main",
"index": 0
}
]
]
},
"Weekly trigger": {
"main": [
[
{
"node": "Get many messages",
"type": "main",
"index": 0
}
]
]
},
"Get many messages": {
"main": [
[
{
"node": "Mark as read",
"type": "main",
"index": 0
},
{
"node": "Get a message",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Import body emails",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "Final Summary",
"type": "main",
"index": 0
}
]
]
},
"Import body emails": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "Final Summary",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Convert text to speech": {
"main": [
[
{
"node": "Upload file",
"type": "main",
"index": 0
}
],
[
{
"node": "Generate audio",
"type": "main",
"index": 0
}
]
]
},
"Create Google Drive URL": {
"main": [
[
{
"node": "Create a link to audio file in Notion",
"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.
elevenLabsApigmailOAuth2googleDriveOAuth2ApinotionApiopenAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Gmail → AI Summary → Notion + Audio Digest
Source: https://n8n.io/workflows/13148/ — 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 creation, rendering, approval, and posting of TikTok-style POV (Point of View) videos to Instagram, with cross-posting to Facebook and YouTube. It eliminates manual video p
Tags: EU News, RSS, AI Classifier, Data Table, Email Digest, Automation, n8n
🧾 An intelligent automation system that turns Google Meet recordings into structured meeting notes — integrating Fireflies.ai, OpenAI GPT-4.1-mini, Notion, Slack, Google Drive, and Gmail via n8n.
LinkedIn_Job_Hunt_and_Cover_Letter. Uses outputParserStructured, outputParserAutofixing, googleDrive, agent. Scheduled trigger; 85 nodes.
This n8n automation workflow automates the creation, scripting, production, and posting of YouTube videos. It leverages AI (OpenAI), image generation (PIAPI), video rendering (Shotstack), and platform