{
  "name": "AI-powered email automation for business: Summarize & respond with RAG",
  "nodes": [
    {
      "id": "59885699-0f6c-4522-acff-9e28b2a07b82",
      "name": "Email Trigger (IMAP)",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        -440,
        -20
      ]
    },
    {
      "id": "b268ab9d-b2e3-46e6-b7ae-70aff0b5484d",
      "name": "Markdown",
      "type": "n8n-nodes-base.markdown",
      "position": [
        -220,
        -20
      ]
    },
    {
      "id": "13c2d151-6f59-4e1f-a174-02d4d0bcaefd",
      "name": "DeepSeek R1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -20,
        160
      ]
    },
    {
      "id": "8149e40d-64e6-4fb9-aebc-2a2483961f07",
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        500,
        340
      ]
    },
    {
      "id": "633f0ce9-04ff-4653-8bbc-7457ba0d18bd",
      "name": "Qdrant Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        -320,
        600
      ]
    },
    {
      "id": "20daf5d3-dc9c-4fad-9f2f-98d86bc1660c",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        -340,
        760
      ]
    },
    {
      "id": "67699bca-4096-4259-bbd4-51a879539aca",
      "name": "Email Classifier",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        360,
        -20
      ]
    },
    {
      "id": "9f7742e9-87d5-40b9-9129-0777d8a37933",
      "name": "Email Summarization Chain",
      "type": "@n8n/n8n-nodes-langchain.chainSummarization",
      "position": [
        0,
        -20
      ]
    },
    {
      "id": "e2d404c0-2aad-407d-b75e-5ef0c5105c0e",
      "name": "Write email",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -440,
        340
      ]
    },
    {
      "id": "3786c2de-c5cb-4233-826e-7265f2bccbdb",
      "name": "Review email",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        40,
        340
      ]
    },
    {
      "id": "baf60eba-5e7b-467f-b27e-1388a91622d0",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -500,
        -980
      ]
    },
    {
      "id": "77e6160f-20a7-4a75-9fef-bc875b953a16",
      "name": "Create collection",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -200,
        -1120
      ]
    },
    {
      "id": "ab7764d1-531c-4281-8b89-015fb3f5e780",
      "name": "Refresh collection",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -200,
        -860
      ]
    },
    {
      "id": "cd3eaa81-0f94-484b-b0c2-ecf0ca4541dc",
      "name": "Get folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        20,
        -860
      ]
    },
    {
      "id": "b39ecd2d-4d5b-4885-86a9-2cfe9f6074ef",
      "name": "Download Files",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        240,
        -860
      ]
    },
    {
      "id": "8171b8f2-998d-4d72-ac28-524daae4a2d7",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        620,
        -660
      ]
    },
    {
      "id": "ec6737ad-3fbe-4864-9df8-44f82d6f2c5c",
      "name": "Token Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterTokenSplitter",
      "position": [
        600,
        -500
      ]
    },
    {
      "id": "57b6a4f3-e935-4058-bfdf-309d606c0ca9",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -1180
      ],
      "parameters": {
        "width": 880,
        "height": 220,
        "content": "# STEP 1\n\n## Create Qdrant Collection\nChange:\n- QDRANTURL\n- COLLECTION"
      }
    },
    {
      "id": "21e2326a-138d-46f3-a849-a80aa7917da9",
      "name": "Qdrant Vector Store1",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        480,
        -860
      ]
    },
    {
      "id": "0818fb6a-2adf-4725-90a4-11cdd7d14036",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        500,
        -620
      ]
    },
    {
      "id": "8949d938-2743-45d6-b2ad-ce4ac139e0a3",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        -920
      ],
      "parameters": {
        "width": 620,
        "height": 400,
        "content": "# STEP 2\n\n\n\n\n\n\n\n\n\n\n\n\n## Documents vectorization with Qdrant and Google Drive\nChange:\n- QDRANTURL\n- COLLECTION"
      }
    },
    {
      "id": "36d384be-3e11-43b1-b8c3-f63df600a6a6",
      "name": "Do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        820,
        0
      ]
    },
    {
      "id": "386c27cb-6e69-4d96-a8ab-8cfd43e6b171",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -520,
        580
      ]
    },
    {
      "id": "0bd17bef-e205-464e-9b36-dcda75254e06",
      "name": "DeepSeek",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        40,
        540
      ]
    },
    {
      "id": "3e68a65f-af29-432f-8159-4a599e8a0866",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        -320
      ],
      "parameters": {
        "width": 1620,
        "height": 240,
        "content": "# STEP 3 - MAIN FLOW\n\n- Transform the email into Markdown format for optimal reading by the LLM model\n- Email Summarization through DeepSeek R1 (any model can be used)\n- I classify the email in such a"
      }
    },
    {
      "id": "3b6ae6aa-75a8-4038-bbc2-248ab533b3ab",
      "name": "OpenAI 4-o-mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        360,
        160
      ]
    }
  ],
  "connections": {
    "OpenAI": {
      "ai_languageModel": [
        [
          {
            "node": "Write email",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "DeepSeek": {
      "ai_languageModel": [
        [
          {
            "node": "Review email",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Markdown": {
      "main": [
        [
          {
            "node": "Email Summarization Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get folder": {
      "main": [
        [
          {
            "node": "Download Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DeepSeek R1": {
      "ai_languageModel": [
        [
          {
            "node": "Email Summarization Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Write email": {
      "main": [
        [
          {
            "node": "Review email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Review email": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Files": {
      "main": [
        [
          {
            "node": "Qdrant Vector Store1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Token Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI 4-o-mini": {
      "ai_languageModel": [
        [
          {
            "node": "Email Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Email Classifier": {
      "main": [
        [
          {
            "node": "Write email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Refresh collection": {
      "main": [
        [
          {
            "node": "Get folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Qdrant Vector Store1",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store": {
      "ai_tool": [
        [
          {
            "node": "Write email",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Email Trigger (IMAP)": {
      "main": [
        [
          {
            "node": "Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Summarization Chain": {
      "main": [
        [
          {
            "node": "Email Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Create collection",
            "type": "main",
            "index": 0
          },
          {
            "node": "Refresh collection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}