StaticGramBot API

savePreparedKeyboardButtonПоддерживается

Stores a keyboard button that can be used by a user within a Mini App. Returns a PreparedKeyboardButton object.

Особенности StaticGram

request_users / request_chat via Bots.SaveRequestedWebViewButton; request_managed_bot → 400 BUTTON_TYPE_INVALID (no managed bots)

Параметры

user_idIntegerобязательный
Unique identifier of the target user that can use the button
buttonKeyboardButtonобязательный
A JSON-serialized object describing the button to be saved. The button must be of the type request_users, request_chat, or request_managed_bot.

Пример запроса

curl
curl "https://api.staticgram.top/bot$TOKEN/savePreparedKeyboardButton" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": 123456789,
    "button": {}
  }'
aiogram 3
from aiogram import Bot
from aiogram.client.session.aiohttp import AiohttpSession
from aiogram.client.telegram import TelegramAPIServer

session = AiohttpSession(api=TelegramAPIServer.from_base("https://api.staticgram.top"))
bot = Bot(TOKEN, session=session)

result = await bot.save_prepared_keyboard_button(user_id=123456789, button={})
JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/savePreparedKeyboardButton`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "user_id": 123456789,
    "button": {}
  }),
});
const data = await res.json();

Ответ (PreparedKeyboardButton)

JSON
{
  "ok": true,
  "result": {
    "id": "..."
  }
}

Описания методов и типов взяты из официальной документации Telegram Bot API (Bot API 10.3). Адрес API: https://api.staticgram.top