{
  "name": "Draft personalized Outlook support email replies with Supabase RAG and OpenAI",
  "nodes": [
    {
      "id": "ad82d0b6-3eda-41c6-9f41-e18351dd0798",
      "name": "Template Header",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        112
      ],
      "parameters": {
        "width": 542,
        "height": 498,
        "content": "## 🤖 AI Email Support Agent with RAG\n\n**Overview**\nThis workflow automates email responses by combining CRM data (Supabase) with technical knowledge (Vector Store) to draft accurate, personalized repl"
      }
    },
    {
      "id": "bbab8f96-a08c-4a19-b6c9-a1d406ab3ecc",
      "name": "Context Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        80
      ],
      "parameters": {
        "width": 360,
        "height": 140,
        "content": "### 1. Context Building\nWe trigger on new emails, then immediately look up the sender in our Supabase CRM to get their Name, Role, and Department. This allows the AI to personalize the greeting."
      }
    },
    {
      "id": "c6fdb366-2567-4c91-93f9-2f436b7e71a8",
      "name": "AI Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1360,
        96
      ],
      "parameters": {
        "width": 380,
        "height": 140,
        "content": "### 2. AI Reasoning (RAG)\nThe Agent uses **GPT-4o** to analyze the email intent. It utilizes the **Vector Store Tool** to look up technical answers from your documentation before formulating a reply."
      }
    },
    {
      "id": "944780a6-03f4-4655-848f-7404c5b9c5e7",
      "name": "On Email Received",
      "type": "n8n-nodes-base.microsoftOutlookTrigger",
      "position": [
        128,
        288
      ]
    },
    {
      "id": "21d513a5-ec79-4c56-8bbc-c2731f3976e8",
      "name": "Config Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        352,
        288
      ]
    },
    {
      "id": "b8f7e691-6959-40aa-a534-1652c2933a86",
      "name": "Draft Outlook Reply",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        1568,
        288
      ]
    },
    {
      "id": "14ab319b-032d-4d4b-851c-6887c9b8ee89",
      "name": "Log to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1792,
        288
      ]
    },
    {
      "id": "5260b615-7c6d-46c3-b140-badf6563cbe9",
      "name": "AI Support Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1056,
        288
      ]
    },
    {
      "id": "03eb468a-8ac2-473d-9fda-2d0435b5cd0a",
      "name": "GPT-4o Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1008,
        544
      ]
    },
    {
      "id": "f480bfae-dbe1-417f-956e-3d7ed41836fb",
      "name": "Vector Store (Supabase)",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        1168,
        544
      ]
    },
    {
      "id": "5a9988d5-77d8-46f3-8c99-49f64fee586c",
      "name": "OpenAI Embeddings",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1168,
        752
      ]
    },
    {
      "id": "88d0d7f6-67fd-413e-b431-8e0ce97b596e",
      "name": "Build AI Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        800,
        288
      ]
    },
    {
      "id": "bba072e7-5ec6-470c-b0ca-962ef835b737",
      "name": "Fetch Contact Info",
      "type": "n8n-nodes-base.supabase",
      "position": [
        576,
        288
      ]
    }
  ],
  "connections": {
    "GPT-4o Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Support Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Build AI Prompt": {
      "main": [
        [
          {
            "node": "AI Support Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Support Agent": {
      "main": [
        [
          {
            "node": "Draft Outlook Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Config Variables": {
      "main": [
        [
          {
            "node": "Fetch Contact Info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On Email Received": {
      "main": [
        [
          {
            "node": "Config Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Embeddings": {
      "ai_embedding": [
        [
          {
            "node": "Vector Store (Supabase)",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Contact Info": {
      "main": [
        [
          {
            "node": "Build AI Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Draft Outlook Reply": {
      "main": [
        [
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Vector Store (Supabase)": {
      "ai_tool": [
        [
          {
            "node": "AI Support Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}