{
  "key": "telegram",
  "name": "Telegram",
  "version": "1.0.0",
  "category": "messengers",
  "icon": "/icons/telegram.svg",
  "description": "Отправка сообщений в Telegram и приём новых сообщений через бота.",
  "docsUrl": "https://easy-connect.ru/help/telegram",
  "websiteUrl": "https://telegram.org",
  "auth": {
    "type": "bot_token",
    "fields": [
      {
        "key": "bot_token",
        "label": "Токен бота",
        "type": "string",
        "required": true,
        "placeholder": "123456789:AA...",
        "help": "Получите токен у @BotFather командой /newbot или /token.",
        "maxLength": 128
      }
    ],
    "verify": {
      "key": "get_me",
      "name": "Проверка бота",
      "description": "Вызывает getMe и возвращает имя бота.",
      "inputSchema": [],
      "idempotent": true,
      "timeoutMs": 10000
    }
  },
  "triggers": [
    {
      "key": "new_message",
      "name": "Новое сообщение",
      "description": "Новое сообщение боту или в подключённом чате.",
      "type": "webhook",
      "dedup": {
        "strategy": "event_id",
        "field": "update_id",
        "windowHours": 24
      },
      "sample": {
        "update_id": 100000001,
        "message": {
          "message_id": 42,
          "from": {
            "id": 123456789,
            "first_name": "Иван",
            "username": "ivan"
          },
          "chat": {
            "id": 123456789,
            "type": "private"
          },
          "date": 1760000000,
          "text": "Здравствуйте! Хочу заказать"
        }
      },
      "outputSchema": [
        { "key": "update_id", "label": "ID обновления", "type": "number", "required": true },
        { "key": "message_id", "label": "ID сообщения", "type": "number" },
        { "key": "chat_id", "label": "ID чата", "type": "string", "semantic": "id" },
        { "key": "from_name", "label": "Имя отправителя", "type": "string", "semantic": "name" },
        { "key": "from_username", "label": "Username", "type": "string" },
        { "key": "text", "label": "Текст", "type": "text", "semantic": "message" },
        { "key": "date", "label": "Дата", "type": "datetime" }
      ]
    }
  ],
  "actions": [
    {
      "key": "send_message",
      "name": "Отправить сообщение",
      "description": "Отправляет текстовое сообщение в указанный чат.",
      "idempotent": false,
      "timeoutMs": 15000,
      "inputSchema": [
        {
          "key": "chat_id",
          "label": "Чат",
          "type": "string",
          "required": true,
          "semantic": "id",
          "help": "ID чата или @username канала."
        },
        {
          "key": "text",
          "label": "Текст сообщения",
          "type": "text",
          "required": true,
          "maxLength": 4096,
          "semantic": "message",
          "placeholder": "Новая заявка: {{name}}, {{phone}}"
        },
        {
          "key": "parse_mode",
          "label": "Формат",
          "type": "select",
          "required": false,
          "default": "HTML",
          "options": [
            { "value": "HTML", "label": "HTML" },
            { "value": "Markdown", "label": "Markdown" },
            { "value": "MarkdownV2", "label": "MarkdownV2" }
          ]
        },
        {
          "key": "disable_notification",
          "label": "Без звука",
          "type": "boolean",
          "required": false,
          "default": false
        }
      ],
      "sampleResult": {
        "message_id": 12345,
        "chat": { "id": -1001234567890, "type": "channel" }
      }
    }
  ],
  "rateLimit": {
    "requestsPerSecond": 20,
    "burst": 30
  },
  "allowedHosts": [
    "api.telegram.org"
  ],
  "healthcheck": {
    "method": "GET",
    "path": "/",
    "expectStatus": [200, 404]
  }
}
