StaticGramBot API

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

Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right. Returns True on success.

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

acts as the business account (payments.convertStarGift), needs can_convert_gifts_to_stars; s<id> owned_gift_id (gift without a service message) → 400 STARGIFT_INVALID

Параметры

business_connection_idStringобязательный
Unique identifier of the business connection
owned_gift_idStringобязательный
Unique identifier of the regular gift that should be converted to Telegram Stars

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

curl
curl "https://api.staticgram.top/bot$TOKEN/convertGiftToStars" \
  -H "Content-Type: application/json" \
  -d '{
    "business_connection_id": "<business_connection_id>",
    "owned_gift_id": "<owned_gift_id>"
  }'
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.convert_gift_to_stars(
    business_connection_id="<business_connection_id>",
    owned_gift_id="<owned_gift_id>",
)
JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/convertGiftToStars`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "business_connection_id": "<business_connection_id>",
    "owned_gift_id": "<owned_gift_id>"
  }),
});
const data = await res.json();

Ответ (True)

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

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