{
  "name": "Hubris · Telegram-бот с памятью",
  "nodes": [
    {
      "parameters": {
        "content": "## Telegram-бот с памятью\n\nЧтобы запустить:\n1. Добавьте credential типа **OpenAI API**:\n   - API Key: `sk-gw-...` (ваш ключ Hubris)\n   - Base URL: `https://api.hubris.pw/v1`\n2. Добавьте credential **Telegram API** с токеном вашего бота.\n3. В узле «AI Reply» выберите Hubris credential и нужную модель.\n4. Активируйте workflow — бот начнёт отвечать на сообщения.",
        "height": 240,
        "width": 500
      },
      "id": "sticky-note-1",
      "name": "Инструкция",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [0, 0]
    },
    {
      "parameters": {
        "updates": ["message"],
        "additionalFields": {}
      },
      "id": "telegram-trigger-1",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.1,
      "position": [560, 160],
      "webhookId": "telegram-bot",
      "credentials": {
        "telegramApi": {
          "id": "YOUR_TELEGRAM_CREDENTIAL_ID",
          "name": "Telegram Bot"
        }
      }
    },
    {
      "parameters": {
        "authentication": "apiKey",
        "resource": "chat",
        "operation": "complete",
        "model": "anthropic/claude-sonnet-4-5",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "Ты — дружелюбный ИИ-ассистент в Telegram. Отвечай на русском языке кратко и по делу. Если вопрос на другом языке — отвечай на том же языке."
            },
            {
              "role": "user",
              "content": "={{ $json.message.text }}"
            }
          ]
        },
        "options": {}
      },
      "id": "openai-1",
      "name": "AI Reply",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [780, 160],
      "credentials": {
        "openAiApi": {
          "id": "YOUR_CREDENTIAL_ID",
          "name": "Hubris OpenAI"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "text": "={{ $json.message.content }}",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "id": "telegram-send-1",
      "name": "Send Reply",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [1000, 160],
      "credentials": {
        "telegramApi": {
          "id": "YOUR_TELEGRAM_CREDENTIAL_ID",
          "name": "Telegram Bot"
        }
      }
    }
  ],
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "AI Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Reply": {
      "main": [
        [
          {
            "node": "Send Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": true
  }
}
