Resumen de correo electrónico

Intermedio

Este es unPersonal Productivity, AI Summarizationflujo de automatización del dominio deautomatización que contiene 11 nodos.Utiliza principalmente nodos como If, Code, Gmail, Limit, GoogleDocs. Resumen diario de correos electrónicos resumido en documentos de Google usando GPT-4

Requisitos previos
  • Cuenta de Google y credenciales de API de Gmail
  • Clave de API de OpenAI
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "id": "p5e76vbOIDIaf29H",
  "meta": {
    "instanceId": "6304e8877aa0fde3913b14034debe07006963fb497d63f280a91bbd75c6c24e1",
    "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": "Nota Adhesiva",
      "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": "Nota Adhesiva1",
      "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": "Activador Programado",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -40,
        100
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 8
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "da1aaa80-87a6-4d98-b14f-e08e327553bc",
      "name": "Límite",
      "type": "n8n-nodes-base.limit",
      "position": [
        340,
        100
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "54653ec9-413f-4656-955c-3dcaacdee6cf",
      "name": "Si",
      "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": "Correo Electrónico",
      "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": "Sin Correo",
      "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": "Obtener Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        160,
        100
      ],
      "webhookId": "efcd3ee6-26a7-4c3d-84c2-c1cdef8a8d7c",
      "parameters": {
        "limit": 1,
        "simple": false,
        "filters": {},
        "options": {},
        "operation": "getAll"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "B0oVer8pX52LHrvw",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a931d85d-40ea-4bde-a0aa-8f9a7ef14c04",
      "name": "Resumir Correo 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": {
          "id": "Yks1Eic3YR07Cpm6",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "537c41f8-5cea-46d6-92a9-a2cffdd65bb2",
      "name": "Crear Documento Google",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        1420,
        120
      ],
      "parameters": {
        "title": "Email Summary",
        "folderId": "1ihoRENubwDmcwMqhFzbdnfuYQdU2YXVR"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "id": "dSGiWWxQdhY5ywpg",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "96ca547a-cb62-4eef-a9dc-765654c13e1d",
      "name": "Actualizar Documento Google",
      "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": {
          "id": "dSGiWWxQdhY5ywpg",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "bf63aae4-7580-4cb7-93ab-9631974dc104",
  "connections": {
    "54653ec9-413f-4656-955c-3dcaacdee6cf": {
      "main": [
        [
          {
            "node": "f6b7ea0d-b521-459d-856c-f39a26962356",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "6967e64d-32ac-4981-969b-76719d0b0377",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f6b7ea0d-b521-459d-856c-f39a26962356": {
      "main": [
        [
          {
            "node": "a931d85d-40ea-4bde-a0aa-8f9a7ef14c04",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "da1aaa80-87a6-4d98-b14f-e08e327553bc": {
      "main": [
        [
          {
            "node": "54653ec9-413f-4656-955c-3dcaacdee6cf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6967e64d-32ac-4981-969b-76719d0b0377": {
      "main": [
        [
          {
            "node": "a931d85d-40ea-4bde-a0aa-8f9a7ef14c04",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a0e30b66-7329-4731-9401-5896855a7a22": {
      "main": [
        [
          {
            "node": "da1aaa80-87a6-4d98-b14f-e08e327553bc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "28c3ca0d-9397-41e3-b8b9-13a577e0ca98": {
      "main": [
        [
          {
            "node": "a0e30b66-7329-4731-9401-5896855a7a22",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "537c41f8-5cea-46d6-92a9-a2cffdd65bb2": {
      "main": [
        [
          {
            "node": "96ca547a-cb62-4eef-a9dc-765654c13e1d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a931d85d-40ea-4bde-a0aa-8f9a7ef14c04": {
      "main": [
        [
          {
            "node": "537c41f8-5cea-46d6-92a9-a2cffdd65bb2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Intermedio - Productividad personal, Resumen de IA

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Intermedio
Número de nodos11
Categoría2
Tipos de nodos8
Descripción de la dificultad

Adecuado para usuarios con experiencia intermedia, flujos de trabajo de complejidad media con 6-15 nodos

Autor
Michael Gullo

Michael Gullo

@drdoom

I’m passionate about using n8n to create realistic workflows that help working class people simplify their daily tasks. My workflows aim to make life easier by eliminating mundane, repetitive responsibilities that take up valuable time. I love turning automation into a tool that lets people focus on what matters most to them.

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34