StaticGramBot API

createChatSubscriptionInviteLinkЧастично

Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.

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

parameters validated, then 400 subscription invite links are not supported by this server (no Stars subscription billing in the core)

Параметры

chat_idInteger or Stringобязательный
Unique identifier for the target channel chat or username of the target channel in the format @username
nameStringнеобязательный
Invite link name; 0-32 characters
subscription_periodIntegerобязательный
The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
subscription_priceIntegerобязательный
The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000

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

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

Ответ (ChatInviteLink)

JSON
{
  "ok": true,
  "result": {
    "invite_link": "...",
    "creator": {
      "id": 1780243423,
      "is_bot": true,
      "first_name": "..."
    },
    "creates_join_request": true,
    "is_primary": true,
    "is_revoked": true
  }
}

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