{
  "name": "fluxo-ingestao",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "feedback",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -192,
        -64
      ],
      "id": "df079ebf-8fd1-446d-987a-2bf04b6481a3",
      "name": "Webhook"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.groq.com/openai/v1/chat/completions",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{\n  {\n    \"model\": \"llama-3.3-70b-versatile\",\n    \"messages\": [\n      {\n        \"role\": \"system\",\n        \"content\": \"Voc\u00ea \u00e9 um classificador de sentimentos. Classifique o sentimento do feedback. Regras estritas:\\n1. POSITIVO: Apenas se houver elogios claros, gratid\u00e3o ou satisfa\u00e7\u00e3o.\\n2. NEGATIVO: Se houver reclama\u00e7\u00e3o, erro, bug ou insatisfa\u00e7\u00e3o.\\n3. NEUTRO: D\u00favidas, perguntas, sugest\u00f5es de melhoria ou fatos sem emo\u00e7\u00e3o.\\n\\nResponda APENAS com uma das palavras: positivo, neutro, negativo. Sem pontua\u00e7\u00e3o.\"\n      },\n      {\n        \"role\": \"user\",\n        \"content\": $('Webhook').item.json.body.feedback\n      }\n    ]\n  }\n}}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        16,
        -64
      ],
      "id": "bbfd8486-a40a-4740-a77a-5512fbcda7a8",
      "name": "HTTP Request",
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "tableId": "feedbacks",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "nome",
              "fieldValue": "={{ $('Webhook').item.json.body.nome }}"
            },
            {
              "fieldId": "email",
              "fieldValue": "={{ $('Webhook').item.json.body.email }}"
            },
            {
              "fieldId": "feedback",
              "fieldValue": "={{ $('Webhook').item.json.body.feedback }}"
            },
            {
              "fieldId": "sentimento",
              "fieldValue": "={{ $json.choices[0].message.content }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        224,
        -64
      ],
      "id": "9d0d8045-e97d-4887-b348-c11934a2889d",
      "name": "Create a row",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Create a row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false
  },
  "versionId": "66acdb82-a8f6-4436-9dd2-7c4adf138e0c",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "MWeMg5UM6sJf9CIsd3lkL",
  "tags": []
}