StaticGramBot API

getBusinessAccountGiftsЧастично

Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns OwnedGifts on success.

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

OwnedGiftRegular/Unique with a basic Gift/UniqueGift projection; exclude_from_blockchain honoured; sort_by_price sorts each page (keyset order between pages)

Параметры

business_connection_idStringобязательный
Unique identifier of the business connection
exclude_unsavedBooleanнеобязательный
Pass True to exclude gifts that aren't saved to the account's profile page
exclude_savedBooleanнеобязательный
Pass True to exclude gifts that are saved to the account's profile page
exclude_unlimitedBooleanнеобязательный
Pass True to exclude gifts that can be purchased an unlimited number of times
exclude_limited_upgradableBooleanнеобязательный
Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
exclude_limited_non_upgradableBooleanнеобязательный
Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
exclude_uniqueBooleanнеобязательный
Pass True to exclude unique gifts
exclude_from_blockchainBooleanнеобязательный
Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
sort_by_priceBooleanнеобязательный
Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
offsetStringнеобязательный
Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
limitIntegerнеобязательный
The maximum number of gifts to be returned; 1-100. Defaults to 100.

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

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

Ответ (OwnedGifts)

JSON
{
  "ok": true,
  "result": {
    "total_count": 1,
    "gifts": []
  }
}

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