StaticGramBot API

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

Reposts a story on behalf of a business account from another business account. Both business accounts must be managed by the same bot, and the story on the source account must have been posted (or reposted) by the bot. Requires the can_manage_stories business bot right for both business accounts. Returns Story on success.

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

source must be a business account connected to the same bot; "originally posted by the bot" is not tracked

Параметры

business_connection_idStringобязательный
Unique identifier of the business connection
from_chat_idIntegerобязательный
Unique identifier of the chat which posted the story that should be reposted
from_story_idIntegerобязательный
Unique identifier of the story that should be reposted
active_periodIntegerобязательный
Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400
post_to_chat_pageBooleanнеобязательный
Pass True to keep the story accessible after it expires
protect_contentBooleanнеобязательный
Pass True if the content of the story must be protected from forwarding and screenshotting

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

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

Ответ (Story)

JSON
{
  "ok": true,
  "result": {
    "chat": {
      "id": 1780243423,
      "type": "private"
    },
    "id": 1780243423
  }
}

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