{
  "name": "Central Bot V2",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "telegram-central",
        "options": {}
      },
      "id": "1",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "2",
      "name": "AI Agent",
      "type": "n8n-nodes-base.aiAgent",
      "typeVersion": 1,
      "position": [
        500,
        300
      ]
    },
    {
      "parameters": {
        "model": "gpt-4o-mini"
      },
      "id": "3",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        450,
        500
      ]
    },
    {
      "parameters": {
        "name": "search_hotels",
        "description": "Searches for hotels by name or city in the database.",
        "method": "GET",
        "url": "https://dxgzqfictchwsatqmtkr.supabase.co/rest/v1/hotels",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "select",
              "value": "hotel_name,city,bot_username"
            },
            {
              "name": "is_active",
              "value": "eq.true"
            }
          ]
        }
      },
      "id": "4",
      "name": "Supabase Search Tool",
      "type": "n8n-nodes-base.aiTool",
      "typeVersion": 1,
      "position": [
        650,
        500
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.telegram.org/bot{{ $env.CENTRAL_BOT_TOKEN }}/sendMessage",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "chat_id",
              "value": "={{ $('Webhook').item.json.body.message.chat.id }}"
            },
            {
              "name": "text",
              "value": "={{ $json.output }}"
            }
          ]
        }
      },
      "id": "5",
      "name": "Send Telegram Message",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        800,
        300
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send Telegram Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Search Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}