StaticGramBot API

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

Transfers an owned unique gift to another user. Requires the can_transfer_and_upgrade_gifts business bot right. Requires can_transfer_stars business bot right if the transfer is paid. Returns True on success.

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

collectibles only; free or paid (needs can_transfer_stars and the exact star_count), needs can_transfer_and_upgrade_gifts

Параметры

business_connection_idStringобязательный
Unique identifier of the business connection
owned_gift_idStringобязательный
Unique identifier of the regular gift that should be transferred
new_owner_chat_idIntegerобязательный
Unique identifier of the chat which will own the gift. The chat must be active in the last 24 hours.
star_countIntegerнеобязательный
The amount of Telegram Stars that will be paid for the transfer from the business account balance. If positive, then the can_transfer_stars business bot right is required.

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

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

Ответ (True)

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

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