{
  "name": "OmniWhats — Agente IA (GPT)",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "omniwhats-ai-agent",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "webhook-trigger",
      "name": "Recebe Mensagem",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [250, 300]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.body.data.message.content }}",
        "options": {
          "systemMessage": "Você é um assistente virtual da empresa OmniWhats. Responda de forma educada, objetiva e em português brasileiro.\n\nContexto da mensagem recebida:\n- Nome do contato: {{ $json.body.data.contact.name }}\n- Canal: {{ $json.body.data.channel.name }}\n- Conversa: {{ $json.body.data.conversation.status }}\n\nRegras:\n1. Sempre cumprimente o contato pelo nome quando disponível\n2. Seja breve e direto (máximo 3 parágrafos)\n3. Se não souber a resposta, diga que vai encaminhar para um atendente humano\n4. Nunca invente informações sobre produtos ou serviços"
        }
      },
      "id": "ai-agent",
      "name": "Agente IA",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [520, 300]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "gpt-4o-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "id": "openai-model",
      "name": "GPT-4o Mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [520, 520]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "reply",
              "name": "reply",
              "value": "={{ $json.output }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "set-reply",
      "name": "Monta Resposta",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [780, 300]
    },
    {
      "parameters": {
        "respondWith": "allIncomingItems",
        "options": {
          "responseCode": 200
        }
      },
      "id": "respond-webhook",
      "name": "Responde Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [1020, 300]
    }
  ],
  "pinData": {},
  "connections": {
    "Recebe Mensagem": {
      "main": [
        [
          {
            "node": "Agente IA",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agente IA": {
      "main": [
        [
          {
            "node": "Monta Resposta",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GPT-4o Mini": {
      "ai_languageModel": [
        [
          {
            "node": "Agente IA",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Monta Resposta": {
      "main": [
        [
          {
            "node": "Responde Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "timezone": "America/Sao_Paulo"
  },
  "tags": []
}
