This workflow corresponds to n8n.io template #6180 — we link there as the canonical source.
This workflow follows the Gmail → Google Docs 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": "p5e76vbOIDIaf29H",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Email Summary",
"tags": [
{
"id": "TNPHEZ52JXA88tV0",
"name": "AI",
"createdAt": "2025-06-28T18:46:13.842Z",
"updatedAt": "2025-06-28T18:46:13.842Z"
},
{
"id": "pD2RVg49fBlIR8pA",
"name": "Gmail",
"createdAt": "2025-06-28T19:24:47.979Z",
"updatedAt": "2025-06-28T19:24:47.979Z"
},
{
"id": "wZ14hcyo2pYAOVlF",
"name": "OpenAI",
"createdAt": "2025-06-28T18:46:13.462Z",
"updatedAt": "2025-06-28T18:46:13.462Z"
},
{
"id": "M3TlU8Xdj7ZlK0PE",
"name": "Project Management",
"createdAt": "2025-06-28T18:46:13.681Z",
"updatedAt": "2025-06-28T18:46:13.681Z"
},
{
"id": "bpJw62xLnDDElGob",
"name": "Building blocks",
"createdAt": "2025-06-28T18:46:13.530Z",
"updatedAt": "2025-06-28T18:46:13.530Z"
},
{
"id": "3nY5Wk7HNEt9e9gW",
"name": "DevOps",
"createdAt": "2025-06-28T18:46:13.916Z",
"updatedAt": "2025-06-28T18:46:13.916Z"
},
{
"id": "1Z9wnauckk6RWoYl",
"name": "Email",
"createdAt": "2025-07-19T17:42:50.746Z",
"updatedAt": "2025-07-19T17:42:50.746Z"
}
],
"nodes": [
{
"id": "10e1dc39-0561-4bfd-b80f-e60a91af3cb5",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-80,
-60
],
"parameters": {
"width": 1880,
"height": 460,
"content": "Telegram Email Summary Workflow"
},
"typeVersion": 1
},
{
"id": "ef07131c-2d2c-42ed-a1de-7e5625c8057c",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-80,
-720
],
"parameters": {
"color": 3,
"width": 580,
"height": 640,
"content": "Email Summary Workflow:\n\nThis n8n workflow automatically summarizes the latest email in your inbox and saves the summary to a Google Doc. It's designed as a simple, modular starting point that users can easily expand or customize.\n\nHow It Works\n- Trigger: A Schedule Trigger runs the workflow daily at 8 AM.\n\n- Get Email: The Gmail node fetches the most recent email.\n\n- Limit: Only the most recent email is passed through.\n\n- Check for New Email: An IF node determines whether a new email was found.\n\nIf yes, the email content is cleaned (HTML stripped, base64 decoded).\n\nIf no, a fallback message is created noting there are no new emails.\n\n- Summarization: The content is passed to OpenAI with a detailed prompt to summarize:\n\nSender\nDate\nSubject\nMain points, requests, and action items\n\n- Google Docs Output:\nA new Google Doc titled Email Summary is created (or reused).\nThe summary is inserted into the document for future reference.\n"
},
"typeVersion": 1
},
{
"id": "28c3ca0d-9397-41e3-b8b9-13a577e0ca98",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-40,
100
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 8
}
]
}
},
"typeVersion": 1.2
},
{
"id": "da1aaa80-87a6-4d98-b14f-e08e327553bc",
"name": "Limit",
"type": "n8n-nodes-base.limit",
"position": [
340,
100
],
"parameters": {},
"typeVersion": 1
},
{
"id": "54653ec9-413f-4656-955c-3dcaacdee6cf",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
540,
100
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "621c437c-e857-4e21-9aa6-ed75ae360775",
"operator": {
"type": "string",
"operation": "notEquals"
},
"leftValue": "={{ $('Get Gmail').item.json.headers.from }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "f6b7ea0d-b521-459d-856c-f39a26962356",
"name": "Email",
"type": "n8n-nodes-base.code",
"position": [
800,
0
],
"parameters": {
"jsCode": "// This function will strip out HTML tags to leave only the plain text.\nfunction extractCleanText(html) {\n if (!html) {\n return '';\n }\n // A regular expression to remove HTML tags and extra whitespace.\n return html.replace(/<[^>]*>/g, \"\").replace(/\\s+/g, ' ').trim();\n}\n\n// Process each email item passed to the node.\nreturn $input.all().map(item => {\n const payload = item.json.payload || {};\n const headers = payload.headers || [];\n \n // A helper function to find a specific header's value.\n const getHeader = (name) => headers.find(h => h.name.toLowerCase() === name.toLowerCase())?.value || 'N/A';\n\n const from = getHeader('From');\n const subject = getHeader('Subject');\n const date = getHeader('Date');\n\n let bodyData = '';\n // Check for multipart emails first.\n if (payload.parts) {\n // Prefer plain text over HTML for simplicity.\n const plainPart = payload.parts.find(p => p.mimeType === 'text/plain');\n const htmlPart = payload.parts.find(p => p.mimeType === 'text/html');\n \n // Use the data from the preferred part.\n if (plainPart && plainPart.body && plainPart.body.data) {\n bodyData = plainPart.body.data;\n } else if (htmlPart && htmlPart.body && htmlPart.body.data) {\n bodyData = htmlPart.body.data;\n }\n } else if (payload.body && payload.body.data) {\n // Fallback for single-part emails.\n bodyData = payload.body.data;\n }\n\n // The body content is Base64 encoded, so it needs to be decoded.\n const decodedBody = Buffer.from(bodyData, 'base64').toString('utf-8');\n \n // Clean the decoded body to remove any lingering HTML.\n const cleanBody = extractCleanText(decodedBody);\n\n return {\n json: {\n from,\n subject,\n date,\n body: cleanBody\n }\n };\n});"
},
"typeVersion": 2
},
{
"id": "6967e64d-32ac-4981-969b-76719d0b0377",
"name": "No Email",
"type": "n8n-nodes-base.code",
"position": [
800,
240
],
"parameters": {
"jsCode": "return [\n {\n json: {\n from: \"N/A\",\n subject: \"No Email Found\",\n date: new Date().toISOString(),\n body: \"No new emails were found during this summary check. There is nothing to summarize at this time.\"\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "a0e30b66-7329-4731-9401-5896855a7a22",
"name": "Get Gmail",
"type": "n8n-nodes-base.gmail",
"position": [
160,
100
],
"parameters": {
"limit": 1,
"simple": false,
"filters": {},
"options": {},
"operation": "getAll"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "a931d85d-40ea-4bde-a0aa-8f9a7ef14c04",
"name": "Summary Email OpenAI",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1060,
120
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1",
"cachedResultName": "GPT-4.1"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are a professional AI assistant tasked with summarizing the most recent email received.\n\nYour goal is to deliver a clear, concise, and accurate summary that saves the user time by eliminating the need to read the full email. The summary should convey all essential details and maintain a professional tone.\n\nPlease include the following in your response:\n\nSender's name and email address: {{ $('Get Gmail').item.json.headers.from }}\n\nDate and time received: {{ $('Get Gmail').item.json.headers.date }}\n\nSubject line (if available): {{ $('Get Gmail').item.json.headers.subject }}\n\nMain purpose or topic of the email\n\nKey points, requests, or required actions\n\nAny additional relevant context that helps the user understand the email at a glance\n\nAvoid unnecessary repetition or filler. The summary should be easy to scan, but detailed enough that the user can fully understand the message without opening the original email.\n\nSummarize the following content:\n\n{{ $('Get Gmail').item.json.text }}"
}
]
},
"simplify": false
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "537c41f8-5cea-46d6-92a9-a2cffdd65bb2",
"name": "Create Google Docs",
"type": "n8n-nodes-base.googleDocs",
"position": [
1420,
120
],
"parameters": {
"title": "Email Summary",
"folderId": "1ihoRENubwDmcwMqhFzbdnfuYQdU2YXVR"
},
"credentials": {
"googleDocsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 2
},
{
"id": "96ca547a-cb62-4eef-a9dc-765654c13e1d",
"name": "Update Google Docs",
"type": "n8n-nodes-base.googleDocs",
"position": [
1620,
120
],
"parameters": {
"simple": false,
"actionsUi": {
"actionFields": [
{
"text": "={{ $('Summary Email OpenAI').item.json.choices[0].message.content }}",
"action": "insert"
}
]
},
"operation": "update",
"documentURL": "={{ $json.id }}"
},
"credentials": {
"googleDocsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 2
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "bf63aae4-7580-4cb7-93ab-9631974dc104",
"connections": {
"If": {
"main": [
[
{
"node": "Email",
"type": "main",
"index": 0
}
],
[
{
"node": "No Email",
"type": "main",
"index": 0
}
]
]
},
"Email": {
"main": [
[
{
"node": "Summary Email OpenAI",
"type": "main",
"index": 0
}
]
]
},
"Limit": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"No Email": {
"main": [
[
{
"node": "Summary Email OpenAI",
"type": "main",
"index": 0
}
]
]
},
"Get Gmail": {
"main": [
[
{
"node": "Limit",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Get Gmail",
"type": "main",
"index": 0
}
]
]
},
"Create Google Docs": {
"main": [
[
{
"node": "Update Google Docs",
"type": "main",
"index": 0
}
]
]
},
"Summary Email OpenAI": {
"main": [
[
{
"node": "Create Google Docs",
"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.
gmailOAuth2googleDocsOAuth2ApiopenAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
The goal of this workflow is to offer a highly customizable foundation that users can tailor to fit their specific platform and setup. While the current version uses Gmail, it can easily be adapted to work with other providers by replacing the email node with alternatives such…
Source: https://n8n.io/workflows/6180/ — 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.
Imagine a dedicated financial expert tirelessly working behind the scenes, sifting through every transaction, every investment move, and every accounting entry. That's exactly what this automated syst
This n8n template demonstrates how to automatically analyze all your accumulated notes from the past week and generate actionable insights, task lists, and priorities using AI.
Personalized Outreach & Follow-Up - Phase 2. Uses googleSheets, openAi, gmail, gmailTrigger. Scheduled trigger; 59 nodes.
A scheduled process aggregates content from eight distinct data sources and standardizes all inputs into a unified format. AI models perform sentiment scoring, detect conspiracy or misinformation sign
This workflow monitors filesystem sync and backup jobs by validating their execution logs, not by running or inspecting the jobs themselves.