{
  "name": "Automate email & calendar management with Gmail, Google Calendar & GPT-4o AI",
  "nodes": [
    {
      "id": "2b6b584a-db48-414e-9469-0134dff9ebce",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        120,
        240
      ]
    },
    {
      "id": "61207c74-2086-4ee1-8bdf-96056534e509",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        720,
        420
      ]
    },
    {
      "id": "c6e43767-eb96-4557-88ac-f5a5ca9f00cc",
      "name": "Window Buffer Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        880,
        420
      ]
    },
    {
      "id": "912b82ce-e8c1-45bd-9ddf-d6b269de94c3",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        120,
        80
      ]
    },
    {
      "id": "fdb327a9-dcce-41ee-b6e8-d84a3d6ef9b9",
      "name": "sessionId-master",
      "type": "n8n-nodes-base.noOp",
      "position": [
        600,
        240
      ]
    },
    {
      "id": "2d3c1764-fc33-4142-ad56-da4eb3231090",
      "name": "Get last emails",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        540,
        760
      ]
    },
    {
      "id": "b3f00e8e-4354-43fe-8ee2-b8a86a79a1ea",
      "name": "Get calendar events",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        1160,
        800
      ]
    },
    {
      "id": "acfd68ec-4c61-437c-a0e4-95d676d995e6",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        100,
        -860
      ],
      "parameters": {
        "width": 1500,
        "height": 720,
        "content": "## Email Sorting Agent\n"
      }
    },
    {
      "id": "e9526541-84cd-4b98-a24e-9c7e5d8d3d0d",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        1840,
        -760
      ]
    },
    {
      "id": "22156318-e308-41a9-aa9e-df1fc40a85b5",
      "name": "Gmail - get recent Threads",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2140,
        -560
      ]
    },
    {
      "id": "c26da13c-8d94-48fc-a62e-05c21340ca06",
      "name": "Gmail1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2360,
        -560
      ]
    },
    {
      "id": "7d69096c-6a05-4ad3-9428-1cef0d76205c",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        2780,
        -240
      ]
    },
    {
      "id": "583787f7-b378-43f7-9737-189b2fd29855",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        3020,
        -380
      ]
    },
    {
      "id": "d889a564-d810-430f-8470-eecac9717d7a",
      "name": "Token Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterTokenSplitter",
      "position": [
        3040,
        -240
      ]
    },
    {
      "id": "38842f34-bbd4-40d2-a636-3b42b51f3566",
      "name": "Code - Summarize Email Thread as Text",
      "type": "n8n-nodes-base.code",
      "position": [
        2580,
        -560
      ]
    },
    {
      "id": "6dde2109-42ca-4cf9-885e-5d928949b9ad",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1800,
        960
      ]
    },
    {
      "id": "fd638fb0-db5f-43fc-816d-6c5462204982",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2080,
        760
      ]
    },
    {
      "id": "18985af7-84c9-4c86-9e9f-a42f2b0bc216",
      "name": "Delete an email",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        900,
        780
      ]
    },
    {
      "id": "e59a937e-7392-4348-a7d3-1973c69f1d2f",
      "name": "Create an Email Draft as response to a thread",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        580,
        920
      ]
    },
    {
      "id": "7002b9d3-01b2-4dd0-8a33-258c17836330",
      "name": "Create an New Email Draft",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        740,
        760
      ]
    },
    {
      "id": "350497b8-4acb-49e2-ad26-e55cd51c30f3",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        500,
        660
      ],
      "parameters": {
        "width": 520,
        "height": 460,
        "content": "## Email Access Tools"
      }
    },
    {
      "id": "56ba48de-1190-4fc2-bac0-1d2a3eac6cb6",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1100,
        660
      ],
      "parameters": {
        "width": 520,
        "height": 460,
        "content": "## Calender Access Tools"
      }
    },
    {
      "id": "86aaa5cf-47e3-4a31-9116-2f09d98ed559",
      "name": "Add an calender entry",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        1360,
        800
      ]
    },
    {
      "id": "14bfc40d-0efb-4b00-a77b-917166a278a1",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1700,
        500
      ],
      "parameters": {
        "width": 520,
        "height": 620,
        "content": "## Knowlede about past email conversations"
      }
    },
    {
      "id": "83470865-9e68-4ee9-ba7d-5f6130a71b4d",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        240,
        -540
      ]
    },
    {
      "id": "00b10246-a5a3-4ea5-a570-e109821e6b8d",
      "name": "OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        560,
        -300
      ]
    },
    {
      "id": "7ed7143e-4e63-40cc-bfd2-82405057ef79",
      "name": "Gmail label as kunde",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1200,
        -640
      ]
    },
    {
      "id": "8d2ffc73-3fe3-48ed-a4b4-e4e9707435ff",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1740,
        -900
      ],
      "parameters": {
        "width": 1680,
        "height": 780,
        "content": "## Email Thread Knowledge adder"
      }
    },
    {
      "id": "1b6b3558-6bd5-49c6-85b5-d8661f204f26",
      "name": "Get an email by MessageID",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        800,
        940
      ]
    },
    {
      "id": "bbdfdfd9-f35d-4e02-aa31-6ad39ba27b4d",
      "name": "Research context and infos in previous conversations",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "position": [
        1840,
        560
      ]
    },
    {
      "id": "f52a8a15-2a2c-4191-ad87-2a1a1a714896",
      "name": "Gmail - Label as Colleges",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1200,
        -800
      ]
    },
    {
      "id": "72bf9803-02ce-48a9-bf6a-e64ab211ddf6",
      "name": "EMail Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1060,
        240
      ]
    },
    {
      "id": "76fa4e5c-110f-48b1-86f0-7fc7302b7f66",
      "name": "Classify Emails",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        560,
        -680
      ]
    },
    {
      "id": "c6bb5664-fa45-4f80-af22-97786da79deb",
      "name": "Write - Threads History Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        2900,
        -560
      ]
    },
    {
      "id": "62cb4909-8dd1-4a5e-b0c8-cc8a6e708433",
      "name": "Read- Threads History Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        2820,
        -760
      ]
    },
    {
      "id": "e0e0b246-0091-4cef-97ea-18f1b48d9dd9",
      "name": "Threads History Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        1780,
        780
      ]
    },
    {
      "id": "c3cff5e3-24a0-4272-9e43-ea781784f64d",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -460,
        0
      ],
      "parameters": {
        "width": 480,
        "height": 440,
        "content": "## Main Inbox Assistance Agent\n\n### Before Using\n** Modify the classifier agent for your needs. Add the Labels in GMail before, if you want to assign labels.\n** Add proper credentials\n** Modify the Pr"
      }
    },
    {
      "id": "ef343339-b6c5-4cde-bf74-89e6e254a337",
      "name": "Determine the name of the day of the week",
      "type": "n8n-nodes-base.dateTimeTool",
      "position": [
        1240,
        960
      ]
    }
  ],
  "connections": {
    "Gmail1": {
      "main": [
        [
          {
            "node": "Code - Summarize Email Thread as Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "EMail Agent": {
      "main": [
        []
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Classify Emails",
            "type": "main",
            "index": 0
          },
          {
            "node": "Gmail - get recent Threads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Token Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Classify Emails": {
      "main": [
        [
          {
            "node": "Gmail - Label as Colleges",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gmail label as kunde",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete an email": {
      "ai_tool": [
        [
          {
            "node": "EMail Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get last emails": {
      "ai_tool": [
        [
          {
            "node": "EMail Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "sessionId-master": {
      "main": [
        [
          {
            "node": "EMail Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Read- Threads History Vector Store",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "Write - Threads History Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "EMail Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Threads History Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Research context and infos in previous conversations",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Classify Emails",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Write - Threads History Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Get calendar events": {
      "ai_tool": [
        [
          {
            "node": "EMail Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "EMail Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Add an calender entry": {
      "ai_tool": [
        [
          {
            "node": "EMail Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create an New Email Draft": {
      "ai_tool": [
        [
          {
            "node": "EMail Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get an email by MessageID": {
      "ai_tool": [
        [
          {
            "node": "EMail Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail - get recent Threads": {
      "main": [
        [
          {
            "node": "Gmail1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "sessionId-master",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Threads History Vector Store": {
      "ai_vectorStore": [
        [
          {
            "node": "Research context and infos in previous conversations",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "sessionId-master",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Gmail - get recent Threads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Summarize Email Thread as Text": {
      "main": [
        [
          {
            "node": "Write - Threads History Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Determine the name of the day of the week": {
      "ai_tool": [
        [
          {
            "node": "EMail Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create an Email Draft as response to a thread": {
      "ai_tool": [
        [
          {
            "node": "EMail Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Research context and infos in previous conversations": {
      "ai_tool": [
        [
          {
            "node": "EMail Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}