StaticGramBot API

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

Upgrades a given regular gift to a unique gift. Requires the can_transfer_and_upgrade_gifts business bot right. Additionally requires the can_transfer_stars business bot right if the upgrade is paid. Returns True on success.

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

prepaid upgrades free; otherwise needs can_transfer_stars and star_count = upgrade price (else 400 STAR_COUNT_INVALID), paid from the business balance

Параметры

business_connection_idStringобязательный
Unique identifier of the business connection
owned_gift_idStringобязательный
Unique identifier of the regular gift that should be upgraded to a unique one
keep_original_detailsBooleanнеобязательный
Pass True to keep the original gift text, sender and receiver in the upgraded gift
star_countIntegerнеобязательный
The amount of Telegram Stars that will be paid for the upgrade from the business account balance. If gift.prepaid_upgrade_star_count > 0, then pass 0, otherwise, the can_transfer_stars business bot right is required and gift.upgrade_star_count must be passed.

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

curl
curl "https://api.staticgram.top/bot$TOKEN/upgradeGift" \
  -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.upgrade_gift(
    business_connection_id="<business_connection_id>",
    owned_gift_id="<owned_gift_id>",
)
JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/upgradeGift`, {
  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