{
  "name": "AI Support Ticket Triage",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "706ddac7-de6f-4f26-b111-884a677ac9f8",
        "responseMode": "lastNode",
        "options": {
          "allowedOrigins": "*"
        }
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        0,
        320
      ],
      "id": "fd746af6-f5be-4cd8-8481-820440856677",
      "name": "Support Webhook",
      "webhookId": "654ffcc9-56ac-4bb6-b9d6-2816b9ca1511"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "e53cad3f-6199-4c3e-9bc7-e08984c4a090",
              "name": "Name",
              "value": "={{  $json.body.name  }}",
              "type": "string"
            },
            {
              "id": "94a1ce38-84ac-4cf9-b0f5-5304c05e3455",
              "name": "Email",
              "value": "={{  $json.body.email  }}",
              "type": "string"
            },
            {
              "id": "21a35517-ee85-47df-99c3-2733723553d8",
              "name": "Customer type",
              "value": "={{  $json.body.customerType  }}",
              "type": "string"
            },
            {
              "id": "56bac4f0-e45f-43a8-9faa-4fb86a6c5429",
              "name": "Reference number",
              "value": "={{  $json.body.reference  }}",
              "type": "string"
            },
            {
              "id": "62e2e513-6b24-46d4-bfd4-b37fce13e792",
              "name": "Subject",
              "value": "={{  $json.body.subject  }}",
              "type": "string"
            },
            {
              "id": "615b2678-703e-4f8e-9265-2967797bff4a",
              "name": "Description",
              "value": "={{  $json.body.description  }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        224,
        320
      ],
      "id": "7ae7f67e-a1de-434e-b8be-1d2f73841094",
      "name": "Normalise Ticket"
    },
    {
      "parameters": {
        "inputText": "={{  $json.Subject  }}\n\n{{  $json.Description  }}",
        "categories": {
          "categories": [
            {
              "category": "Billing",
              "description": "Invoices, charges, payments, refunds, subscriptions or pricing."
            },
            {
              "category": "Technical",
              "description": "Errors, bugs, outages, login failures, or a feature not working as expected."
            },
            {
              "category": "Account",
              "description": "Account access, users, permissions, profile details or account changes."
            }
          ]
        },
        "options": {
          "fallback": "other"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "typeVersion": 1.1,
      "position": [
        448,
        320
      ],
      "id": "9c01c4d8-8ad9-4e63-8de6-6b92a968c9d7",
      "name": "Classify Ticket"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        520,
        600
      ],
      "id": "5e6ee50e-5fd3-4954-9029-838754b15300",
      "name": "OpenAI Chat Model"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a700edbb-235e-456a-a19d-434dbaf2bddd",
              "name": "category",
              "value": "Billing",
              "type": "string"
            },
            {
              "id": "7be8d3ac-1da7-4a03-bcda-1c31f826e1f0",
              "name": "owning_team",
              "value": "Finance",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        800,
        -48
      ],
      "id": "25eaa763-bd73-4f5d-9334-a3b01a05e9e4",
      "name": "Tag: Billing"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "3360ad60-65e7-4aad-99be-049abf76f510",
              "name": "category",
              "value": "Technical",
              "type": "string"
            },
            {
              "id": "499fd641-2bad-4143-824c-b4c0179aa516",
              "name": "owning_team",
              "value": "Engineering",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        800,
        192
      ],
      "id": "72829137-703f-40d2-a18d-eeb367ae23eb",
      "name": "Tag: Technical"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "9ee3c02e-1ea3-4d50-9c01-8d8c19251380",
              "name": "category",
              "value": "Account",
              "type": "string"
            },
            {
              "id": "6b1ecfb9-5383-4996-a92f-99b1966df2f6",
              "name": "owning_team",
              "value": "Account support",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        800,
        592
      ],
      "id": "cf9e1f0c-6f21-4feb-b23d-850540227fe4",
      "name": "Tag: Account"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1600,
        432
      ],
      "id": "876300bf-fb7c-4f38-a0c9-3fe7bb8e95fc",
      "name": "Needs Review"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=You are a customer support triage assistant for a software company.\n\nRead this support ticket and assess it.\n\nSet priority using these rules, in this order:\n- Urgent: the customer cannot work right now. An outage, an error blocking a task they must finish today, or being locked out of an account they need.\n- Normal: a real problem that needs a person, but the customer is not blocked. This includes billing mistakes, incorrect charges and refunds - the money can be put right, so it is not Urgent.\n- Low: a question, a preference, or setup help that has no impact on their work.\n\nAlso give urgency_score as a whole number from 0 to 100, on the same scale: 75 and above is Urgent, 30 to 74 is Normal, below 30 is Low.\n\nThe category has already been decided. Repeat it exactly in your answer.\n\nKeep summary, reasoning and suggested_action to one or two sentences each.\n\nCategory: {{ $json.category }}\nFrom: {{ $json.Name }} ({{ $json['Customer type'] }} customer)\nReference: {{ $json['Reference number'] }}\nSubject: {{ $json.Subject }}\nMessage: {{ $json.Description }}",
        "hasOutputParser": true,
        "batching": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.9,
      "position": [
        1024,
        64
      ],
      "id": "82939ec0-5a4b-46cd-b3e8-53223b9e1418",
      "name": "Analyse Ticket"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        1032,
        296
      ],
      "id": "0f7a788a-f1c4-4a5d-841c-d0a0a35ac4d7",
      "name": "OpenAI Chat Model1"
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n  \"category\": \"Technical\",\n  \"priority\": \"Urgent\",\n  \"urgency_score\": 85,\n  \"customer_sentiment\": \"frustrated\",\n  \"summary\": \"Customer cannot generate invoices because of a 503 error.\",\n  \"requires_human\": true,\n  \"reasoning\": \"The customer is blocked from a task they need to finish today.\",\n  \"suggested_action\": \"Escalate to on-call engineering and confirm receipt with the customer.\"\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        1160,
        296
      ],
      "id": "863855f8-9278-444e-b1f3-f1fecd35b839",
      "name": "Structured Output Parser"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "leftValue": "={{  $json.output.priority  }}",
                    "rightValue": "Urgent",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "41e9b333-4140-46d2-b9d9-16e56ea42085"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "URGENT"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "8e36419a-f36d-43b6-bfbd-ac33901262a7",
                    "leftValue": "={{ $json.output.priority }}",
                    "rightValue": "Normal",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "NORMAL"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "6225c2a7-000d-46de-bd71-4bb480aab70d",
                    "leftValue": "={{ $json.output.priority }}",
                    "rightValue": "Low",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "LOW"
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "renameFallbackOutput": "NEEDS REVIEW"
        }
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.4,
      "position": [
        1376,
        32
      ],
      "id": "3b62d2d6-9304-4f09-aa5b-2902d08bb3fe",
      "name": "Route by Priority"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "19855bb7-6691-4cd6-8a45-b4f0861d36a6",
              "name": "escalated",
              "value": true,
              "type": "boolean"
            },
            {
              "id": "51281fcf-5cf1-4115-95d8-c8ba94be3001",
              "name": "assigned_to",
              "value": "On-call support",
              "type": "string"
            },
            {
              "id": "518afefb-d6a1-4eba-a353-d9d089794915",
              "name": "respond_within",
              "value": "1 hour",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        1600,
        -96
      ],
      "id": "2ea6afae-5b1c-4e3c-a9b4-1c7e58e6aba9",
      "name": "Escalate"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Write a short reply to this customer support ticket.\n\nCategory: {{ $json.output.category }}\nPriority: {{ $json.output.priority }}\nSummary: {{ $json.output.summary }}\nSuggested action: {{ $json.output.suggested_action }}\nEscalated: {{ $json.escalated === true ? 'yes' : 'no' }}\n\nOriginal message from {{ $('Normalise Ticket').item.json.Name }}:\n{{ $('Normalise Ticket').item.json.Description }}\n\nRules:\n- Under 120 words. Plain, warm, specific to what they wrote.\n- Do not say the problem is fixed.\n- Do not promise refunds, credits or timeframes.\n- Do not invent troubleshooting steps.\n- If Escalated is yes, say it has been passed to the right team and someone will be in touch.\nStart with a subject line, then the reply.",
        "batching": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.9,
      "position": [
        1824,
        -256
      ],
      "id": "f04fe5d0-a5d7-46e9-91d6-97d9956f09c4",
      "name": "Draft Reply"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "ac07d964-34df-4299-9a40-8045d29eb8b0",
              "name": "status",
              "value": "answered",
              "type": "string"
            },
            {
              "id": "6b4ee61f-86a0-4d08-bb6c-08be980aac4b",
              "name": "reply",
              "value": "Thanks for getting in touch. We've logged your question and one of the team will get back to you within two working days.",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        1888,
        144
      ],
      "id": "5b0d74f2-5c77-4cfd-8ebf-c1832b747b43",
      "name": "Standard Response"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        1896,
        -24
      ],
      "id": "309b9d83-5bfb-4365-93e4-cd344367b2a3",
      "name": "OpenAI Chat Model2"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "45e62b39-ca37-4baa-92b0-7b9d103db617",
              "name": "to",
              "value": "={{  $('Normalise Ticket').item.json.Email  }}",
              "type": "string"
            },
            {
              "id": "2cb0334c-0bfb-4e85-95f8-415544ef8eb7",
              "name": "subject",
              "value": "={{  $json.text ? $json.text.replace(/\\\\n/g, '\\n').split('\\n')[0].replace(/^Subject:\\s*/i, '').trim() : 'Re: ' + $('Normalise Ticket').item.json.Subject  }}",
              "type": "string"
            },
            {
              "id": "92d56f30-f504-4a64-8b60-19aabf9ead1a",
              "name": "body",
              "value": "={{  $json.text ? $json.text.replace(/\\\\n/g, '\\n').split('\\n').slice(1).join('\\n').trim() + '\\n\\n-- \\nAcme Software Support' : $json.reply  }}",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        2176,
        16
      ],
      "id": "9a3ea2a5-e9c9-4642-9506-75c1447c5da9",
      "name": "Prepare Email"
    },
    {
      "parameters": {
        "sendTo": "={{  $json.to  }}",
        "subject": "={{  $json.subject  }}",
        "message": "={{  $json.body  }}",
        "options": {
          "appendAttribution": false,
          "senderName": "Acme Software Support",
          "replyTo": "support@acme-software.com"
        }
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        2400,
        16
      ],
      "id": "865a63f1-0dc1-4f81-bffa-6f47bfbf66c6",
      "name": "Send Reply",
      "webhookId": "01f434c5-bcbe-4cb4-ad84-5f18035e7c4a"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "52fcaa57-b0f5-49d4-8090-0b064659156d",
              "name": "category",
              "value": "={{  $('Analyse Ticket').item.json.output.category  }}",
              "type": "string"
            },
            {
              "id": "e32a581b-fb34-4ce2-b62b-199503f4e834",
              "name": "priority",
              "value": "={{  $('Analyse Ticket').item.json.output.priority  }}",
              "type": "string"
            },
            {
              "id": "f966ce8b-7852-4429-a200-1db6e1be8041",
              "name": "score",
              "value": "={{  $('Analyse Ticket').item.json.output.urgency_score  }}",
              "type": "string"
            },
            {
              "id": "890b9594-6d19-4222-9a0f-52acdaaf6522",
              "name": "outcome",
              "value": "=Reply sent",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        2624,
        16
      ],
      "id": "a927be3d-f6c0-4da5-9665-d0ac59e61dd9",
      "name": "Tag Sent"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a0ab7f73-9158-4ac5-bd07-6d69e20e95bf",
              "name": "category",
              "value": "=Other",
              "type": "string"
            },
            {
              "id": "2c06c22b-30df-4fe1-965c-e254e92f75d8",
              "name": "priority",
              "value": "=Needs review",
              "type": "string"
            },
            {
              "id": "78634bb3-6cf5-4aa1-b0ae-6936d01dda43",
              "name": "score",
              "value": "=-",
              "type": "string"
            },
            {
              "id": "b094e6af-3b43-4494-a786-dd582540d0d1",
              "name": "outcome",
              "value": "=Waiting for a human",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        1888,
        432
      ],
      "id": "a2b4e676-1115-419f-b5a8-b371a2f64172",
      "name": "Tag Unhandled"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "3f814fa0-f8d6-44a6-b9ab-d712b5ac543c",
              "name": "Time",
              "value": "={{  $now.toFormat('dd LLL HH:mm')  }}",
              "type": "string"
            },
            {
              "id": "7a4b1573-7b40-4e6b-881d-1a02e419db3b",
              "name": "Reference",
              "value": "={{  $('Normalise Ticket').item.json['Reference number'] || '-'  }}",
              "type": "string"
            },
            {
              "id": "ba095954-bce5-45f2-b223-191d6ea47af9",
              "name": "Name",
              "value": "={{  $('Normalise Ticket').item.json.Name  }}",
              "type": "string"
            },
            {
              "id": "3faf0f23-0646-49c9-94eb-7f97831f3330",
              "name": "Email",
              "value": "={{  $('Normalise Ticket').item.json.Email  }}",
              "type": "string"
            },
            {
              "id": "33202fcd-3eb9-4819-89e1-bf5de7602743",
              "name": "Subject",
              "value": "={{  $('Normalise Ticket').item.json.Subject  }}",
              "type": "string"
            },
            {
              "id": "2b79223b-a220-45c9-b939-abbcc47e7bb2",
              "name": "Category",
              "value": "={{  $json.category  }}",
              "type": "string"
            },
            {
              "id": "5f41444c-5a74-4911-a78d-3f9673d99baf",
              "name": "Priority",
              "value": "={{  $json.priority  }}",
              "type": "string"
            },
            {
              "id": "6daa24c0-42b2-4a39-9d78-e18ded1224b4",
              "name": "Score",
              "value": "={{  $json.score  }}",
              "type": "string"
            },
            {
              "id": "14dd9c7d-e24c-4be4-9682-374f1eae48a5",
              "name": "Outcome",
              "value": "={{  $json.outcome  }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        2848,
        192
      ],
      "id": "b72a5279-76e8-45d8-b429-611f7f4e1a86",
      "name": "Prepare Log"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "YOUR_GOOGLE_SHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Tickets",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": [
            {
              "id": "Time",
              "displayName": "Time",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Reference",
              "displayName": "Reference",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Name",
              "displayName": "Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Email",
              "displayName": "Email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Subject",
              "displayName": "Subject",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Category",
              "displayName": "Category",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Priority",
              "displayName": "Priority",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Score",
              "displayName": "Score",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Outcome",
              "displayName": "Outcome",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        3072,
        192
      ],
      "id": "c709055b-1e37-4e20-bb12-1ef20ebd3110",
      "name": "Log Ticket"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "0ddd41ac-b99a-420d-a416-fbff0dd76678",
              "name": "status",
              "value": "=received",
              "type": "string"
            },
            {
              "id": "c8d360b5-0ba8-4ee3-976e-2a17cc882b6d",
              "name": "reference",
              "value": "={{  $json.Reference  }}",
              "type": "string"
            },
            {
              "id": "c43d3a90-c90f-4309-a16b-e91421c518ee",
              "name": "category",
              "value": "={{  $json.Category  }}",
              "type": "string"
            },
            {
              "id": "147824b7-4c8a-4719-b830-3b33c6b271ad",
              "name": "priority",
              "value": "={{  $json.Priority  }}",
              "type": "string"
            },
            {
              "id": "97587ca6-d9f5-4716-9e34-6604a148f27b",
              "name": "outcome",
              "value": "={{  $json.Outcome  }}",
              "type": "string"
            },
            {
              "id": "a1f2898f-5e2b-4728-8ea1-9c65f5ef2c92",
              "name": "message",
              "value": "={{  $json.Priority === 'Needs review' ? 'Thanks — a member of the team will pick this up personally.' : 'Thanks. We have routed this to ' + $json.Category + ' and a reply is on its way to ' + $json.Email + '.'  }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        3296,
        192
      ],
      "id": "851dbde6-8f62-48e3-98f1-8039225643c3",
      "name": "Confirmation"
    },
    {
      "id": "5a71d65d-0b3c-437f-bc58-368cea75129e",
      "name": "Setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -676
      ],
      "parameters": {
        "content": "## AI Support Ticket Triage - setup\nVideo: https://www.youtube.com/watch?v=ZQ8CexJK43s\n\n1. Pick your OpenAI credential on the three **OpenAI Chat Model** nodes.\n2. **Send Reply** sends real email through Gmail. Add your Gmail credential and test with your own address first.\n3. **Log Ticket**: add your Google Sheets credential and replace YOUR_GOOGLE_SHEET_ID with your sheet. Tab: **Tickets**. Columns: Time, Reference, Name, Email, Subject, Category, Priority, Score, Outcome.\n4. POST a ticket as JSON to the **Support Webhook** test URL with: name, email, customerType, reference, subject, description.\n\nTickets the classifier can't place go to **Needs Review**. Once the workflow is active its webhook is public - keep it off until you're ready.",
        "height": 360,
        "width": 620,
        "color": 5
      }
    }
  ],
  "connections": {
    "Support Webhook": {
      "main": [
        [
          {
            "node": "Normalise Ticket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalise Ticket": {
      "main": [
        [
          {
            "node": "Classify Ticket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Classify Ticket",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Classify Ticket": {
      "main": [
        [
          {
            "node": "Tag: Billing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Tag: Technical",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Tag: Account",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Needs Review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tag: Billing": {
      "main": [
        [
          {
            "node": "Analyse Ticket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tag: Technical": {
      "main": [
        [
          {
            "node": "Analyse Ticket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tag: Account": {
      "main": [
        [
          {
            "node": "Analyse Ticket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Analyse Ticket",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Analyse Ticket",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Analyse Ticket": {
      "main": [
        [
          {
            "node": "Route by Priority",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Priority": {
      "main": [
        [
          {
            "node": "Escalate",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Draft Reply",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Standard Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Needs Review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Escalate": {
      "main": [
        [
          {
            "node": "Draft Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Draft Reply",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Draft Reply": {
      "main": [
        [
          {
            "node": "Prepare Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Standard Response": {
      "main": [
        [
          {
            "node": "Prepare Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Email": {
      "main": [
        [
          {
            "node": "Send Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Reply": {
      "main": [
        [
          {
            "node": "Tag Sent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Needs Review": {
      "main": [
        [
          {
            "node": "Tag Unhandled",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tag Sent": {
      "main": [
        [
          {
            "node": "Prepare Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tag Unhandled": {
      "main": [
        [
          {
            "node": "Prepare Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Log": {
      "main": [
        [
          {
            "node": "Log Ticket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Ticket": {
      "main": [
        [
          {
            "node": "Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "pinData": {}
}