{
  "name": "Summarize Gmail emails with Gemini and send an HTML action digest",
  "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’s 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- "
      }
    },
    {
      "id": "aed906a4-b580-478c-a35f-1be5cb79b87f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -288
      ],
      "parameters": {
        "width": 784,
        "height": 736,
        "content": "### Build digest & send:\nCreates Gmail deep link per email, aggregates results, and sends one HTML digest."
      }
    },
    {
      "id": "35d132a0-12d1-4c6a-8657-010a7fa96f79",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1120,
        -112
      ],
      "parameters": {
        "width": 656,
        "height": 560,
        "content": "### Fetch & prepare emails\nFetch Gmail emails since receivedAfter, then normalize fields (From/To/snippet/messageId) and keep Inbox only."
      }
    },
    {
      "id": "e87d4152-2188-4f95-9931-8cd6e688191e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1968,
        -112
      ],
      "parameters": {
        "width": 384,
        "height": 560,
        "content": "### Triggers\nRuns every 12 hours (schedule) or via manual test. Both paths go into the same flow."
      }
    },
    {
      "id": "6ecfd5e7-ad6f-4e74-a09f-eb6c4a08652d",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        -288
      ],
      "parameters": {
        "width": 336,
        "height": 736,
        "content": "### AI extraction: \nGemini analyzes each email and outputs structured JSON: summary, action, priority, recipient."
      }
    },
    {
      "id": "78352d23-a535-4c0e-a7fa-3d3f59ef9bca",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1552,
        -112
      ],
      "parameters": {
        "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` → `24` for daily."
      }
    },
    {
      "id": "56c09543-477d-4224-975f-7a35ace3dbcc",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -432,
        -288
      ],
      "parameters": {
        "width": 752,
        "height": 736,
        "content": "### Empty run handling\nIf: any emails found?\nChecks if emails exist. True → process. False → send \"No new emails\" HTML.\n### Send \"no new emails\" email\nUses recipientEmail from Config. Predictable sche"
      }
    },
    {
      "id": "e0b8e04e-9f77-4e98-b288-93665c16750f",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        432,
        320
      ]
    },
    {
      "id": "b713c822-51a1-4677-8b91-248a77dddcc4",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        576,
        320
      ]
    },
    {
      "id": "2f7413dc-39bc-475f-aeba-8c9e3ae21787",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        192,
        208
      ]
    },
    {
      "id": "b7bf6d3d-d9be-4e21-8117-f33815ca377f",
      "name": "No Operation, do nothing1",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -416,
        304
      ]
    },
    {
      "id": "c7a1a197-1bb7-4a1a-85f5-c050b7c54ce6",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1824,
        128
      ]
    },
    {
      "id": "31b1cb59-1790-42a3-8b96-cd3ca88fdde4",
      "name": "Run every 12 hours",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1824,
        -16
      ]
    },
    {
      "id": "6f258bf4-eae4-4b3f-93b7-7ce6614a48ac",
      "name": "Compute receivedAfter (now - 12h)",
      "type": "n8n-nodes-base.dateTime",
      "position": [
        -1328,
        128
      ]
    },
    {
      "id": "e66d8d44-b112-4534-bc2f-9c53ee26e050",
      "name": "Fetch Gmail emails (receivedAfter)",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -1104,
        128
      ]
    },
    {
      "id": "6cd89664-23cd-4422-b448-c9f51ea6b76f",
      "name": "Normalize email fields (From/To/snippet/messageId)",
      "type": "n8n-nodes-base.set",
      "position": [
        -896,
        128
      ]
    },
    {
      "id": "7abcb5ca-b6fd-47f6-82cd-674e6268dd5d",
      "name": "Filter: Inbox only",
      "type": "n8n-nodes-base.if",
      "position": [
        -640,
        128
      ]
    },
    {
      "id": "8d78f0c4-97c0-406f-bc76-0d0dbc915512",
      "name": "If: any emails found?",
      "type": "n8n-nodes-base.if",
      "position": [
        -416,
        112
      ]
    },
    {
      "id": "88165175-2d59-4cdf-996e-9008bcd990a8",
      "name": "Build Gmail “Open message” link",
      "type": "n8n-nodes-base.set",
      "position": [
        -16,
        -64
      ]
    },
    {
      "id": "9fda7f18-e987-49f8-80cf-e684d785f240",
      "name": "AI: extract summary, action, priority",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        432,
        96
      ]
    },
    {
      "id": "b40f687a-d573-4a9c-8278-3e82609a908b",
      "name": "Merge: link + AI result",
      "type": "n8n-nodes-base.merge",
      "position": [
        912,
        80
      ]
    },
    {
      "id": "2090f168-5a72-4c08-8158-39d1919c7fbf",
      "name": "Aggregate: build digest list",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1120,
        80
      ]
    },
    {
      "id": "f07b9d41-c67a-4b26-a96a-c2f72ec093d3",
      "name": "Send HTML digest email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1312,
        80
      ]
    },
    {
      "id": "83bcea59-9616-4a0a-b9e0-9bfe2bf00c35",
      "name": "Send “no new emails” email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -16,
        208
      ]
    },
    {
      "id": "9ccaa82b-3ee8-491a-b1ab-7b49f088a511",
      "name": "Config (edit me)",
      "type": "n8n-nodes-base.set",
      "position": [
        -1536,
        128
      ]
    },
    {
      "id": "ccc87453-9861-4386-a607-04378d408453",
      "name": "No Operation, do nothing2",
      "type": "n8n-nodes-base.noOp",
      "position": [
        480,
        -64
      ]
    }
  ],
  "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 “Open message” link",
            "type": "main",
            "index": 0
          },
          {
            "node": "AI: extract summary, action, priority",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send “no new emails” 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 “no new emails” 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 ‘Test workflow’": {
      "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 “Open message” 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
          }
        ]
      ]
    }
  }
}