{
  "id": "Eael5MC2doHgipoj",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Auto-Sort Support Emails with AI and Route to Teams",
  "tags": [],
  "nodes": [
    {
      "id": "1cc38dd8-7be0-439c-9bff-1747c4cb41f0",
      "name": "IMAP Email",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        -1320,
        -120
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "imap": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9eafb912-b9b8-4e07-8ae3-dfd9407e12e0",
      "name": "OpenAI",
      "type": "n8n-nodes-base.openAi",
      "position": [
        -1100,
        -120
      ],
      "parameters": {
        "operation": "chat",
        "requestOptions": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "66d83acc-b961-4baf-97f4-0f4a1a7aff30",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -880,
        -141
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "3be96880-5fb2-46af-9f7d-9228b87df0fc",
      "name": "Send Billing Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -660,
        -320
      ],
      "parameters": {
        "text": "=Forwarded Email:\n\nSubject: {{$node[\"IMAP Email\"].json[\"subject\"]}}\nFrom: {{$node[\"IMAP Email\"].json[\"from\"]}}\nContent: {{$node[\"IMAP Email\"].json[\"text\"]}}",
        "options": {},
        "subject": "=Fwd: {{$node[\"IMAP Email\"].json[\"subject\"]}}",
        "toEmail": "user@example.com",
        "fromEmail": "user@example.com"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "104ae235-3ba0-45b2-b57f-6f6dbac92a75",
      "name": "Send Bug Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -660,
        -120
      ],
      "parameters": {
        "text": "=Forwarded Email:\n\nSubject: {{$node[\"IMAP Email\"].json[\"subject\"]}}\nFrom: {{$node[\"IMAP Email\"].json[\"from\"]}}\nContent: {{$node[\"IMAP Email\"].json[\"text\"]}}",
        "options": {},
        "subject": "=Fwd: {{$node[\"IMAP Email\"].json[\"subject\"]}}",
        "toEmail": "user@example.com",
        "fromEmail": "user@example.com"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "80aa19c6-86c2-43e7-9e87-61082b00eb91",
      "name": "Send Feature Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -660,
        80
      ],
      "parameters": {
        "text": "=Forwarded Email:\n\nSubject: {{$node[\"IMAP Email\"].json[\"subject\"]}}\nFrom: {{$node[\"IMAP Email\"].json[\"from\"]}}\nContent: {{$node[\"IMAP Email\"].json[\"text\"]}}",
        "options": {},
        "subject": "=Fwd: {{$node[\"IMAP Email\"].json[\"subject\"]}}",
        "toEmail": "user@example.com",
        "fromEmail": "user@example.com"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1d4347c1-dd66-40a3-9228-a5e78365b201",
      "name": "Create Jira Task",
      "type": "n8n-nodes-base.jira",
      "position": [
        -440,
        -120
      ],
      "parameters": {
        "project": {
          "__rl": true,
          "mode": "id",
          "value": "12346"
        },
        "summary": "=Support Request: {{$node[\"IMAP Email\"].json[\"subject\"]}}",
        "issueType": "Task",
        "additionalFields": {}
      },
      "credentials": {
        "jiraSoftwareCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "764ccc7c-1f45-4518-877b-e77c26467425",
      "name": "Send Autoresponse",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -220,
        -120
      ],
      "parameters": {
        "text": "Thank you for contacting support. We have received your email and will address it promptly. Your request has been classified as {{$node[\"OpenAI\"].json[\"text\"]}}.",
        "options": {},
        "subject": "Re: {{$node[\"IMAP Email\"].json[\"subject\"]}}",
        "toEmail": "={{$node[\"IMAP Email\"].json[\"from\"]}}",
        "fromEmail": "user@example.com"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b59375bf-b0f7-4d5d-b3a9-812deeb3bb17",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        -480
      ],
      "parameters": {
        "width": 560,
        "height": 260,
        "content": "## Main Components\n- **IMAP Email** - Monitors incoming support emails via IMAP\n- **OpenAI** - Classifies emails into categories (billing, bug, feature)\n- **Switch** - Routes emails based on the classified category\n- **Send Billing Email** - Forwards billing-related emails to the billing inbox\n- **Send Bug Email** - Forwards bug-related emails to the bugs inbox\n- **Send Feature Email** - Forwards feature-related emails to the features inbox\n- **Create Jira Task** - Creates a task in Jira for each classified email\n- **Send Autoresponse** - Sends a confirmation email to the sender"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "8efa3f11-b8f1-48fb-898e-702e39836755",
  "connections": {
    "OpenAI": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Send Billing Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Bug Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Feature Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IMAP Email": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Bug Email": {
      "main": [
        [
          {
            "node": "Create Jira Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Jira Task": {
      "main": [
        [
          {
            "node": "Send Autoresponse",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Billing Email": {
      "main": [
        [
          {
            "node": "Create Jira Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Feature Email": {
      "main": [
        [
          {
            "node": "Create Jira Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}