{
  "name": "Classificar inbox com IA",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "simple": true,
        "filters": {},
        "options": {}
      },
      "id": "fd65d0f8-05a2-4514-b6cd-00b958036809",
      "name": "Novo email",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "inputText": "={{ $json.Subject }}\n\n{{ $json.snippet }}",
        "categories": {
          "categories": [
            {
              "category": "Orçamento",
              "description": "Pedido de preço, proposta ou orçamento"
            },
            {
              "category": "Suporte",
              "description": "Cliente com problema ou dúvida"
            },
            {
              "category": "Fatura",
              "description": "Fatura, recibo ou nota de pagamento"
            },
            {
              "category": "Outro",
              "description": "Newsletters, publicidade e restantes"
            }
          ]
        },
        "options": {}
      },
      "id": "d3ed251c-7bda-4fe0-9757-2b82d299e969",
      "name": "Classificar",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "typeVersion": 1,
      "position": [
        240,
        0
      ]
    },
    {
      "parameters": {
        "model": "gpt-4o-mini",
        "options": {}
      },
      "id": "3e06f93b-de61-4fb8-935a-f236040c9b9f",
      "name": "Modelo OpenAI",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        240,
        220
      ]
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $('Novo email').item.json.id }}",
        "labelIds": [
          "ETIQUETA_ORÇAMENTO"
        ]
      },
      "id": "1de77b22-43c8-48f0-a714-43b17d5e0ced",
      "name": "Etiqueta Orçamento",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        480,
        -160
      ]
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $('Novo email').item.json.id }}",
        "labelIds": [
          "ETIQUETA_SUPORTE"
        ]
      },
      "id": "1fd44af6-b04f-42f2-a038-5b2d31d41726",
      "name": "Etiqueta Suporte",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        480,
        0
      ]
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $('Novo email').item.json.id }}",
        "labelIds": [
          "ETIQUETA_FATURA"
        ]
      },
      "id": "9c1ef997-db35-4c1d-8106-5c589b149f26",
      "name": "Etiqueta Fatura",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        480,
        160
      ]
    },
    {
      "parameters": {
        "operation": "addLabels",
        "messageId": "={{ $('Novo email').item.json.id }}",
        "labelIds": [
          "ETIQUETA_OUTRO"
        ]
      },
      "id": "3a94a5bd-16c6-4def-9937-6101c9b58c86",
      "name": "Etiqueta Outro",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        480,
        320
      ]
    }
  ],
  "connections": {
    "Modelo OpenAI": {
      "ai_languageModel": [
        [
          {
            "node": "Classificar",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Novo email": {
      "main": [
        [
          {
            "node": "Classificar",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classificar": {
      "main": [
        [
          {
            "node": "Etiqueta Orçamento",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Etiqueta Suporte",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Etiqueta Fatura",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Etiqueta Outro",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "timezone": "Europe/Lisbon"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false,
    "source": "automacoespme"
  },
  "tags": []
}