{
  "name": "Draft Gmail replies with OpenAI and OpenRouter for an inbox-zero workflow",
  "nodes": [
    {
      "id": "9fb5f101-ad37-4304-b592-f96dee6396fc",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -1376,
        272
      ]
    },
    {
      "id": "1abc984c-fa4b-41f8-9a1c-a794192462a6",
      "name": "Set Content",
      "type": "n8n-nodes-base.set",
      "position": [
        -1216,
        272
      ]
    },
    {
      "id": "466274b3-b067-44f6-a083-fcafb4e0816f",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -144,
        256
      ]
    },
    {
      "id": "635200c9-c30d-4ccc-8a17-a8799a962580",
      "name": "Vector Store Tool",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "position": [
        256,
        592
      ]
    },
    {
      "id": "8f60ce91-bf19-457a-a928-d88881235845",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        400,
        864
      ]
    },
    {
      "id": "936c762e-5693-4d38-9937-0e2f5586bafa",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        128,
        896
      ]
    },
    {
      "id": "269101c3-a5aa-4189-b3d4-eaea80396d76",
      "name": "createDraft",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        240,
        192
      ]
    },
    {
      "id": "0c00511d-761c-4b8f-8946-a4f28887e485",
      "name": "Response",
      "type": "n8n-nodes-base.telegram",
      "position": [
        496,
        0
      ]
    },
    {
      "id": "df232786-7bfd-43fe-9160-6088e75ccdc2",
      "name": "Response Not Customer Support",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -384,
        512
      ]
    },
    {
      "id": "a0ee0467-d10f-429d-98c7-14875de0a7ce",
      "name": "Customer Support?",
      "type": "n8n-nodes-base.switch",
      "position": [
        -560,
        272
      ]
    },
    {
      "id": "35c02e5c-68a1-448e-9980-31eabfbbf1c4",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -1008,
        432
      ]
    },
    {
      "id": "e8b21459-dbf6-41da-aad3-1fd4f544c660",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -864,
        432
      ]
    },
    {
      "id": "c2e12c1b-751d-4f46-b2d1-e93eed52d601",
      "name": "Client/Prospect Related?",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -1008,
        272
      ]
    },
    {
      "id": "f640d916-6038-41dd-96ce-46d0100976c4",
      "name": "Vector Storage",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        128,
        752
      ]
    },
    {
      "id": "60ba060b-b29f-4df5-bb16-3aa09b522e9a",
      "name": "Email Draft Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        0,
        0
      ]
    },
    {
      "id": "main-sticky-note",
      "name": null,
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1888,
        -16
      ],
      "parameters": {
        "width": 480,
        "height": 520,
        "content": "## Auto-draft email replies with AI using Gmail and OpenAI\n\nThis workflow automatically monitors your Gmail inbox and uses AI to draft intelligent email responses. It filters out automated/system emai"
      }
    },
    {
      "id": "c161061a-77ad-41fc-904e-2452b20d002e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1104,
        192
      ],
      "parameters": {
        "width": 432,
        "height": 384,
        "content": "### Email Classification\nDetermines if the email needs your attention or is automated/system-generated"
      }
    },
    {
      "id": "6419ab0e-7bf9-4465-bf12-927198fddc0f",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        560
      ],
      "parameters": {
        "width": 560,
        "height": 464,
        "content": "### Knowledge Base (Optional)\nVector store for retrieving relevant docs when drafting responses"
      }
    },
    {
      "id": "a3a4666f-bca4-412e-858c-f206cc28254e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        -128
      ],
      "parameters": {
        "width": 640,
        "height": 528,
        "content": "### Email Drafting Agent\nGenerates AI-powered draft responses. Customise the system prompt with your writing style and business context."
      }
    },
    {
      "id": "00d64551-c72a-42da-b815-1812d14f5548",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1104,
        592
      ],
      "parameters": {
        "width": 432,
        "height": 112,
        "content": "### Customisation Required\nAdjust the classification prompt to match your use case. Change the output variable (e.g., needsMyAttention: True/False) if customerSupport isn't relevant for you."
      }
    },
    {
      "id": "f6c59bf6-79e8-41d6-bb72-430b8d82d43d",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        416
      ],
      "parameters": {
        "width": 640,
        "height": 112,
        "content": "### Customisation Required\nUpdate the system prompt with your business details, writing style, and 5-10 example emails to train the AI on your communication style."
      }
    },
    {
      "id": "notification-sticky",
      "name": null,
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        416
      ],
      "parameters": {
        "width": 320,
        "height": 288,
        "content": "### Notifications\nSends Telegram notifications for new drafts and non-support emails"
      }
    },
    {
      "id": "input-sticky",
      "name": null,
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1408,
        192
      ],
      "parameters": {
        "width": 256,
        "height": 288,
        "content": "### Email Input\nTriggers on new emails and extracts key fields"
      }
    }
  ],
  "connections": {
    "Set Content": {
      "main": [
        [
          {
            "node": "Client/Prospect Related?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "createDraft": {
      "ai_tool": [
        [
          {
            "node": "Email Draft Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Set Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Vector Storage": {
      "ai_vectorStore": [
        [
          {
            "node": "Vector Store Tool",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Customer Support?": {
      "main": [
        [
          {
            "node": "Email Draft Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response Not Customer Support",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Draft Agent": {
      "main": [
        [
          {
            "node": "Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Vector Storage",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Email Draft Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Vector Store Tool": {
      "ai_tool": [
        [
          {
            "node": "Email Draft Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Vector Store Tool",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Client/Prospect Related?",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Client/Prospect Related?": {
      "main": [
        [
          {
            "node": "Customer Support?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Client/Prospect Related?",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}