AutomationFlowsAI & RAG › Summarize Gmail Emails with Gemini and Send an HTML Action Digest

Summarize Gmail Emails with Gemini and Send an HTML Action Digest

ByMohammed Aljer @m-j on n8n.io

This template is for anyone who wants a quick, structured inbox review (founders, freelancers, support, operations) without reading every email.

Event trigger★★★★☆ complexityAI-powered26 nodesGoogle Gemini ChatOutput Parser StructuredGmailAgent
AI & RAG Trigger: Event Nodes: 26 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #13126 — 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 →

Download .json
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "1f043ca0-24bf-401a-9ca8-b98da78a3794",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1968,
        -944
      ],
      "parameters": {
        "width": 608,
        "height": 816,
        "content": "## Workflow overview\n\n### Who it\u2019s for\nAnyone who wants a fast, structured inbox review (founders, freelancers, support, ops).\n\n### What this workflow does\n- Runs every 12 hours (Schedule Trigger).\n- Fetches Gmail emails received after a calculated timestamp (now - 12 hours).\n- For each email: normalize fields \u2192 filter Inbox \u2192 AI extracts summary/action/priority \u2192 build a Gmail \u201cOpen message\u201d link using **rfc822msgid** (Search Link).\n- Aggregates all results and sends one HTML digest email.\n\n### Recommended AI model\nUse **Gemini 2.5 Flash** for fast, reliable structured output (if you don\u2019t see the model, pick the closest available model in your account/region).\n\n### Required setup before running\n- Add your own Gmail OAuth2 credentials (Fetch Emails / Send Summary / No Emails).\n- Add your own LLM credentials (Google Gemini Chat Model). [web:170]\n- Set the recipient email: update send To in \u201cSend Summary\u201d and \u201cNo Emails\u201d (or replace with a variable in a Config/Set node).\n\n### Requirements\n- Gmail account + Gmail OAuth2 credentials in n8n.\n- Google Gemini API credentials.\n\n### Customizing this workflow\n- Change the lookback window (12 hours \u2192 24 hours, etc.).\n- Adjust the AI prompt rules (priority/action style).\n- Customize the HTML digest design.\n- Remove the Inbox filter if you want other labels.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "aed906a4-b580-478c-a35f-1be5cb79b87f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -288
      ],
      "parameters": {
        "color": 7,
        "width": 784,
        "height": 736,
        "content": "### Build digest & send:\nCreates Gmail deep link per email, aggregates results, and sends one HTML digest."
      },
      "typeVersion": 1
    },
    {
      "id": "35d132a0-12d1-4c6a-8657-010a7fa96f79",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1120,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 656,
        "height": 560,
        "content": "### Fetch & prepare emails\nFetch Gmail emails since receivedAfter, then normalize fields (From/To/snippet/messageId) and keep Inbox only."
      },
      "typeVersion": 1
    },
    {
      "id": "e87d4152-2188-4f95-9931-8cd6e688191e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1968,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 384,
        "height": 560,
        "content": "### Triggers\nRuns every 12 hours (schedule) or via manual test. Both paths go into the same flow."
      },
      "typeVersion": 1
    },
    {
      "id": "6ecfd5e7-ad6f-4e74-a09f-eb6c4a08652d",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        -288
      ],
      "parameters": {
        "color": 7,
        "width": 336,
        "height": 736,
        "content": "### AI extraction: \nGemini analyzes each email and outputs structured JSON: summary, action, priority, recipient."
      },
      "typeVersion": 1
    },
    {
      "id": "78352d23-a535-4c0e-a7fa-3d3f59ef9bca",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1552,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 560,
        "content": "### Config & Time window\n**Config (edit me)**  \nSet `recipientEmail` here. All Gmail nodes use it.\n\n**Time window**  \n\"Now - 12h\" timestamp for Gmail filter. Edit `hours: 12` \u2192 `24` for daily."
      },
      "typeVersion": 1
    },
    {
      "id": "56c09543-477d-4224-975f-7a35ace3dbcc",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -432,
        -288
      ],
      "parameters": {
        "color": 7,
        "width": 752,
        "height": 736,
        "content": "### Empty run handling\nIf: any emails found?\nChecks if emails exist. True \u2192 process. False \u2192 send \"No new emails\" HTML.\n### Send \"no new emails\" email\nUses\u00a0recipientEmail\u00a0from Config. Predictable schedule behavior.\n### Build Gmail link\nBuild Gmail \"Open message\" link\nExtracts\u00a0TO\u00a0email \u2192 builds\u00a0rfc822msgid:\u00a0deep link. Opens exact email in Gmail."
      },
      "typeVersion": 1
    },
    {
      "id": "e0b8e04e-9f77-4e98-b288-93665c16750f",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        432,
        320
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "b713c822-51a1-4677-8b91-248a77dddcc4",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        576,
        320
      ],
      "parameters": {
        "jsonSchemaExample": "[\n  {\n    \"email\": \"Person responsible (if known, else use 'Unspecified')\",\n    \"action\": \"What needs to be done\",\n    \"priority\": \"high | normal | low\",\n    \"summary\": \"Brief summary of the email content\",\n    \"recipient\":\"Who was the email sent to\" \n  }\n]"
      },
      "typeVersion": 1.3
    },
    {
      "id": "2f7413dc-39bc-475f-aeba-8c9e3ae21787",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        192,
        208
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b7bf6d3d-d9be-4e21-8117-f33815ca377f",
      "name": "No Operation, do nothing1",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -416,
        304
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c7a1a197-1bb7-4a1a-85f5-c050b7c54ce6",
      "name": "When clicking \u2018Test workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1824,
        128
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "31b1cb59-1790-42a3-8b96-cd3ca88fdde4",
      "name": "Run every 12 hours",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1824,
        -16
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 12
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6f258bf4-eae4-4b3f-93b7-7ce6614a48ac",
      "name": "Compute receivedAfter (now - 12h)",
      "type": "n8n-nodes-base.dateTime",
      "position": [
        -1328,
        128
      ],
      "parameters": {
        "date": "={{ $now.minus({ hours: 12 }).toISO() }}",
        "format": "x",
        "options": {},
        "operation": "formatDate"
      },
      "typeVersion": 2
    },
    {
      "id": "e66d8d44-b112-4534-bc2f-9c53ee26e050",
      "name": "Fetch Gmail emails (receivedAfter)",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -1104,
        128
      ],
      "parameters": {
        "simple": false,
        "filters": {
          "receivedAfter": "={{ $json.formattedDate }}"
        },
        "options": {},
        "operation": "getAll",
        "returnAll": true
      },
      "typeVersion": 2.1,
      "alwaysOutputData": true
    },
    {
      "id": "6cd89664-23cd-4422-b448-c9f51ea6b76f",
      "name": "Normalize email fields (From/To/snippet/messageId)",
      "type": "n8n-nodes-base.set",
      "position": [
        -896,
        128
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "decdd8a4-bb5c-4ed2-af01-0b9ef4d37b1a",
              "name": "id",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "064e10f4-e85b-4eaf-af9d-de91e9f39f7a",
              "name": "Body",
              "type": "string",
              "value": "={{ $json.text }}"
            },
            {
              "id": "60796d3f-31cf-4210-b41e-84a4659d05b9",
              "name": "From",
              "type": "string",
              "value": "={{ $json.from.text }}"
            },
            {
              "id": "21eee509-5854-4180-926a-c943afab1889",
              "name": "TO",
              "type": "string",
              "value": "={{ $json.to.text }}"
            },
            {
              "id": "a069836b-17ae-4baa-b779-4fb103bbbba4",
              "name": "Subject",
              "type": "string",
              "value": "={{ $json.subject }}"
            },
            {
              "id": "d15239f9-e8ce-469d-80b2-fb1f4f8e7c05",
              "name": "messageId",
              "type": "string",
              "value": "={{ $json.messageId }}"
            },
            {
              "id": "77941533-53ea-4f49-9bef-851e968c0c8f",
              "name": "location",
              "type": "string",
              "value": "={{ $json.labelIds.includes('INBOX') ? 'Inbox' : ($json.labelIds.includes('SENT') ? 'Sent' : 'Other') }}"
            },
            {
              "id": "ddff66e7-a25f-41db-8513-c217448e128d",
              "name": "html",
              "type": "string",
              "value": "={{ $json.html.replace(/<[^>]*>/g, '') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7abcb5ca-b6fd-47f6-82cd-674e6268dd5d",
      "name": "Filter: Inbox only",
      "type": "n8n-nodes-base.if",
      "position": [
        -640,
        128
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "9114b6a0-a2a7-47f3-8128-d779d324a26d",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.location }}",
              "rightValue": "Inbox"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "8d78f0c4-97c0-406f-bc76-0d0dbc915512",
      "name": "If: any emails found?",
      "type": "n8n-nodes-base.if",
      "position": [
        -416,
        112
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "abf11dc4-3b7e-4750-819a-796b34c04bf1",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "88165175-2d59-4cdf-996e-9008bcd990a8",
      "name": "Build Gmail \u201cOpen message\u201d link",
      "type": "n8n-nodes-base.set",
      "position": [
        -16,
        -64
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "345f8cf2-1da7-45c7-81ac-941ee1d444a8",
              "name": "link",
              "type": "string",
              "value": "=https://mail.google.com/mail/u/{{ $json.TO.match(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}/g)[0] }}/#search/rfc822msgid:{{ encodeURIComponent($json.messageId.slice(1, -1)) }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "9fda7f18-e987-49f8-80cf-e684d785f240",
      "name": "AI: extract summary, action, priority",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        432,
        96
      ],
      "parameters": {
        "text": "=You are a highly efficient AI assistant specializing in email analysis and data extraction.\n\nYour primary task is to analyze the provided email data and use the `Structured Output Parser` tool to format the extracted information. Adhere strictly to the field descriptions below.\n\n**Field Extraction Rules:**\n\n* **sender_email**: From the 'From' input, you MUST extract ONLY the email address part (the text containing '@'). Ignore any names.\n    * Example 1: If 'From' is `Email_example`, the output for \"sender_email\" MUST be `premium@linkedin.com`.\n    * Example 2: If 'From' is `Email_example`, the output for \"sender_email\" MUST be `jobs@mail.xing.com`.\n* **action**: Describe the main action required from the email in a clear, concise phrase. If no specific action is needed, use \"Review\" or \"No action required\".\n* **priority**: Assign a priority based on these strict criteria:\n    * `high`: For urgent requests, time-sensitive approvals, meeting invitations, or critical security alerts.\n    * `normal`: For general updates, collaboration notes, non-urgent questions, or standard notifications.\n    * `low`: For newsletters, promotional content, social media notifications, or automated non-critical reports.\n* **summary**: Write a brief, one-sentence summary of the email's main point.\n* **recipient**: The recipient(s) of the email. Write just the email address.\n  Example: \"To\": \n\"\\\"Email_example\\\" \" or \"TO\": \"Email_example\" or \"To\": \n\"\"\n\nyou will recive **Snippet** as html and you have to find the email body from it.\n**Input Email Data:**\n\n* **From**: `{{ $('If: any emails found?').item.json.From }}`\n* **To**: `{{ $('If: any emails found?').item.json.TO }}`\n* **Snippet**: `{{ $('If: any emails found?').item.json.html }}`\n\nNow, analyze the data and call the `Structured Output Parser` tool with the correctly extracted values.",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 2.2,
      "waitBetweenTries": 500
    },
    {
      "id": "b40f687a-d573-4a9c-8278-3e82609a908b",
      "name": "Merge: link + AI result",
      "type": "n8n-nodes-base.merge",
      "position": [
        912,
        80
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.2
    },
    {
      "id": "2090f168-5a72-4c08-8158-39d1919c7fbf",
      "name": "Aggregate: build digest list",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1120,
        80
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "f07b9d41-c67a-4b26-a96a-c2f72ec093d3",
      "name": "Send HTML digest email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1312,
        80
      ],
      "parameters": {
        "sendTo": "={{ $('Config (edit me)').item.json.recipientEmail }}",
        "message": "=<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\" />\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  <title>Email Summary</title>\n  <style type=\"text/css\">\n    body { margin:0; padding:0; background:#eef6f1; }\n    a { color:#007A3D; text-decoration:underline; }\n    .wrap { width:600px; max-width:600px; }\n    @media only screen and (max-width: 640px) {\n      .wrap { width:100% !important; }\n      .px { padding-left:16px !important; padding-right:16px !important; }\n    }\n  </style>\n</head>\n\n<body style=\"margin:0; padding:0; background:#eef6f1;\">\n  <table role=\"presentation\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"background:#eef6f1;\">\n    <tr>\n      <td align=\"center\" style=\"padding:18px 12px;\">\n        <table role=\"presentation\" class=\"wrap\" width=\"600\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"width:600px; max-width:600px;\">\n          <tr>\n            <td style=\"background:#007A3D; color:#ffffff; border-radius:14px; padding:18px 18px;\">\n              <div style=\"font-family:Arial,Helvetica,sans-serif; font-size:20px; line-height:26px; font-weight:bold;\">\n                Email Summary & Actions\n              </div>\n              <div style=\"font-family:Arial,Helvetica,sans-serif; font-size:12px; line-height:18px; opacity:0.95; margin-top:4px;\">\n                A clean digest of your latest emails\n              </div>\n            </td>\n          </tr>\n\n          <tr>\n            <td style=\"padding:12px 0 0 0;\"></td>\n          </tr>\n\n          <tr>\n            <td style=\"background:#ffffff; border:1px solid #e6e6e6; border-radius:14px; overflow:hidden;\">\n              <table role=\"presentation\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n                <tr>\n                  <td class=\"px\" style=\"padding:16px 18px 6px 18px;\">\n                    <div style=\"font-family:Arial,Helvetica,sans-serif; font-size:13px; line-height:18px; color:#666;\">\n                      Items\n                    </div>\n                  </td>\n                </tr>\n\n                <tr>\n                  <td class=\"px\" style=\"padding:0 18px 18px 18px;\">\n                    {{ $json.data.map(item => {\n                      const o = (item.output && item.output[0]) ? item.output[0] : {};\n                      const priority = ((o.priority ? String(o.priority) : 'normal')).toLowerCase();\n                      const leftColor = priority === 'high' ? '#d9534f' : (priority === 'low' ? '#6b6e6b' : '#007A3D');\n                      const pillBg = priority === 'high' ? '#fbe9e8' : (priority === 'low' ? '#efefef' : '#e6f3ec');\n\n                      const sender = o.email ? String(o.email) : 'Unknown sender';\n                      const recipient = o.recipient ? String(o.recipient) : 'Unknown recipient';\n                      const summary = o.summary ? String(o.summary) : '';\n                      const action = o.action ? String(o.action) : '';\n                      const link = item.link ? String(item.link) : '#';\n\n                      return `\n                        <table role=\"presentation\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"\n                               style=\"margin:0 0 12px 0; border:1px solid #eeeeee; border-radius:12px; overflow:hidden; background:#ffffff;\">\n                          <tr>\n                            <td style=\"width:8px; background:${leftColor}; font-size:0; line-height:0;\">&nbsp;</td>\n                            <td style=\"padding:14px 14px;\">\n                              <table role=\"presentation\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n                                <tr>\n                                  <td align=\"left\" style=\"padding:0;\">\n                                    <div style=\"font-family:Arial,Helvetica,sans-serif; font-size:14px; line-height:20px;\">\n                                      <span style=\"font-weight:bold; color:#007A3D;\">${sender}</span>\n                                      <span style=\"color:#999;\"> \u2192 </span>\n                                      <span style=\"color:#333;\">${recipient}</span>\n                                    </div>\n                                  </td>\n                                  <td align=\"right\" style=\"padding:0; white-space:nowrap;\">\n                                    <span style=\"display:inline-block; padding:4px 10px; border-radius:999px; font-family:Arial,Helvetica,sans-serif; font-size:11px; font-weight:bold; background:${pillBg}; color:${leftColor};\">\n                                      ${priority}\n                                    </span>\n                                  </td>\n                                </tr>\n\n                                ${summary ? `\n                                <tr>\n                                  <td colspan=\"2\" style=\"padding:10px 0 0 0;\">\n                                    <div style=\"font-family:Arial,Helvetica,sans-serif; font-size:13px; line-height:19px; color:#333;\">\n                                      <span style=\"font-weight:bold; color:#444;\">Summary:</span>\n                                      <span style=\"color:#111;\">${summary}</span>\n                                    </div>\n                                  </td>\n                                </tr>\n                                ` : ''}\n\n                                ${action ? `\n                                <tr>\n                                  <td colspan=\"2\" style=\"padding:8px 0 0 0;\">\n                                    <div style=\"font-family:Arial,Helvetica,sans-serif; font-size:13px; line-height:19px; color:#333;\">\n                                      <span style=\"font-weight:bold; color:#444;\">Action:</span>\n                                      <span style=\"color:#111;\">${action}</span>\n                                    </div>\n                                  </td>\n                                </tr>\n                                ` : ''}\n\n                                <tr>\n                                  <td colspan=\"2\" style=\"padding:12px 0 0 0;\">\n                                    <a href=\"${link}\" target=\"_blank\"\n                                       style=\"font-family:Arial,Helvetica,sans-serif; font-size:12px; font-weight:bold; color:#007A3D; text-decoration:underline;\">\n                                      Open message\n                                    </a>\n                                  </td>\n                                </tr>\n                              </table>\n                            </td>\n                          </tr>\n                        </table>\n                      `;\n                    }).join('') }}\n                  </td>\n                </tr>\n\n                <tr>\n                  <td style=\"background:#007A3D; color:#ffffff; text-align:center; padding:12px 18px;\">\n                    <div style=\"font-family:Arial,Helvetica,sans-serif; font-size:12px; line-height:18px;\">\n                      Generated by MJ-n8n Summarize AI Agent\n                    </div>\n                  </td>\n                </tr>\n\n              </table>\n            </td>\n          </tr>\n        </table>\n      </td>\n    </tr>\n  </table>\n</body>\n</html>\n",
        "options": {
          "ccList": "",
          "appendAttribution": false,
          "replyToSenderOnly": false
        },
        "subject": "=Email Summary"
      },
      "typeVersion": 2.1
    },
    {
      "id": "83bcea59-9616-4a0a-b9e0-9bfe2bf00c35",
      "name": "Send \u201cno new emails\u201d email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -16,
        208
      ],
      "parameters": {
        "sendTo": "={{ $('Config (edit me)').item.json.recipientEmail }}",
        "message": "=<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Email Details</title>\n    <style>\n        body {\n            font-family: Arial, sans-serif;\n            margin: 0;\n            padding: 0;\n            background-color: #f9f9f9;\n            color: #333;\n            line-height: 1.6;\n        }\n        .email-container {\n            max-width: 600px;\n            margin: 20px auto;\n            background: #ffffff;\n            border: 1px solid #ddd;\n            border-radius: 10px;\n            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);\n        }\n        .email-header {\n            background-color: #007A3D;\n            color: #fff;\n            padding: 20px;\n            text-align: center;\n            border-top-left-radius: 10px;\n            border-top-right-radius: 10px;\n        }\n        .email-header h1 {\n            margin: 0;\n            font-size: 24px;\n        }\n        .email-content {\n            padding: 20px;\n        }\n        .email-footer {\n            background-color: #007A3D;\n            color: #fff;\n            text-align: center;\n            padding: 10px;\n            font-size: 14px;\n            border-bottom-left-radius: 10px;\n            border-bottom-right-radius: 10px;\n        }\n        .no-emails-message {\n            text-align: center;\n            padding: 40px 20px;\n            color: #333;\n            font-size: 18px;\n            font-weight: bold;\n        }\n    </style>\n</head>\n<body>\n    <div class=\"email-container\">\n        <div class=\"email-header\">\n            <h1>Email Summary & Actions</h1>\n        </div>\n        <div class=\"email-content\">\n            <div class=\"no-emails-message\">No new emails in the past 12 hours.</div>\n        </div>\n        <div class=\"email-footer\">\n            <p>Generated by MJ-n8n Summarize AI Agent<br />\n        </div>\n    </div>\n</body>\n</html>",
        "options": {},
        "subject": "=Email Summary"
      },
      "typeVersion": 2.1
    },
    {
      "id": "9ccaa82b-3ee8-491a-b1ab-7b49f088a511",
      "name": "Config (edit me)",
      "type": "n8n-nodes-base.set",
      "position": [
        -1536,
        128
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2014da21-4276-4bfb-b0eb-f59978a1a84d",
              "name": "recipientEmail",
              "type": "string",
              "value": ""
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ccc87453-9861-4386-a607-04378d408453",
      "name": "No Operation, do nothing2",
      "type": "n8n-nodes-base.noOp",
      "position": [
        480,
        -64
      ],
      "parameters": {},
      "typeVersion": 1
    }
  ],
  "connections": {
    "Config (edit me)": {
      "main": [
        [
          {
            "node": "Compute receivedAfter (now - 12h)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter: Inbox only": {
      "main": [
        [
          {
            "node": "If: any emails found?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run every 12 hours": {
      "main": [
        [
          {
            "node": "Config (edit me)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If: any emails found?": {
      "main": [
        [
          {
            "node": "Build Gmail \u201cOpen message\u201d link",
            "type": "main",
            "index": 0
          },
          {
            "node": "AI: extract summary, action, priority",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send \u201cno new emails\u201d email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge: link + AI result": {
      "main": [
        [
          {
            "node": "Aggregate: build digest list",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI: extract summary, action, priority",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI: extract summary, action, priority",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "No Operation, do nothing2": {
      "main": [
        [
          {
            "node": "Merge: link + AI result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate: build digest list": {
      "main": [
        [
          {
            "node": "Send HTML digest email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send \u201cno new emails\u201d email": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compute receivedAfter (now - 12h)": {
      "main": [
        [
          {
            "node": "Fetch Gmail emails (receivedAfter)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Test workflow\u2019": {
      "main": [
        [
          {
            "node": "Config (edit me)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Gmail emails (receivedAfter)": {
      "main": [
        [
          {
            "node": "Normalize email fields (From/To/snippet/messageId)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Gmail \u201cOpen message\u201d link": {
      "main": [
        [
          {
            "node": "No Operation, do nothing2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI: extract summary, action, priority": {
      "main": [
        [
          {
            "node": "Merge: link + AI result",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Normalize email fields (From/To/snippet/messageId)": {
      "main": [
        [
          {
            "node": "Filter: Inbox only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This template is for anyone who wants a quick, structured inbox review (founders, freelancers, support, operations) without reading every email.

Source: https://n8n.io/workflows/13126/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

HTTP Request, Google Sheets, OpenRouter Chat +5
AI & RAG

This comprehensive n8n workflow automates the complete process of generating professional interior design moodboards from concept to client delivery. Users submit a design brief through a form, and th

Google Gemini Chat, Output Parser Structured, Tool Think +7
AI & RAG

This workflow automatically transforms your messy inbox into a neatly organized space while ensuring you never miss a critical message. It connects to your Gmail account and triggers for every new ema

Gmail Trigger, Output Parser Structured, Gmail Tool +8
AI & RAG

This automated workflow intelligently qualifies interior design leads, generates personalized client emails, and manages follow-up through a human-approval process. Built with n8n, Claude AI, Telegram

Form Trigger, Google Gemini Chat, Output Parser Structured +5
AI & RAG

This workflow automates the extraction and processing of invoice data from PDFs stored in a Google Drive folder. It leverages Google Drive, Google Sheets, and Gemini AI to streamline invoice managemen

Google Gemini Chat, Google Sheets, HTTP Request +5