StaticGramBot API

postStoryЧастично

Posts a story on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success.

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

needs can_manage_stories; attach:// photo/video, caption/entities, active_period, post_to_chat_page, protect_content, location/suggested_reaction/link/weather areas; unique_gift areas → 400 STORY_AREA_UNSUPPORTED

Параметры

business_connection_idStringобязательный
Unique identifier of the business connection
contentInputStoryContentобязательный
Content of the story
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
captionStringнеобязательный
Caption of the story, 0-2048 characters after entities parsing
parse_modeStringнеобязательный
Mode for parsing entities in the story caption. See formatting options for more details.
caption_entitiesArray of MessageEntityнеобязательный
A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
areasArray of StoryAreaнеобязательный
A JSON-serialized list of clickable areas to be shown on the story
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/postStory" \
  -H "Content-Type: application/json" \
  -d '{
    "business_connection_id": "<business_connection_id>",
    "content": {},
    "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.post_story(
    business_connection_id="<business_connection_id>",
    content={},
    active_period=1,
)
JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/postStory`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "business_connection_id": "<business_connection_id>",
    "content": {},
    "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