{
  "name": "Today's Project (#9)",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -1040,
        -16
      ],
      "id": "cb1ff1bc-f15c-4eca-aebb-572e8fb38808",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "fc713335-bced-4781-82da-b1751b4995cf",
              "name": "customer_support_ticket",
              "value": "=Customer ID: CUS-1045\n\nSubject:\nUnable to access my account\n\nMessage:\nHello,\nI have been trying to log into my account since yesterday, but it keeps saying \"Invalid credentials\" even after resetting my password. This is affecting my work. Please help as soon as possible.\n\nRegards,\nSarah Ahmed",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        -816,
        -16
      ],
      "id": "56fa7966-904b-4ac5-abc2-1b598867d845",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=You are a professional Customer Support AI Assistant.\n\n### Input\n\n{{ $json.customer_support_ticket }}\n\n### Task\n\nRead the customer support ticket carefully and perform the following tasks:\n\n* Identify the customer's issue.\n* Determine the most appropriate issue category.\n* Identify the customer's emotion.\n* Assign a priority (High, Medium, or Low).\n* Assign the appropriate department.\n* Write a short summary (3\u20138 words).\n* Suggest a professional response to the customer.\n\n### Extract the following fields:\n\n* customer_id\n* issue_category\n* department\n* customer_emotion\n* priority\n* summary\n* suggested_response\n\n### Output Requirements\n\nReturn **only one valid JSON object**.\n\nDo not wrap the JSON inside markdown or code blocks.\n\nDo not include explanations, comments, or additional text.\n\n### Priority Rules\n\n* High: Service outage, payment failure, security issues, account access problems, urgent business impact.\n* Medium: Feature requests, delayed orders, shipping inquiries, billing questions.\n* Low: General questions, feedback, documentation requests.\n\nStrictly follow these instructions.\n",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        -608,
        -16
      ],
      "id": "9883b5b0-e4e8-42d1-918d-7928c6408937",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1.1,
      "position": [
        -704,
        224
      ],
      "id": "3736b8fe-afb0-4e94-81c8-0651e4cb5ea0",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const aiOutput = $json.output;\n\nconst parsed = JSON.parse(aiOutput);\n\nreturn {\n  json: parsed\n};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -256,
        -16
      ],
      "id": "2b2e57c6-2890-4b72-8203-9f884714a100",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.priority }}",
                    "rightValue": "High",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "347d0b10-9a36-49a4-b723-74a32e922151"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "High"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "ac1472b1-91d8-463a-80a9-096d06912fe7",
                    "leftValue": "={{ $json.priority }}",
                    "rightValue": "Medium",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Medium"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "f9f79bf5-658b-4bfc-96a8-3ac521d76831",
                    "leftValue": "={{ $json.priority }}",
                    "rightValue": "Low",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Low"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.4,
      "position": [
        -16,
        -32
      ],
      "id": "8b0c2058-45e9-4d2f-a381-f74042f7aa4e",
      "name": "Switch"
    },
    {
      "parameters": {
        "chatId": "7220042018",
        "text": "=\ud83d\udea8 New High Priority Support Ticket\n\n\ud83d\udc64 Customer ID: {{ $json.customer_id }}\n\n\ud83d\udcc2 Issue Category: {{ $json.issue_category }}\n\n\ud83c\udfe2 Department: {{ $json.department }}\n\n\ud83d\ude0a Customer Emotion: {{ $json.customer_emotion }}\n\n\u26a0\ufe0f Priority: {{ $json.priority }}\n\n\ud83d\udcdd Summary:\n{{ $json.summary }}\n\n\ud83d\udcac Suggested Response:\n{{ $json.suggested_response }}\n\n\ud83e\udd16 Processed automatically by the AI Customer Support Workflow.",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        208,
        -96
      ],
      "id": "e74a0821-6aa7-45c7-96bf-d4059b697182",
      "name": "Send a text message",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "73571020-952b-4564-8074-20c361b90f10",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodeGroups": [],
  "id": "BJhCAhpzXOP1hCpp",
  "tags": []
}