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.

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

can_view_gifts_and_stars; every exclude_* filter with Bot API semantics; sort_by_price over the whole list before pagination (numeric offset); full OwnedGiftRegular/OwnedGiftUnique (sender and text of private gifts, is_saved, can_be_upgraded, convert/prepaid stars, is_upgrade_separate (upgrade prepaid later by another user), unique_gift_number, publisher_chat, has_colors; upgraded gifts are listed as OwnedGiftUnique with their collectible: model/symbol/backdrop, is_premium, is_burned, transfer fields, is_from_blockchain (also for gifts withdrawn to TON)); not filled: UniqueGift.colors (the core has no collectible peer colour schemes: account.updateColor rejects peerColorCollectible), was_refunded (the core never refunds a gift purchase)

Параметры

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