{
  "name": "Summarize and answer Re:amaze support emails with Gemini and SOP knowledge base",
  "nodes": [
    {
      "id": "1d609dce-2e65-4057-a331-2bc4d8dd7389",
      "name": "Email Category Classifier",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        1936,
        352
      ]
    },
    {
      "id": "f0f808d2-3929-48d1-9c19-d8e262f6f580",
      "name": "LLM Response Generator",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        2288,
        576
      ]
    },
    {
      "id": "c5a5fa56-632e-4890-b929-e282bea45fac",
      "name": "Structured Response",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2544,
        576
      ]
    },
    {
      "id": "2d84abda-69d1-4d8a-a6c7-f82daaf289cf",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 476,
        "height": 1136,
        "content": "## Try It Out!\n### This template demonstrates a production-ready AI support automation system built specifically for Re:amaze, enabling automated email handling, intent classification & SOP-based deci"
      }
    },
    {
      "id": "64ac5650-5c50-489d-b345-9dac668fee4b",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        768,
        16
      ],
      "parameters": {
        "width": 632,
        "height": 492,
        "content": "## 📥 Fetch & Prepare Conversations\n\nThis section retrieves conversations from Re:amaze using API.\n\nSteps:\n- Fetch all conversations\n- Split them into individual messages\n- Sort messages so the latest "
      }
    },
    {
      "id": "1daacb63-e1b3-408a-9438-e4d143d8911a",
      "name": "AI Support Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2352,
        352
      ]
    },
    {
      "id": "8b62ff65-7d41-4072-bd2d-3e5df0a49dcb",
      "name": "Manual Trigger (Test Workflow)",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        592,
        352
      ]
    },
    {
      "id": "68c6ef93-566c-4de4-98e4-189d6fa67012",
      "name": "Fetch Conversations from Re:amaze API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        816,
        352
      ]
    },
    {
      "id": "f422ca93-dd2f-4b2a-9faa-de67e8890446",
      "name": "Split Conversations into Individual Messages",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1040,
        352
      ]
    },
    {
      "id": "4a29db83-1d66-45a6-b79a-bf54a01c7001",
      "name": "Sort Messages by Latest First",
      "type": "n8n-nodes-base.sort",
      "position": [
        1264,
        352
      ]
    },
    {
      "id": "9b8e3e4d-f30a-44e6-8527-cc665889b96e",
      "name": "Remove Duplicate Conversations (Prevent Double Reply)",
      "type": "n8n-nodes-base.removeDuplicates",
      "position": [
        1488,
        352
      ]
    },
    {
      "id": "771fcd2c-3a87-417f-b0ce-bcac9eeb8ae6",
      "name": "Filter Only Customer Emails",
      "type": "n8n-nodes-base.if",
      "position": [
        1712,
        352
      ]
    },
    {
      "id": "34ddfabc-8275-47f1-9b23-6349d65bcc90",
      "name": "📚 Knowledge Base",
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "position": [
        2416,
        576
      ]
    },
    {
      "id": "7361bcc6-1dd4-4f92-90e7-d092e991c1ed",
      "name": "Prepare Final Response",
      "type": "n8n-nodes-base.set",
      "position": [
        2752,
        352
      ]
    },
    {
      "id": "e59fc69f-e2a1-4041-bb9b-2fdf764fecfc",
      "name": "Send Reply to Customer (Re:amaze API)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2976,
        352
      ]
    },
    {
      "id": "c4f1a478-8065-42d9-93e8-c024d58ea6c0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        16
      ],
      "parameters": {
        "width": 472,
        "height": 492,
        "content": "## ⚠️ Deduplication & Filtering\n\nThis section ensures only valid customer messages are processed.\n\n- Removes duplicate conversations to prevent multiple replies\n- Filters only customer emails using:\n "
      }
    },
    {
      "id": "5ab619b0-30b2-4b2b-a6f3-91ecfc76c0f5",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1936,
        0
      ],
      "parameters": {
        "width": 354,
        "height": 512,
        "content": "## 🧠 Email Intent Classification\nThe model analyzes the email and predicts a category.\n\nSupported categories:\n• setup\n• pricing\n• security\n• hr\n• escalate_support\n• escalate_sales\n• escalate_legal\n• s"
      }
    },
    {
      "id": "299d325a-f72d-4887-ba68-91d7ffd77c1b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2320,
        0
      ],
      "parameters": {
        "width": 776,
        "height": 508,
        "content": "## 🤖 AI Response Generation & Reply\n\nThis section generates and sends the final response.\n\n- AI uses SOP-based knowledge to create accurate replies\n- Ensures responses are consistent and controlled (n"
      }
    }
  ],
  "connections": {
    "AI Support Agent": {
      "main": [
        [
          {
            "node": "Prepare Final Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Response": {
      "ai_outputParser": [
        [
          {
            "node": "AI Support Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "📚 Knowledge Base": {
      "ai_tool": [
        [
          {
            "node": "AI Support Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "LLM Response Generator": {
      "ai_languageModel": [
        [
          {
            "node": "AI Support Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Final Response": {
      "main": [
        [
          {
            "node": "Send Reply to Customer (Re:amaze API)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Category Classifier": {
      "main": [
        [
          {
            "node": "AI Support Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Only Customer Emails": {
      "main": [
        [
          {
            "node": "Email Category Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sort Messages by Latest First": {
      "main": [
        [
          {
            "node": "Remove Duplicate Conversations (Prevent Double Reply)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Trigger (Test Workflow)": {
      "main": [
        [
          {
            "node": "Fetch Conversations from Re:amaze API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Conversations from Re:amaze API": {
      "main": [
        [
          {
            "node": "Split Conversations into Individual Messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Conversations into Individual Messages": {
      "main": [
        [
          {
            "node": "Sort Messages by Latest First",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Duplicate Conversations (Prevent Double Reply)": {
      "main": [
        [
          {
            "node": "Filter Only Customer Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}