{
  "name": "LineBot-SYS2//Success",
  "nodes": [
    {
      "parameters": {
        "promptType": "define",
        "text": "=={{ $json.text }}",
        "options": {
          "systemMessage": "You are a deterministic Ticket Parsing Engine.\n\nYou extract structured ticket data from raw user messages.\n\nYou MUST follow every rule strictly.\n\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\nABSOLUTE OUTPUT RULES\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\n1. Output ONLY valid JSON.\n2. Do NOT wrap in markdown.\n3. Do NOT explain anything.\n4. Do NOT add extra text.\n5. Do NOT add extra keys.\n6. Do NOT rename keys.\n7. Do NOT nest objects.\n8. Do NOT calculate or infer values.\n9. Do NOT translate.\n10. Do NOT modify formats.\n11. If value is missing \u2192 return null.\n12. If value is \"-\" \u2192 return null.\n13. JSON must be flat.\n14. No trailing commas.\n\nIf no fields are found, still return full JSON with all keys set to null.\n\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\nREQUIRED OUTPUT FORMAT\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\n{\n\"ticket_no\": string | null,\n\"severity\": \"NSA1\" | \"NSA2\" | \"NSA3\" | \"NSA4\" | null,\n\"fault_date\": string | null,\n\"expected_date\": string | null,\n\"owner\": string | null,\n\"go_time\": string | null,\n\"start_time\": string | null,\n\"done_time\": string | null,\n\"status\": string | null\n}\n\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\nEXTRACTION RULES\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\nticket_no:\n- Extract ONLY if it matches regex: TT\\d+\n- Return full match only.\n- Ignore \"Ticket: -\" or empty values.\n- If not found \u2192 null.\n\nseverity:\n- Must match exactly: NSA1 | NSA2 | NSA3 | NSA4\n- Case sensitive.\n- If not found \u2192 null.\n\nfault_date:\n- Extract full datetime string after:\n  \"FaultDate :\" OR\n  \"Fault :\" OR\n  \"FaultDate:\" OR\n  \"Fault:\"\n- Return exact string after colon.\n- If value is \"-\" \u2192 null.\n- If not found \u2192 null.\n\nexpected_date:\n- Extract full datetime string after:\n  \"Expected :\" OR\n  \"ExpectedDate :\" OR\n  \"Expected:\" OR\n  \"ExpectedDate:\"\n- Return exact string after colon.\n- If value is \"-\" \u2192 null.\n- If not found \u2192 null.\n\nowner:\n- Extract exact value after:\n  \"OpenTicketName :\" OR\n  \"OwnerTeam :\" OR\n  \"Owner :\" OR\n  \"\u0e1c\u0e39\u0e49\u0e41\u0e08\u0e49\u0e07\u0e07\u0e32\u0e19 :\"\n- Return exact string after colon.\n- If value is \"-\" \u2192 null.\n- If not found \u2192 null.\n\ngo_time:\n- Extract using regex: !Go#(\\d{2}:\\d{2})\n- Return only HH:mm\n- If not found \u2192 null.\n\nstart_time:\n- Extract using regex: !Star#(\\d{2}:\\d{2})\n- Return only HH:mm\n- If not found \u2192 null.\n\ndone_time:\n- Extract using regex: !Done#(\\d{2}:\\d{2})\n- Return only HH:mm\n- If not found \u2192 null.\n\nstatus:\n- Extract exact value after:\n  \"Status :\" OR\n  \"\u0e2a\u0e16\u0e32\u0e19\u0e30 :\"\n- Return exact string after colon.\n- If value is \"-\" \u2192 null.\n- If not found \u2192 null.\n\nticket_no:\nMatch regex /TT\\d+/i\n\nseverity:\nMatch /NSA[1-4]/i\nReturn uppercase (NSA1\u2013NSA4)\n\nfault_date:\nMatch /FaultDate\\s*:\\s*(.+)/i\n\nowner:\nMatch /OpenTicketName\\s*:\\s*(.+)/i OR /OwnerTeam\\s*:\\s*(.+)/i\n\nstatus:\nMatch /Status\\s*:\\s*(.+)/i\n\ngo_time:\nMatch /!Go#(\\d{2}:\\d{2})/i\n\nstart_time:\nMatch /!Star#(\\d{2}:\\d{2})/i\n\ndone_time:\nMatch /!Done#(\\d{2}:\\d{2})/i\n\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\nFINAL INSTRUCTION\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\nReturn JSON only.\nAlways include all keys.\nNever omit keys.\nNever hallucinate values.",
          "returnIntermediateSteps": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        432,
        -128
      ],
      "id": "d38d7771-8b0a-4272-8b7d-6d0dd688b51c",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Line Messaging Trigger').item.json.source.userId }}",
        "contextWindowLength": 10
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        528,
        96
      ],
      "id": "731b5816-5d01-4daf-9de1-c05428ae2102",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "events": [
          "message"
        ]
      },
      "type": "@aotoki/n8n-nodes-line-messaging.lineMessagingTrigger",
      "typeVersion": 1,
      "position": [
        -208,
        -128
      ],
      "id": "ce766736-4fa2-4477-9a76-e8647acb58f8",
      "name": "Line Messaging Trigger",
      "credentials": {
        "lineMessagingApi": {
          "name": "<your credential>"
        }
      },
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "modelName": "=models/gemini-2.5-flash",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        432,
        64
      ],
      "id": "685a5a20-e53d-4d52-9790-574df94b7597",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "return items.map(item => {\n  let data = item.json;\n\n  // \u0e16\u0e49\u0e32 AI \u0e2a\u0e48\u0e07\u0e21\u0e32\u0e40\u0e1b\u0e47\u0e19 string \u0e43\u0e2b\u0e49 parse\n  if (typeof data === \"string\") {\n    data = JSON.parse(data);\n  }\n\n  // \u0e16\u0e49\u0e32\u0e2d\u0e22\u0e39\u0e48\u0e43\u0e19 key \u0e0a\u0e37\u0e48\u0e2d output\n  if (typeof data.output === \"string\") {\n    data = JSON.parse(data.output);\n  }\n\n  return {\n    json: data\n  };\n});"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        128,
        -208
      ],
      "id": "0328b06f-ad2f-4714-8789-ea56a8d27edf",
      "name": "Code in JavaScript1"
    },
    {
      "parameters": {
        "content": "1\ufe0f\u20e3 Line Messaging Trigger\n\u0e23\u0e31\u0e1a\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e08\u0e32\u0e01 LINE OA\ntext\nreplyToken\nuserId",
        "height": 176,
        "width": 214
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        -528
      ],
      "typeVersion": 1,
      "id": "8d022a22-0082-4e63-a751-c71f5583b86c",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "3\ufe0f\u20e3 AI Agent\n\u0e41\u0e1b\u0e25\u0e07\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e18\u0e23\u0e23\u0e21\u0e14\u0e32 \u2192 JSON \u0e42\u0e04\u0e23\u0e07\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e21\u0e32\u0e15\u0e23\u0e10\u0e32\u0e19\nField \u0e17\u0e35\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e44\u0e14\u0e49:\nticket_no\n\nseverity\nfault_date\nexpected_date\nowner\ngo_time\nstart_time\ndone_time\nstatus",
        "height": 272,
        "width": 336
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -528
      ],
      "typeVersion": 1,
      "id": "51ff1190-48b0-4967-8161-ade6ba617866",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "5\ufe0f\u20e3 \u0e04\u0e33\u0e19\u0e27\u0e13 SLA\nSeverity   |    SLA\nNSA1\t |  4 \u0e0a\u0e31\u0e48\u0e27\u0e42\u0e21\u0e07\nNSA2\t |  8 \u0e0a\u0e31\u0e48\u0e27\u0e42\u0e21\u0e07\nNSA3\t | 14 \u0e0a\u0e31\u0e48\u0e27\u0e42\u0e21\u0e07\nNSA4\t | 24 \u0e0a\u0e31\u0e48\u0e27\u0e42\u0e21\u0e07\n\nExpected Date = fault_date + SLA\nTimeZone: Asia/Bangkok",
        "height": 240,
        "width": 256
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        -528
      ],
      "typeVersion": 1,
      "id": "9d4c7516-c7a5-4af4-981a-a5fe9a5b6b3f",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "content": "7\ufe0f\u20e3 \u0e2a\u0e23\u0e49\u0e32\u0e07 Status \u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\n\u0e21\u0e35 done_time \u2192 Done\n\u0e21\u0e35 start_time \u2192 In Progress\n\u0e21\u0e35 go_time \u2192 On Site\n\u0e44\u0e21\u0e48\u0e21\u0e35\u0e40\u0e25\u0e22 \u2192 Open",
        "height": 240,
        "width": 208
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        -528
      ],
      "typeVersion": 1,
      "id": "a6c01ad9-f087-4f64-8bc3-4c36dcfc868b",
      "name": "Sticky Note4"
    },
    {
      "parameters": {
        "content": "8\ufe0f\u20e3 \u0e2a\u0e48\u0e07\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e01\u0e25\u0e31\u0e1a LINE\n\n\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c:\n\ud83d\udccc Ticket: TT12345\n\u26a1 Severity: \ud83d\udea8 NSA1\n\ud83d\udcc5 Fault: 28/12/2025 23:45\n\ud83d\udcc6 Expected: 29/12/2025 03:45\n\ud83d\ude97 Go: -\n\ud83d\udd27 Start: -\n\u2705 Done: -\n\ud83d\udccd Status: Open",
        "height": 240,
        "width": 256
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        672,
        -528
      ],
      "typeVersion": 1,
      "id": "9119ef54-9878-407d-953f-13b04d3fea85",
      "name": "Sticky Note5"
    },
    {
      "parameters": {
        "content": "IF Node\n\u0e2b\u0e19\u0e49\u0e32\u0e17\u0e35\u0e48:\n\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e27\u0e48\u0e32\u0e21\u0e35\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e04\u0e23\u0e1a\u0e2b\u0e23\u0e37\u0e2d\u0e44\u0e21\u0e48\n\u0e40\u0e0a\u0e48\u0e19:\nticket_no \u0e44\u0e21\u0e48\u0e27\u0e48\u0e32\u0e07\nstatus \u0e44\u0e21\u0e48\u0e27\u0e48\u0e32\u0e07\n\u0e16\u0e49\u0e32\u0e1c\u0e48\u0e32\u0e19 \u2192 \u0e2a\u0e48\u0e07 LINE\n\u0e16\u0e49\u0e32\u0e44\u0e21\u0e48\u0e1c\u0e48\u0e32\u0e19 \u2192 \u0e2d\u0e32\u0e08\u0e2a\u0e48\u0e07\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21 error",
        "height": 176
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        -528
      ],
      "typeVersion": 1,
      "id": "4cebc26e-b40e-4205-8682-109ec3b8fe61",
      "name": "Sticky Note6"
    },
    {
      "parameters": {
        "content": "Line Messaging (Send)\n\u0e2b\u0e19\u0e49\u0e32\u0e17\u0e35\u0e48:\n\u0e2a\u0e48\u0e07\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e01\u0e25\u0e31\u0e1a\u0e44\u0e1b\u0e22\u0e31\u0e07 user \u0e1c\u0e48\u0e32\u0e19 LINE\n\u0e43\u0e0a\u0e49:\nuserId \u0e08\u0e32\u0e01 Trigger\nmessage text \u0e08\u0e32\u0e01 Code node \u0e01\u0e48\u0e2d\u0e19\u0e2b\u0e19\u0e49\u0e32",
        "height": 144,
        "width": 352
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1488,
        -496
      ],
      "typeVersion": 1,
      "id": "8173b995-c166-4ba1-9b1f-424f43a40f37",
      "name": "Sticky Note7"
    },
    {
      "parameters": {
        "content": "\u0e20\u0e32\u0e1e\u0e23\u0e27\u0e21\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\ud83d\udccc LINE Ticket Automation Workflow\n1\ufe0f\u20e3 Line Messaging Trigger\n\u0e23\u0e31\u0e1a\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e08\u0e32\u0e01 LINE OA\ntext\nuserId\nreplyToken\n\u2b07\n\n2\ufe0f\u20e3 Detect Mode (Code)\n\u0e27\u0e34\u0e40\u0e04\u0e23\u0e32\u0e30\u0e2b\u0e4c\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e27\u0e48\u0e32\u0e40\u0e1b\u0e47\u0e19\u0e42\u0e2b\u0e21\u0e14\u0e2d\u0e30\u0e44\u0e23\nMode \u0e17\u0e35\u0e48\u0e40\u0e1b\u0e47\u0e19\u0e44\u0e1b\u0e44\u0e14\u0e49:\nupdate_ticket\nquery_ticket\ntoday_summary\nquery_site\nunknown\n\n\u2b07\n\n3\ufe0f\u20e3 IF \u2013 \u0e41\u0e22\u0e01\u0e40\u0e2a\u0e49\u0e19\u0e17\u0e32\u0e07\n\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a mode\n\u0e16\u0e49\u0e32\u0e40\u0e1b\u0e47\u0e19 query \u2192 \u0e44\u0e1b AI Agent\n\u0e16\u0e49\u0e32\u0e40\u0e1b\u0e47\u0e19 update_ticket \u2192 \u0e44\u0e1b\u0e02\u0e31\u0e49\u0e19\u0e15\u0e2d\u0e19\u0e2a\u0e23\u0e49\u0e32\u0e07/\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01 Ticket\n\u2b07\n\n4\ufe0f\u20e3 AI Agent\n\u0e27\u0e34\u0e40\u0e04\u0e23\u0e32\u0e30\u0e2b\u0e4c\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\n\u0e41\u0e1b\u0e25\u0e07\u0e40\u0e1b\u0e47\u0e19 JSON \u0e42\u0e04\u0e23\u0e07\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e21\u0e32\u0e15\u0e23\u0e10\u0e32\u0e19\nField \u0e17\u0e35\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e44\u0e14\u0e49:\nticket_no\nseverity\nfault_date\nexpected_date\nowner\ngo_time\nstart_time\ndone_time\nstatus\n\u2b07\n\n5\ufe0f\u20e3 Parse JSON\n\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e27\u0e48\u0e32 JSON \u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07\nParse \u0e44\u0e14\u0e49\nKey \u0e04\u0e23\u0e1a\n\u0e16\u0e49\u0e32\u0e44\u0e21\u0e48\u0e04\u0e23\u0e1a \u2192 Error\n\u2b07\n\n6\ufe0f\u20e3 \u0e04\u0e33\u0e19\u0e27\u0e13 SLA (Edit Fields)\nSeverity \u2192 SLA \u0e0a\u0e31\u0e48\u0e27\u0e42\u0e21\u0e07\nNSA1 = 4 \u0e0a\u0e21\nNSA2 = 8 \u0e0a\u0e21\nNSA3 = 14 \u0e0a\u0e21\nNSA4 = 24 \u0e0a\u0e21\nExpected Date = fault_date + SLA\nTimeZone: Asia/Bangkok\n\n\u2b07\n\n7\ufe0f\u20e3 Append Google Sheet\n\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25 Ticket \u0e25\u0e07 Google Sheet\n\u2b07\n\n8\ufe0f\u20e3 Normalize Ticket Data\n\u0e17\u0e33\u0e04\u0e27\u0e32\u0e21\u0e2a\u0e30\u0e2d\u0e32\u0e14\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\n\u0e2a\u0e23\u0e49\u0e32\u0e07 Status \u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\nStatus Logic:\n\u0e21\u0e35 done_time \u2192 Done\n\u0e21\u0e35 start_time \u2192 In Progress\n\u0e21\u0e35 go_time \u2192 On Site\n\u0e44\u0e21\u0e48\u0e21\u0e35\u0e40\u0e25\u0e22 \u2192 Open\n\n\u2b07\n\n9\ufe0f\u20e3 IF \u0e15\u0e23\u0e27\u0e08\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e01\u0e48\u0e2d\u0e19\u0e2a\u0e48\u0e07\n\u0e40\u0e0a\u0e47\u0e04\u0e27\u0e48\u0e32 ticket_no \u0e44\u0e21\u0e48\u0e27\u0e48\u0e32\u0e07\n\u0e16\u0e49\u0e32\u0e1c\u0e48\u0e32\u0e19 \u2192 \u0e2a\u0e48\u0e07 LINE\n\u0e16\u0e49\u0e32\u0e44\u0e21\u0e48\u0e1c\u0e48\u0e32\u0e19 \u2192 \u0e2a\u0e48\u0e07\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21 error\n\n\u2b07\n\n\ud83d\udd1f Line Messaging (Send)\n\u0e2a\u0e48\u0e07\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e2a\u0e23\u0e38\u0e1b\u0e01\u0e25\u0e31\u0e1a\u0e44\u0e1b\u0e22\u0e31\u0e07\u0e1c\u0e39\u0e49\u0e43\u0e0a\u0e49\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\u2705 Result\nUser \u0e2a\u0e48\u0e07\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21 \u2192 \u0e23\u0e30\u0e1a\u0e1a\u0e2a\u0e23\u0e49\u0e32\u0e07 Ticket \u2192 \u0e04\u0e33\u0e19\u0e27\u0e13 SLA \u2192 \u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01 \u2192 \u0e2a\u0e48\u0e07\u0e2a\u0e23\u0e38\u0e1b\u0e01\u0e25\u0e31\u0e1a\u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",
        "height": 1696,
        "width": 832
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        928,
        -2224
      ],
      "typeVersion": 1,
      "id": "0fad679d-9525-44f8-bfc8-48bbddd4161c",
      "name": "Sticky Note8"
    },
    {
      "parameters": {
        "content": "Line Messaging \u0e43\u0e0a\u0e49 Webhook Production \n\u0e44\u0e14\u0e49\u0e40\u0e40\u0e25\u0e49\u0e27 (\u0e1a\u0e2d\u0e17\u0e17\u0e33\u0e07\u0e32\u0e19 24hrs)",
        "height": 80,
        "width": 304
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        48
      ],
      "typeVersion": 1,
      "id": "61ca3f64-3fe9-40cb-86ed-0437349aa843",
      "name": "Sticky Note9"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1sjN3thWlP_a1qGjft7MuLglHbT4P9RSx0QGgqKHiT5Y",
          "mode": "list",
          "cachedResultName": "Real\u0e2a\u0e33\u0e40\u0e19\u0e32\u0e02\u0e2d\u0e07 LAB \u0e07\u0e32\u0e19\u0e25\u0e07\u0e23\u0e30\u0e1a\u0e1a NodeB2025",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1sjN3thWlP_a1qGjft7MuLglHbT4P9RSx0QGgqKHiT5Y/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1430076532,
          "mode": "list",
          "cachedResultName": "LABJob_System December 2025",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1sjN3thWlP_a1qGjft7MuLglHbT4P9RSx0QGgqKHiT5Y/edit#gid=1430076532"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Region": "=",
            "TT No. / PW No.": "=",
            "Source": "=",
            "TT : \u0e17\u0e35\u0e48\u0e40\u0e04\u0e25\u0e35\u0e22\u0e23\u0e4c\u0e42\u0e14\u0e22\u0e44\u0e21\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e0b\u0e48\u0e2d\u0e21": "=",
            " Destination": "=",
            "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 Ticket \u0e40\u0e1b\u0e34\u0e14": "=",
            "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e40\u0e1b\u0e34\u0e14 Ticket": "=",
            "\u0e17\u0e35\u0e21": "=",
            "\u0e02\u0e19\u0e32\u0e14\u0e17\u0e35\u0e21\n(\u0e08.\u0e19.\u0e04\u0e19)": "=",
            "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e2d\u0e2d\u0e01\u0e40\u0e14\u0e34\u0e19\u0e17\u0e32\u0e07": "=",
            "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e2d\u0e2d\u0e01\u0e40\u0e14\u0e34\u0e19\u0e17\u0e32\u0e07": "=",
            "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e40\u0e23\u0e34\u0e48\u0e21\u0e0b\u0e48\u0e2d\u0e21": "=",
            "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e40\u0e23\u0e34\u0e48\u0e21\u0e0b\u0e48\u0e2d\u0e21": "=",
            "\u0e2a\u0e16\u0e32\u0e19\u0e30": "=",
            "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e02\u0e2d\u0e07\u0e2a\u0e16\u0e32\u0e19\u0e30": "=",
            "\u0e40\u0e27\u0e25\u0e32\u0e02\u0e2d\u0e07\u0e2a\u0e16\u0e32\u0e19\u0e30": "=",
            "SLA (OK/NOK)": "=",
            "\u0e2a\u0e32\u0e40\u0e2b\u0e15\u0e38": "=",
            "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48": "=",
            "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e2b\u0e22\u0e38\u0e14, \u0e40\u0e25\u0e34\u0e01\u0e0b\u0e48\u0e2d\u0e21": "=",
            "\u0e40\u0e27\u0e25\u0e32": "=",
            "\u0e27\u0e34\u0e18\u0e35\u0e41\u0e01\u0e49\u0e44\u0e02\u0e40\u0e2b\u0e15\u0e38\u0e40\u0e2a\u0e35\u0e22": "=",
            "\u0e02\u0e2d\u0e07\u0e14\u0e35/\u0e40\u0e25\u0e02SAP": "=",
            "\u0e2a\u0e32\u0e40\u0e2b\u0e15\u0e38 Over SLA": "=",
            "\u0e02\u0e2d\u0e07\u0e40\u0e2a\u0e35\u0e22/\u0e40\u0e25\u0e02SAP": "=",
            "CM report": "=",
            "Admin Name": "=",
            "Admin Verify Date": "="
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Region",
              "displayName": "Region",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "TT No. / PW No.",
              "displayName": "TT No. / PW No.",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Serverity",
              "displayName": "Serverity",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "SLA/TM (\u0e2b\u0e19\u0e48\u0e27\u0e22 \u0e0a\u0e21.)",
              "displayName": "SLA/TM (\u0e2b\u0e19\u0e48\u0e27\u0e22 \u0e0a\u0e21.)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "SLA/T",
              "displayName": "SLA/T",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "TT : \u0e17\u0e35\u0e48\u0e40\u0e04\u0e25\u0e35\u0e22\u0e23\u0e4c\u0e42\u0e14\u0e22\u0e44\u0e21\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e0b\u0e48\u0e2d\u0e21",
              "displayName": "TT : \u0e17\u0e35\u0e48\u0e40\u0e04\u0e25\u0e35\u0e22\u0e23\u0e4c\u0e42\u0e14\u0e22\u0e44\u0e21\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e0b\u0e48\u0e2d\u0e21",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Source",
              "displayName": "Source",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": " Destination",
              "displayName": " Destination",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 Ticket \u0e40\u0e1b\u0e34\u0e14",
              "displayName": "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 Ticket \u0e40\u0e1b\u0e34\u0e14",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e40\u0e1b\u0e34\u0e14 Ticket",
              "displayName": "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e40\u0e1b\u0e34\u0e14 Ticket",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32 Ticket \u0e40\u0e1b\u0e34\u0e14",
              "displayName": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32 Ticket \u0e40\u0e1b\u0e34\u0e14",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "\u0e0a\u0e37\u0e48\u0e2d",
              "displayName": "\u0e0a\u0e37\u0e48\u0e2d",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "\u0e17\u0e35\u0e21",
              "displayName": "\u0e17\u0e35\u0e21",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e02\u0e19\u0e32\u0e14\u0e17\u0e35\u0e21\n(\u0e08.\u0e19.\u0e04\u0e19)",
              "displayName": "\u0e02\u0e19\u0e32\u0e14\u0e17\u0e35\u0e21\n(\u0e08.\u0e19.\u0e04\u0e19)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e2d\u0e2d\u0e01\u0e40\u0e14\u0e34\u0e19\u0e17\u0e32\u0e07",
              "displayName": "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e2d\u0e2d\u0e01\u0e40\u0e14\u0e34\u0e19\u0e17\u0e32\u0e07",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e2d\u0e2d\u0e01\u0e40\u0e14\u0e34\u0e19\u0e17\u0e32\u0e07",
              "displayName": "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e2d\u0e2d\u0e01\u0e40\u0e14\u0e34\u0e19\u0e17\u0e32\u0e07",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32 \u0e2d\u0e2d\u0e01\u0e40\u0e14\u0e34\u0e19\u0e17\u0e32\u0e07",
              "displayName": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32 \u0e2d\u0e2d\u0e01\u0e40\u0e14\u0e34\u0e19\u0e17\u0e32\u0e07",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e40\u0e23\u0e34\u0e48\u0e21\u0e0b\u0e48\u0e2d\u0e21",
              "displayName": "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e40\u0e23\u0e34\u0e48\u0e21\u0e0b\u0e48\u0e2d\u0e21",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e40\u0e23\u0e34\u0e48\u0e21\u0e0b\u0e48\u0e2d\u0e21",
              "displayName": "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e40\u0e23\u0e34\u0e48\u0e21\u0e0b\u0e48\u0e2d\u0e21",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32\u0e40\u0e23\u0e34\u0e48\u0e21\u0e0b\u0e48\u0e2d\u0e21",
              "displayName": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32\u0e40\u0e23\u0e34\u0e48\u0e21\u0e0b\u0e48\u0e2d\u0e21",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "\u0e2a\u0e16\u0e32\u0e19\u0e30",
              "displayName": "\u0e2a\u0e16\u0e32\u0e19\u0e30",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e02\u0e2d\u0e07\u0e2a\u0e16\u0e32\u0e19\u0e30",
              "displayName": "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48\u0e02\u0e2d\u0e07\u0e2a\u0e16\u0e32\u0e19\u0e30",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "\u0e40\u0e27\u0e25\u0e32\u0e02\u0e2d\u0e07\u0e2a\u0e16\u0e32\u0e19\u0e30",
              "displayName": "\u0e40\u0e27\u0e25\u0e32\u0e02\u0e2d\u0e07\u0e2a\u0e16\u0e32\u0e19\u0e30",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32\u0e0b\u0e48\u0e2d\u0e21\u0e40\u0e2a\u0e23\u0e47\u0e08",
              "displayName": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32\u0e0b\u0e48\u0e2d\u0e21\u0e40\u0e2a\u0e23\u0e47\u0e08",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Total Recovery Time (hh:mm)",
              "displayName": "Total Recovery Time (hh:mm)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "SLA (OK/NOK)",
              "displayName": "SLA (OK/NOK)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e2a\u0e32\u0e40\u0e2b\u0e15\u0e38",
              "displayName": "\u0e2a\u0e32\u0e40\u0e2b\u0e15\u0e38",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48",
              "displayName": "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e2b\u0e22\u0e38\u0e14, \u0e40\u0e25\u0e34\u0e01\u0e0b\u0e48\u0e2d\u0e21",
              "displayName": "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e2b\u0e22\u0e38\u0e14, \u0e40\u0e25\u0e34\u0e01\u0e0b\u0e48\u0e2d\u0e21",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e40\u0e27\u0e25\u0e32",
              "displayName": "\u0e40\u0e27\u0e25\u0e32",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e27\u0e34\u0e18\u0e35\u0e41\u0e01\u0e49\u0e44\u0e02\u0e40\u0e2b\u0e15\u0e38\u0e40\u0e2a\u0e35\u0e22",
              "displayName": "\u0e27\u0e34\u0e18\u0e35\u0e41\u0e01\u0e49\u0e44\u0e02\u0e40\u0e2b\u0e15\u0e38\u0e40\u0e2a\u0e35\u0e22",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e2a\u0e32\u0e40\u0e2b\u0e15\u0e38 Over SLA",
              "displayName": "\u0e2a\u0e32\u0e40\u0e2b\u0e15\u0e38 Over SLA",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e02\u0e2d\u0e07\u0e14\u0e35/\u0e40\u0e25\u0e02SAP",
              "displayName": "\u0e02\u0e2d\u0e07\u0e14\u0e35/\u0e40\u0e25\u0e02SAP",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e02\u0e2d\u0e07\u0e40\u0e2a\u0e35\u0e22/\u0e40\u0e25\u0e02SAP",
              "displayName": "\u0e02\u0e2d\u0e07\u0e40\u0e2a\u0e35\u0e22/\u0e40\u0e25\u0e02SAP",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "TT No. / PW No.ServeritySource",
              "displayName": "TT No. / PW No.ServeritySource",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "CM report",
              "displayName": "CM report",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Admin Name",
              "displayName": "Admin Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Admin Verify Date",
              "displayName": "Admin Verify Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        928,
        304
      ],
      "id": "d1bd8e42-505e-4e61-a3b5-5586d08ec3c3",
      "name": "Tools Sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const text = ($json.message?.text || '').toLowerCase().trim();\n\nlet mode = \"unknown\";\n\n// \u0e15\u0e23\u0e27\u0e08 TT number\nif (/tt\\d+/i.test(text)) {\n  if (text.includes(\"\u0e40\u0e0a\u0e47\u0e04\") || text.includes(\"check\")) {\n    mode = \"query_ticket\";\n  } else {\n    mode = \"update_ticket\";\n  }\n}\n\n// \u0e2a\u0e23\u0e38\u0e1b\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49\nelse if (text.includes(\"\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49\")) {\n  mode = \"today_summary\";\n}\n\n// query site\nelse if (text.includes(\"site\")) {\n  mode = \"query_site\";\n}\n\n// \u0e04\u0e37\u0e19\u0e04\u0e48\u0e32\u0e41\u0e1a\u0e1a merge \u0e01\u0e31\u0e1a input \u0e40\u0e14\u0e34\u0e21 (\u0e2a\u0e33\u0e04\u0e31\u0e0d\u0e21\u0e32\u0e01\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a production)\nreturn {\n  ...$json,\n  text,\n  mode,\n  replyToken: $json.replyToken,\n  userId: $json.source?.userId\n};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -32,
        -128
      ],
      "id": "42a76e62-0f1f-40b4-8572-8091bdb039a0",
      "name": "Detect Mode"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "f72d226e-bd76-4673-9541-7541e5d9de3c",
              "leftValue": "={{$json.mode}}",
              "rightValue": "=query_ticket",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            },
            {
              "id": "6ed8fff0-82fc-4aa2-94a8-f2d10fd80543",
              "leftValue": "={{$json.mode}}",
              "rightValue": "=today_summary",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            },
            {
              "id": "bce04745-a77c-46b2-821f-90ea49f098d4",
              "leftValue": "={{$json.mode}}",
              "rightValue": "query_site",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "or"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        128,
        48
      ],
      "id": "da10125e-7268-414e-ba51-c96cb51c6f70",
      "name": "IF - Query Mode"
    },
    {
      "parameters": {
        "jsCode": "return [\n  {\n    json: {\n      ...$json,\n      userId: $items(\"Detect Mode\")[0].json.userId,\n      finalMessage:\n        $json.output ||\n        $json.response ||\n        $json.result ||\n        $json\n    }\n  }\n];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        736,
        -128
      ],
      "id": "a169b4a5-c8fb-48fd-afbc-a21deb7cf5db",
      "name": "Merge User"
    },
    {
      "parameters": {
        "jsCode": "function safeParse(raw) {\n  if (!raw) return null;\n\n  // \u0e16\u0e49\u0e32\u0e40\u0e1b\u0e47\u0e19 object \u0e2d\u0e22\u0e39\u0e48\u0e41\u0e25\u0e49\u0e27\n  if (typeof raw === \"object\") return raw;\n\n  if (typeof raw !== \"string\") return null;\n\n  try {\n    const cleaned = raw\n      .replace(/^```json\\s*/i, '')\n      .replace(/```$/i, '')\n      .trim();\n\n    return JSON.parse(cleaned);\n  } catch (e) {\n    return null;\n  }\n}\n\nconst parsed = safeParse($json.finalMessage);\n\nconst requiredKeys = [\n  \"ticket_no\",\n  \"severity\",\n  \"fault_date\",\n  \"expected_date\",\n  \"owner\",\n  \"go_time\",\n  \"start_time\",\n  \"done_time\",\n  \"status\"\n];\n\nif (!parsed) {\n  return [{\n    json: {\n      error: true,\n      message: \"\u274c AI \u0e2a\u0e48\u0e07 JSON \u0e44\u0e21\u0e48\u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07\"\n    }\n  }];\n}\n\n// \u0e15\u0e23\u0e27\u0e08 key \u0e04\u0e23\u0e1a\u0e44\u0e2b\u0e21\nfor (const key of requiredKeys) {\n  if (!(key in parsed)) {\n    return [{\n      json: {\n        error: true,\n        message: \"\u274c JSON structure \u0e44\u0e21\u0e48\u0e04\u0e23\u0e1a\"\n      }\n    }];\n  }\n}\n\nreturn [{\n  json: parsed\n}];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        912,
        -128
      ],
      "id": "02af16c9-4598-4776-b246-bb0e2fa6c82f",
      "name": "Parse Final JSON"
    },
    {
      "parameters": {
        "content": "",
        "height": 288,
        "width": 608,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        704,
        240
      ],
      "id": "0b47736b-3d6d-4f72-af6e-c3fb89916263",
      "name": "Sticky Note10"
    },
    {
      "parameters": {
        "content": "       \u0e22\u0e31\u0e07\u0e44\u0e21\u0e48\u0e40\u0e02\u0e49\u0e32 node (\u0e22\u0e31\u0e07\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49\u0e43\u0e0a\u0e49)",
        "height": 80,
        "width": 326,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        992,
        448
      ],
      "id": "80b25c79-9092-4770-9395-a415c5ee4ad4",
      "name": "Sticky Note11"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1SpkGa57uRLhoSbc0edGla0QX0gD586tjmrUFJ_xIFgU",
          "mode": "list",
          "cachedResultName": "testdataLAB",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SpkGa57uRLhoSbc0edGla0QX0gD586tjmrUFJ_xIFgU/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 2097907540,
          "mode": "list",
          "cachedResultName": "LABJob_System December 2025",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SpkGa57uRLhoSbc0edGla0QX0gD586tjmrUFJ_xIFgU/edit#gid=2097907540"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": [
            {
              "id": "Job Service",
              "displayName": "Job Service",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e1a\u0e23\u0e34\u0e29\u0e31\u0e17\u0e23\u0e31\u0e1a\u0e40\u0e2b\u0e21\u0e32",
              "displayName": "\u0e1a\u0e23\u0e34\u0e29\u0e31\u0e17\u0e23\u0e31\u0e1a\u0e40\u0e2b\u0e21\u0e32",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e2d\u0e2d\u0e01\u0e40\u0e14\u0e34\u0e19\u0e17\u0e32\u0e07 (Go)",
              "displayName": "\u0e2d\u0e2d\u0e01\u0e40\u0e14\u0e34\u0e19\u0e17\u0e32\u0e07 (Go)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e40\u0e23\u0e34\u0e48\u0e21\u0e0b\u0e48\u0e2d\u0e21 (Start)",
              "displayName": "\u0e40\u0e23\u0e34\u0e48\u0e21\u0e0b\u0e48\u0e2d\u0e21 (Start)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e2a\u0e16\u0e32\u0e19\u0e30\u0e01\u0e32\u0e23\u0e0b\u0e48\u0e2d\u0e21 (Recovery)",
              "displayName": "\u0e2a\u0e16\u0e32\u0e19\u0e30\u0e01\u0e32\u0e23\u0e0b\u0e48\u0e2d\u0e21 (Recovery)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Serial Number",
              "displayName": "Serial Number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "locationDefine": {
            "values": {}
          }
        }
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        768,
        320
      ],
      "id": "e3289f0d-918a-486a-9dbb-2b2d7a19481b",
      "name": "Get row(s) in Google Sheets",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1SpkGa57uRLhoSbc0edGla0QX0gD586tjmrUFJ_xIFgU",
          "mode": "list",
          "cachedResultName": "testdataLAB",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SpkGa57uRLhoSbc0edGla0QX0gD586tjmrUFJ_xIFgU/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 2097907540,
          "mode": "list",
          "cachedResultName": "LABJob_System December 2025",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SpkGa57uRLhoSbc0edGla0QX0gD586tjmrUFJ_xIFgU/edit#gid=2097907540"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {
            "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 Ticket \u0e40\u0e1b\u0e34\u0e14": "={{$json.open_ticket_date}}",
            "Serverity": "={{$json.severity}}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Region",
              "displayName": "Region",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "TT No.",
              "displayName": "TT No.",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Serverity",
              "displayName": "Serverity",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "SLA/TM (\u0e2b\u0e19\u0e48\u0e27\u0e22 \u0e0a\u0e21.)",
              "displayName": "SLA/TM (\u0e2b\u0e19\u0e48\u0e27\u0e22 \u0e0a\u0e21.)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "SLA/T",
              "displayName": "SLA/T",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "TT : \u0e17\u0e35\u0e48\u0e40\u0e04\u0e25\u0e35\u0e22\u0e23\u0e4c\u0e42\u0e14\u0e22\u0e44\u0e21\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e0b\u0e48\u0e2d\u0e21",
              "displayName": "TT : \u0e17\u0e35\u0e48\u0e40\u0e04\u0e25\u0e35\u0e22\u0e23\u0e4c\u0e42\u0e14\u0e22\u0e44\u0e21\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e0b\u0e48\u0e2d\u0e21",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Source",
              "displayName": "Source",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": " Destination",
              "displayName": " Destination",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 Ticket \u0e40\u0e1b\u0e34\u0e14",
              "displayName": "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48 Ticket \u0e40\u0e1b\u0e34\u0e14",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e40\u0e1b\u0e34\u0e14 Ticket",
              "displayName": "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e40\u0e1b\u0e34\u0e14 Ticket",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32 Ticket \u0e40\u0e1b\u0e34\u0e14",
              "displayName": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32 Ticket \u0e40\u0e1b\u0e34\u0e14",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e0a\u0e37\u0e48\u0e2d",
              "displayName": "\u0e0a\u0e37\u0e48\u0e2d",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e17\u0e35\u0e21",
              "displayName": "\u0e17\u0e35\u0e21",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e02\u0e19\u0e32\u0e14\u0e17\u0e35\u0e21\n(\u0e08.\u0e19.\u0e04\u0e19)",
              "displayName": "\u0e02\u0e19\u0e32\u0e14\u0e17\u0e35\u0e21\n(\u0e08.\u0e19.\u0e04\u0e19)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48",
              "displayName": "\u0e27\u0e31\u0e19\u0e17\u0e35\u0e48",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e40\u0e27\u0e25\u0e32",
              "displayName": "\u0e40\u0e27\u0e25\u0e32",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32 \u0e2d\u0e2d\u0e01\u0e40\u0e14\u0e34\u0e19\u0e17\u0e32\u0e07",
              "displayName": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32 \u0e2d\u0e2d\u0e01\u0e40\u0e14\u0e34\u0e19\u0e17\u0e32\u0e07",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32\u0e40\u0e23\u0e34\u0e48\u0e21\u0e0b\u0e48\u0e2d\u0e21",
              "displayName": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32\u0e40\u0e23\u0e34\u0e48\u0e21\u0e0b\u0e48\u0e2d\u0e21",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e2a\u0e16\u0e32\u0e19\u0e30",
              "displayName": "\u0e2a\u0e16\u0e32\u0e19\u0e30",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32\u0e0b\u0e48\u0e2d\u0e21\u0e40\u0e2a\u0e23\u0e47\u0e08",
              "displayName": "\u0e27\u0e31\u0e19\u0e41\u0e25\u0e30\u0e40\u0e27\u0e25\u0e32\u0e0b\u0e48\u0e2d\u0e21\u0e40\u0e2a\u0e23\u0e47\u0e08",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Total Recovery Time (hh:mm)",
              "displayName": "Total Recovery Time (hh:mm)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "SLA (OK/NOK)",
              "displayName": "SLA (OK/NOK)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e2a\u0e32\u0e40\u0e2b\u0e15\u0e38",
              "displayName": "\u0e2a\u0e32\u0e40\u0e2b\u0e15\u0e38",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e2b\u0e22\u0e38\u0e14, \u0e40\u0e25\u0e34\u0e01\u0e0b\u0e48\u0e2d\u0e21",
              "displayName": "\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e2b\u0e22\u0e38\u0e14, \u0e40\u0e25\u0e34\u0e01\u0e0b\u0e48\u0e2d\u0e21",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e27\u0e34\u0e18\u0e35\u0e41\u0e01\u0e49\u0e44\u0e02\u0e40\u0e2b\u0e15\u0e38\u0e40\u0e2a\u0e35\u0e22",
              "displayName": "\u0e27\u0e34\u0e18\u0e35\u0e41\u0e01\u0e49\u0e44\u0e02\u0e40\u0e2b\u0e15\u0e38\u0e40\u0e2a\u0e35\u0e22",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e2a\u0e32\u0e40\u0e2b\u0e15\u0e38 Over SLA",
              "displayName": "\u0e2a\u0e32\u0e40\u0e2b\u0e15\u0e38 Over SLA",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e02\u0e2d\u0e07\u0e14\u0e35/\u0e40\u0e25\u0e02SAP",
              "displayName": "\u0e02\u0e2d\u0e07\u0e14\u0e35/\u0e40\u0e25\u0e02SAP",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u0e02\u0e2d\u0e07\u0e40\u0e2a\u0e35\u0e22/\u0e40\u0e25\u0e02SAP",
              "displayName": "\u0e02\u0e2d\u0e07\u0e40\u0e2a\u0e35\u0e22/\u0e40\u0e25\u0e02SAP",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "TT No. / PW No.ServeritySource",
              "displayName": "TT No. / PW No.ServeritySource",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "CM report",
              "displayName": "CM report",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Admin Name",
              "displayName": "Admin Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Admin Verify Date",
              "displayName": "Admin Verify Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "TT No",
              "displayName": "TT No",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Severity",
              "displayName": "Severity",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "SLA/TM (\u0e2b\u0e19\u0e48\u0e27\u0e22 \u0e0a\u0e21",
              "displayName": "SLA/TM (\u0e2b\u0e19\u0e48\u0e27\u0e22 \u0e0a\u0e21",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "OpenTicketDate",
              "displayName": "OpenTicketDate",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "ExpectedDate",
              "displayName": "ExpectedDate",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "success",
              "displayName": "success",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "response",
              "displayName": "response",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "SLA/TM (\u0e2b\u0e19\u0e48\u0e27\u0e22 \u0e0a\u0e21)",
              "displayName": "SLA/TM (\u0e2b\u0e19\u0e48\u0e27\u0e22 \u0e0a\u0e21)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "owner",
              "displayName": "owner",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "go_time",
              "displayName": "go_time",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "start_time",
              "displayName": "start_time",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "done_time",
              "displayName": "done_time",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "locationDefine": {
            "values": {}
          }
        }
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1520,
        -208
      ],
      "id": "eea83971-079f-4307-ac10-bc1c1b613ad8",
      "name": "Append row in sheet",
      "retryOnFail": true,
      "waitBetweenTries": 2000,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "5babda58-81d0-4a73-8610-6a422d946b38",
              "leftValue": "={{$json.ticket_no}}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        1120,
        -128
      ],
      "id": "9410f008-50cd-4580-982c-e6a944840674",
      "name": "If"
    },
    {
      "parameters": {
        "operation": "send",
        "to": "={{ $('Line Messaging Trigger').item.json.source.groupId || $('Line Messaging Trigger').item.json.source.userId }}",
        "messages": {
          "values": [
            {
              "text": "={{\n`\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e02\u0e2d\u0e07 ${$('Line Messaging Trigger').item.json.source.userId || \"\u0e1c\u0e39\u0e49\u0e41\u0e08\u0e49\u0e07\u0e07\u0e32\u0e19\"} \u0e41\u0e08\u0e49\u0e07\u0e27\u0e48\u0e32\n\n\ud83d\udccc Ticket: ${$json.ticket_no || '-'}\n\u26a1 Severity: ${\n  $json.severity === 'NSA1' ? '\ud83d\udea8\ud83d\udd34 NSA1' :\n  $json.severity === 'NSA2' ? '\u26a0\ufe0f\ud83d\udfe0 NSA2' :\n  $json.severity === 'NSA3' ? '\u26a1\ud83d\udfe1 NSA3' :\n  $json.severity === 'NSA4' ? '\ud83d\udfe2\ud83d\udd35 NSA4' :\n  '-'\n}\n\n\ud83d\udcc5 Fault: ${$json.fault_date || '-'}\n\ud83d\udcc6 Expected: ${$json.expected_date || '-'}\n\ud83d\udcc6 Open Ticket Date:  ${$json.openTicket_date || '-'}\n\n\n\ud83d\ude97 Go: ${$json.go_time || '-'}\n\ud83d\udd27 Start: ${$json.start_time || '-'}\n\u2705 Done: ${$json.done_time || '-'}\n\ud83d\udccd Status: ${$json.status || '-'}\n`\n}} "
            }
          ]
        }
      },
      "type": "@aotoki/n8n-nodes-line-messaging.lineMessaging",
      "typeVersion": 1,
      "position": [
        2016,
        -224
      ],
      "id": "7697a638-516b-42e8-8a1c-8c8cfb33e779",
      "name": "Line Messaging",
      "credentials": {
        "lineMessagingApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "798c952e-16d5-4a69-bc47-a354bbfc12cf",
              "name": "TT No",
              "value": "={{$json.ticket_no}}",
              "type": "string"
            },
            {
              "id": "52a5d7bd-9cd9-40a0-81d7-75aadaad18cf",
              "name": "Severity",
              "value": "={{ $json.severity }}",
              "type": "string"
            },
            {
              "id": "12152c67-4c01-47e0-897c-f0b89a5ff7da",
              "name": "SLA/TM (\u0e2b\u0e19\u0e48\u0e27\u0e22 \u0e0a\u0e21)",
              "value": "={{\n  $json.severity === 'NSA1' ? 4 :\n  $json.severity === 'NSA2' ? 8 :\n  $json.severity === 'NSA3' ? 14 :\n  $json.severity === 'NSA4' ? 24 :\n  0\n}}",
              "type": "string"
            },
            {
              "id": "0b0e29d4-e610-4fab-b6af-e408a94c1a98",
              "name": "OpenTicketDate",
              "value": "={{$json.fault_date}}",
              "type": "string"
            },
            {
              "id": "ae3a42a0-1b86-4048-9467-d64427660a44",
              "name": "ExpectedDate",
              "value": "={{\n  (() => {\n    const base = new Date($json.fault_date);\n    const addHours =\n      $json.severity === 'NSA1' ? 4 :\n      $json.severity === 'NSA2' ? 8 :\n      $json.severity === 'NSA3' ? 14 :\n      $json.severity === 'NSA4' ? 24 :\n      0;\n\n    const result = new Date(base.getTime() + addHours * 60 * 60 * 1000);\n\n    return result.toLocaleString('th-TH', { timeZone: 'Asia/Bangkok' });\n  })()\n}}",
              "type": "string"
            },
            {
              "id": "3c74b154-8314-4e96-befd-b185c03d0a7a",
              "name": "owner",
              "value": "={{ $json.owner }}",
              "type": "string"
            },
            {
              "id": "704cfe8b-2997-4868-a5cf-bb8a74312a85",
              "name": "go_time",
              "value": "={{ $json.go_time }}",
              "type": "string"
            },
            {
              "id": "c61c0ad9-8eb6-4e7b-9d42-6bfff8752335",
              "name": "start_time",
              "value": "={{ $json.start_time }}",
              "type": "string"
            },
            {
              "id": "a6168b76-77a9-4feb-b5b4-8945318971e7",
              "name": "done_time",
              "value": "={{ $json.done_time }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1328,
        -144
      ],
      "id": "61331a7a-6298-4fa1-9f5c-44522107a1ad",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "content": "\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25",
        "height": 176,
        "width": 166,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1488,
        -240
      ],
      "typeVersion": 1,
      "id": "c2d04c39-da30-41e1-974d-13127ca95817",
      "name": "Sticky Note12"
    },
    {
      "parameters": {
        "jsCode": "function clean(value) {\n  if (\n    value === undefined ||\n    value === null ||\n    value === \"\" ||\n    value === \"-\" ||\n    value === \"null\"\n  ) {\n    return null;\n  }\n  return value;\n}\n\nreturn items.map(item => {\n\n  const data = item.json;\n\n  const go = clean(data[\"go_time\"]);\n  const start = clean(data[\"start_time\"]);\n  const done = clean(data[\"done_time\"]);\n\n  let status = null;\n\n  if (done) {\n    status = \"Done\";\n  } else if (start) {\n    status = \"In Progress\";\n  } else if (go) {\n    status = \"On Site\";\n  } else {\n    status = \"Open\";\n  }\n\n  return {\n    json: {\n      ticket_no: clean(data[\"TT No\"]),\n      severity: clean(data[\"Severity\"]),\n      openTicket_date: clean(data[\"OpenTicketDate\"]),\n      fault_date: clean(data[\"OpenTicketDate\"]), // \u0e43\u0e0a\u0e49\u0e15\u0e31\u0e27\u0e19\u0e35\u0e49\u0e1e\u0e2d\n      expected_date: clean(data[\"ExpectedDate\"]),\n      owner: clean(data[\"owner\"]),\n      go_time: go,\n      start_time: start,\n      done_time: done,\n      status: status\n    }\n  };\n});"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1744,
        -224
      ],
      "id": "2757ce1c-787c-4127-9722-5c78f7a095fa",
      "name": "Normalize Ticket Data"
    },
    {
      "parameters": {
        "jsCode": "console.log(\"DEBUG DATA:\", $json);\nreturn items;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        272,
        -128
      ],
      "id": "1d63c63c-0584-417c-88f6-137707d2cc7d",
      "name": "Code ViewError"
    },
    {
      "parameters": {
        "operation": "send",
        "to": "={{ \n  $node[\"Line Messaging Trigger\"].json.source.groupId \n  || \n  $node[\"Line Messaging Trigger\"].json.source.userId \n}}",
        "messages": {
          "values": [
            {
              "text": "=\u26a0\ufe0f \u0e23\u0e30\u0e1a\u0e1a\u0e44\u0e21\u0e48\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01 Ticket \u0e44\u0e14\u0e49\n\u0e01\u0e23\u0e38\u0e13\u0e32\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e41\u0e25\u0e49\u0e27\u0e2a\u0e48\u0e07\u0e43\u0e2b\u0e21\u0e48\u0e2d\u0e35\u0e01\u0e04\u0e23\u0e31\u0e49\u0e07"
            }
          ]
        }
      },
      "type": "@aotoki/n8n-nodes-line-messaging.lineMessaging",
      "typeVersion": 1,
      "position": [
        1552,
        64
      ],
      "id": "cf5e5a3d-2bc7-48c6-97ce-8d6c2f59874b",
      "name": "Line Messaging3",
      "credentials": {
        "lineMessagingApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "return items.map(item => {\n  if (!item.json.reply || item.json.reply.trim() === \"\") {\n    item.json.reply = \"\u0e02\u0e2d\u0e2d\u0e20\u0e31\u0e22 \u0e23\u0e30\u0e1a\u0e1a\u0e44\u0e21\u0e48\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e04\u0e33\u0e15\u0e2d\u0e1a\u0e44\u0e14\u0e49 \u0e01\u0e23\u0e38\u0e13\u0e32\u0e25\u0e2d\u0e07\u0e43\u0e2b\u0e21\u0e48\u0e2d\u0e35\u0e01\u0e04\u0e23\u0e31\u0e49\u0e07\";\n  }\n  return item;\n});"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1328,
        64
      ],
      "id": "574b196b-a10b-4fe5-83e1-8971915a8746",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "content": "reply \u0e42\u0e14\u0e22\u0e2d\u0e34\u0e07 userId / GroupId",
        "width": 246,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1984,
        -272
      ],
      "typeVersion": 1,
      "id": "83f50d75-0685-4fc4-a62e-064bb5f17eae",
      "name": "Sticky Note13"
    },
    {
      "parameters": {
        "content": "2\ufe0f\u20e3 Detect Mode\n\u0e27\u0e34\u0e40\u0e04\u0e23\u0e32\u0e30\u0e2b\u0e4c\u0e27\u0e48\u0e32\u0e1c\u0e39\u0e49\u0e43\u0e0a\u0e49\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e2d\u0e30\u0e44\u0e23\nMode \u0e17\u0e35\u0e48\u0e40\u0e1b\u0e47\u0e19\u0e44\u0e1b\u0e44\u0e14\u0e49\nupdate_ticket\nquery_ticket\ntoday_summary\nquery_site\nunknown",
        "height": 176,
        "width": 198
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        -528
      ],
      "typeVersion": 1,
      "id": "f08ac93a-7583-4a08-9cf3-0eed2de124cc",
      "name": "Sticky Note14"
    },
    {
      "parameters": {
        "content": "4\ufe0f\u20e3 Parse JSON\n\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e27\u0e48\u0e32:\nJSON \u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07\nKey \u0e04\u0e23\u0e1a\n\u0e16\u0e49\u0e32\u0e44\u0e21\u0e48\u0e04\u0e23\u0e1a \u2192 \u0e41\u0e08\u0e49\u0e07 Error",
        "height": 128,
        "width": 176
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -528
      ],
      "typeVersion": 1,
      "id": "9e4b6720-3a23-4c9e-83cc-38a3ac1aa5f9",
      "name": "Sticky Note15"
    },
    {
      "parameters": {
        "content": "6\ufe0f\u20e3 \u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01 Google Sheet\n\n\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25 Ticket \u0e25\u0e07 Sheet \u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34",
        "height": 240,
        "width": 256
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        -528
      ],
      "typeVersion": 1,
      "id": "aff9bf00-e111-41cd-8d25-da6643790ef8",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "content": "\u0e43\u0e0a\u0e49 \u201c\u0e40\u0e09\u0e1e\u0e32\u0e30\u0e01\u0e23\u0e13\u0e35\u201d \u0e17\u0e35\u0e48 AI Agent \u0e2a\u0e48\u0e07\u0e04\u0e48\u0e32\u0e2d\u0e2d\u0e01\u0e21\u0e32\u0e40\u0e1b\u0e47\u0e19 string \u0e40\u0e17\u0e48\u0e32\u0e19\u0e31\u0e49\u0e19",
        "height": 176,
        "width": 208
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        64,
        -272
      ],
      "typeVersion": 1,
      "id": "25cb4016-f821-498d-9cbe-d2e8c9684141",
      "name": "Sticky Note16"
    },
    {
      "parameters": {
        "content": "\u0e40\u0e40\u0e08\u0e49\u0e07 errror",
        "width": 150,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1520,
        32
      ],
      "typeVersion": 1,
      "id": "ade5d5e1-ab63-4750-a836-b9ba73a0b1aa",
      "name": "Sticky Note17"
    },
    {
      "parameters": {
        "content": "# \ud83d\ude80 Ticket Automation Workflow\n\n## 1) LINE Trigger\n- \u0e23\u0e2d\u0e07\u0e23\u0e31\u0e1a Private Chat \u0e41\u0e25\u0e30 Group\n- \u0e43\u0e0a\u0e49 userId / groupId \u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\n- Trigger \u0e40\u0e21\u0e37\u0e48\u0e2d\u0e21\u0e35 message event\n\n## 2) Mode Detection\n- \u0e15\u0e23\u0e27\u0e08\u0e2b\u0e32 TT\\d+\n- \u0e41\u0e22\u0e01\u0e42\u0e2b\u0e21\u0e14:\n  - update_ticket\n  - query_ticket\n  - today_summary\n  - query_site\n\n## 3) AI Parsing (Gemini)\n- \u0e41\u0e1b\u0e25\u0e07\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e40\u0e1b\u0e47\u0e19 Flat JSON \u0e40\u0e17\u0e48\u0e32\u0e19\u0e31\u0e49\u0e19\n- \u0e2b\u0e49\u0e32\u0e21\u0e21\u0e35 Markdown / \u0e2b\u0e49\u0e32\u0e21\u0e21\u0e35 Text \u0e40\u0e01\u0e34\u0e19\n- \u0e04\u0e37\u0e19\u0e04\u0e48\u0e32 null \u0e2b\u0e32\u0e01\u0e44\u0e21\u0e48\u0e1e\u0e1a\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\n- Regex \u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49:\n  - TT\\d+\n  - NSA1\u2013NSA4\n  - !Go#HH:mm\n  - !Star#HH:mm\n  - !Done#HH:mm\n\n## 4) JSON Validation\n- Parse string \u2192 JSON\n- \u0e15\u0e23\u0e27\u0e08\u0e04\u0e23\u0e1a 9 fields:\n  - ticket_no\n  - severity\n  - fault_date\n  - expected_date\n  - owner\n  - go_time\n  - start_time\n  - done_time\n  - status\n- \u0e16\u0e49\u0e32\u0e42\u0e04\u0e23\u0e07\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e1c\u0e34\u0e14 \u2192 \u0e2a\u0e48\u0e07 Error \u0e01\u0e25\u0e31\u0e1a LINE\n\n## 5) SLA Calculation\n- NSA1 = 4 \u0e0a\u0e21.\n- NSA2 = 8 \u0e0a\u0e21.\n- NSA3 = 14 \u0e0a\u0e21.\n- NSA4 = 24 \u0e0a\u0e21.\n- \u0e04\u0e33\u0e19\u0e27\u0e13 ExpectedDate \u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34 (Asia/Bangkok)\n\n## 6) Auto Status Logic\n- done_time \u2192 Done\n- start_time \u2192 In Progress\n- go_time \u2192 On Site\n- \u0e44\u0e21\u0e48\u0e21\u0e35\u0e40\u0e27\u0e25\u0e32 \u2192 Open\n\n## 7) Google Sheets Integration\n- Append Row\n- Auto Retry \u0e40\u0e21\u0e37\u0e48\u0e2d Fail\n- \u0e16\u0e49\u0e32 Error \u2192 \u0e41\u0e08\u0e49\u0e07\u0e40\u0e15\u0e37\u0e2d\u0e19\u0e01\u0e25\u0e31\u0e1a LINE\n\n## 8) LINE Summary Response\n\u0e41\u0e2a\u0e14\u0e07\u0e1c\u0e25:\n- Ticket No\n- Severity (\u0e1e\u0e23\u0e49\u0e2d\u0e21 Emoji)\n- Fault Date\n- Expected Date\n- Go / Start / Done\n- Status",
        "height": 1680,
        "width": 960,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2400,
        -352
      ],
      "typeVersion": 1,
      "id": "b5db10f0-6969-44cf-ac75-79322dd7d155",
      "name": "Sticky Note18"
    },
    {
      "parameters": {
        "operation": "send",
        "to": "={{$node[\"Line Messaging Trigger\"].json.source.groupId || $node[\"Line Messaging Trigger\"].json.source.userId}}",
        "messages": {
          "values": [
            {
              "quoteToken": "=    {\n      \"text\": \"\u26a0\ufe0f \u0e23\u0e30\u0e1a\u0e1a\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e21\u0e35\u0e1b\u0e31\u0e0d\u0e2b\u0e32\u0e0a\u0e31\u0e48\u0e27\u0e04\u0e23\u0e32\u0e27 \u0e01\u0e23\u0e38\u0e13\u0e32\u0e25\u0e2d\u0e07\u0e43\u0e2b\u0e21\u0e48\u0e2d\u0e35\u0e01\u0e04\u0e23\u0e31\u0e49\u0e07\"\n    }\n  ]\n}",
              "text": "\u26a0\ufe0f \u0e23\u0e30\u0e1a\u0e1a\u0e44\u0e21\u0e48\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01 Ticket \u0e44\u0e14\u0e49\n\n\u0e2a\u0e32\u0e40\u0e2b\u0e15\u0e38:\n{{$json.message || \"\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e44\u0e21\u0e48\u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07\"}}\n\n\u0e01\u0e23\u0e38\u0e13\u0e32\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e2d\u0e35\u0e01\u0e04\u0e23\u0e31\u0e49\u0e07"
            }
          ]
        }
      },
      "type": "@aotoki/n8n-nodes-line-messaging.lineMessaging",
      "typeVersion": 1,
      "position": [
        1696,
        -80
      ],
      "id": "3320e5be-33c8-4ab7-847b-1edb23522487",
      "name": "Line Messaging SendError",
      "credentials": {
        "lineMessagingApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Merge User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Line Messaging Trigger": {
      "main": [
        [
          {
            "node": "Detect Mode",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript1": {
      "main": [
        []
      ]
    },
    "Tools Sheet": {
      "ai_tool": [
        []
      ]
    },
    "Detect Mode": {
      "main": [
        [
          {
            "node": "Code ViewError",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF - Query Mode": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Merge User": {
      "main": [
        [
          {
            "node": "Parse Final JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Final JSON": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in Google Sheets": {
      "ai_tool": [
        []
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Line Messaging": {
      "main": [
        []
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "Normalize Ticket Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Line Messaging SendError",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Ticket Data": {
      "main": [
        [
          {
            "node": "Line Messaging",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code ViewError": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Line Messaging3": {
      "main": [
        []
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Line Messaging3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false,
    "timeSavedMode": "dynamic",
    "timezone": "Asia/Bangkok",
    "saveExecutionProgress": true,
    "callerPolicy": "workflowsFromSameOwner",
    "executionTimeout": 20
  },
  "versionId": "d2c835df-7d55-4057-b6c7-0b69fd7345ae",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "eBWvIYsLeHOdknvh",
  "tags": []
}