{
  "name": "Bo Tui AI - Phan loai email Gmail bang AI",
  "nodes": [
    {
      "parameters": {
        "content": "## Bỏ Túi AI - Phân loại email Gmail bằng AI\n\nTrước khi bật (Publish/Active):\n1. Tạo 4 nhãn trong Gmail: AI-Gap, AI-CongViec, AI-QuangCao, AI-Khac\n2. Gmail Trigger + 4 node Gắn nhãn: chọn credential Gmail của bạn\n3. 4 node Gắn nhãn: chọn đúng nhãn ở ô Label Names or IDs\n4. Google Gemini Chat Model: chọn credential Gemini + model\n5. Báo Telegram: chọn credential Telegram, điền Chat ID\n6. Thử với vài email tự gửi, xem tab Executions\n\nChỉ gửi cho AI: tiêu đề, người gửi, đoạn trích ngắn (snippet). Không gửi file đính kèm.\nHướng dẫn: botuiai.com/setup/n8n-phan-loai-email",
        "height": 420,
        "width": 420,
        "color": 4
      },
      "id": "34ffa5d5-28b1-49d5-9ab7-2306ba47b394",
      "name": "Huong dan",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -520,
        -220
      ]
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyX",
              "value": 10,
              "unit": "minutes"
            }
          ]
        },
        "simple": true,
        "maxResults": 10,
        "filters": {
          "q": "in:inbox -label:AI-Gap -label:AI-CongViec -label:AI-QuangCao -label:AI-Khac",
          "readStatus": "unread"
        },
        "options": {}
      },
      "id": "03ec0759-d1dd-48fb-8119-e71f1fa3099e",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.4,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "inputText": "=Tiêu đề: {{ $json.Subject }}\nNgười gửi: {{ $json.From }}\nĐoạn đầu: {{ $json.snippet }}",
        "categories": {
          "categories": [
            {
              "category": "Gap",
              "description": "Email cần xử lý trong ngày: khách hàng hoặc sếp yêu cầu gấp, có hạn chót hôm nay hoặc ngày mai, sự cố, khiếu nại."
            },
            {
              "category": "CongViec",
              "description": "Email công việc bình thường từ đồng nghiệp, khách hàng, đối tác: trao đổi, báo cáo, lịch họp, không gấp."
            },
            {
              "category": "QuangCao",
              "description": "Bản tin, khuyến mãi, quảng cáo, thông báo tự động từ dịch vụ, mạng xã hội."
            }
          ]
        },
        "options": {
          "fallback": "other"
        }
      },
      "id": "b6b9f39b-6d1d-4973-8ec4-814010525175",
      "name": "Text Classifier",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "typeVersion": 1.1,
      "position": [
        260,
        0
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "99275497-0380-441a-bf0c-cb33491b0bcd",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1.2,
      "position": [
        260,
        220
      ]
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $json.id }}",
        "labelIds": []
      },
      "id": "047f1a40-f5dd-493a-8391-17ff6ca312bc",
      "name": "Gan nhan AI-Gap",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        620,
        -240
      ]
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $json.id }}",
        "labelIds": []
      },
      "id": "65bd8849-26ce-43ef-ac7b-3c42616907bf",
      "name": "Gan nhan AI-CongViec",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        620,
        -60
      ]
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $json.id }}",
        "labelIds": []
      },
      "id": "a6095020-4d78-4561-accf-e99fd76021fb",
      "name": "Gan nhan AI-QuangCao",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        620,
        120
      ]
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $json.id }}",
        "labelIds": []
      },
      "id": "ef91909a-381a-4f8e-9b23-768e730c7aac",
      "name": "Gan nhan AI-Khac",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        620,
        300
      ]
    },
    {
      "parameters": {
        "chatId": "",
        "text": "=Email GẤP vừa đến\nTiêu đề: {{ $('Gmail Trigger').item.json.Subject }}\nTừ: {{ $('Gmail Trigger').item.json.From }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "id": "aa6f3a8e-5828-429c-add7-5d70488de4ad",
      "name": "Bao Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        880,
        -240
      ]
    }
  ],
  "connections": {
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Text Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Text Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Text Classifier": {
      "main": [
        [
          {
            "node": "Gan nhan AI-Gap",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gan nhan AI-CongViec",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gan nhan AI-QuangCao",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gan nhan AI-Khac",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gan nhan AI-Gap": {
      "main": [
        [
          {
            "node": "Bao Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "active": false
}