stories.sendStory #

Uploads a Telegram Story.

May also be used in a business connection, not by wrapping the query in invokeWithBusinessConnection », but rather by specifying the ID of a controlled business user in peer.

Layer 223

updatesTooLong#e317af7e = Updates;
updateShortMessage#313bc7f8 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
updateShortChatMessage#4d6deea5 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:long chat_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
updateShort#78d4dec1 update:Update date:int = Updates;
updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates;
updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates;
updateShortSentMessage#9015e101 flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
---functions---
stories.sendStory#737fc2ec flags:# pinned:flags.2?true noforwards:flags.4?true fwd_modified:flags.7?true peer:InputPeer media:InputMedia media_areas:flags.5?Vector<MediaArea> caption:flags.0?string entities:flags.1?Vector<MessageEntity> privacy_rules:Vector<InputPrivacyRule> random_id:long period:flags.3?int fwd_from_id:flags.6?InputPeer fwd_from_story:flags.6?int albums:flags.8?Vector<int> = Updates;

Parameters #

NameTypeDescription
flags#Flags, see TL conditional fields
pinnedflags.2?trueWhether to add the story to the profile automatically upon expiration. If not set, the story will only be added to the archive, see here » for more info.
noforwardsflags.4?trueIf set, disables forwards, screenshots, and downloads.
fwd_modifiedflags.7?trueSet this flag when reposting stories with fwd_from_id+fwd_from_story, if the media was modified before reposting.
peerInputPeerThe peer to send the story as.
mediaInputMediaThe story media.
media_areasflags.5?Vector<MediaArea>Media areas associated to the story, see here » for more info.
captionflags.0?stringStory caption.
entitiesflags.1?Vector<MessageEntity>Message entities for styled text, if allowed by the stories_entities client configuration parameter ».
privacy_rulesVector<InputPrivacyRule>Privacy rules for the story, indicating who can or can't view the story.
random_idlongUnique client message ID required to prevent message resending. See here » for more info on random ID deduplication and updateMessageID mapping.
periodflags.3?intPeriod after which the story is moved to archive (and to the profile if pinned is set), in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise.
fwd_from_idflags.6?InputPeerIf set, indicates that this story is a repost of story with ID fwd_from_story posted by the peer in fwd_from_id.
fwd_from_storyflags.6?intIf set, indicates that this story is a repost of story with ID fwd_from_story posted by the peer in fwd_from_id.
albumsflags.8?Vector<int>If set, adds the story to the specified albums.
musicflags.9?InputDocumentIf set, the audio track to play as background music for the story.

Result #

Updates

Both users and bots can use this method #

Possible errors #

CodeTypeDescription
400BOOSTS_REQUIREDThe specified channel must first be boosted by its users in order to perform this action.
403BOT_ACCESS_FORBIDDENThe specified method can be used over a business connection for some operations, but the specified query attempted an operation that is not allowed over a business connection.
400CHANNEL_INVALIDThe provided channel is invalid.
400CHAT_ADMIN_REQUIREDYou must be an admin in this chat to do this.
400IMAGE_PROCESS_FAILEDFailure while processing image.
400MEDIA_CAPTION_TOO_LONGThe caption is too long.
400MEDIA_EMPTYThe provided media object is invalid.
400MEDIA_FILE_INVALIDThe specified media file is invalid.
400MEDIA_TYPE_INVALIDThe specified media type cannot be used in stories.
400MEDIA_VIDEO_STORY_MISSINGA non-story video cannot be repubblished as a story (emitted when trying to resend a non-story video as a story using inputDocument).
400PEER_ID_INVALIDThe provided peer id is invalid.
400PHOTO_INVALID_DIMENSIONSThe photo dimensions are invalid.
400PREMIUM_ACCOUNT_REQUIREDA premium account is required to execute this action.
400REACTION_INVALIDThe specified reaction is invalid.
400STORIES_TOO_MUCHYou have hit the maximum active stories limit as specified by the story_expiring_limit_* client configuration parameters: you should buy a Premium subscription, delete an active story, or wait for the oldest story to expire.
400STORY_PERIOD_INVALIDThe specified story period is invalid for this account.
400VENUE_ID_INVALIDThe specified venue ID is invalid.
400VIDEO_DURATION_INVALIDThe duration of the specified video is invalid.

Telegram Stories #

Telegram users and channels can easily post and view stories through the API.

Styled text with message entities #

How to create styled text with message entities

Client configuration #

The MTProto API has multiple configuration parameters that can be fetched with the appropriate methods.

Privacy settings #

Telegram allows users to specify granular privacy settings, choosing which users can or can't interact with them in certain ways.

Working with Updates #

How to subscribe to updates and handle them properly.

Connected business bots #

Users can connect Telegram bots that will process and answer messages on their behalf. This allows them to seamlessly integrate any existing tools and workflows, or add AI assistants that manage their chats.

invokeWithBusinessConnection #

Invoke a method using a Telegram Business Bot connection, see here » for more info, including a list of the methods that can be wrapped in this constructor.

Make sure to always send queries wrapped in a invokeWithBusinessConnection to the datacenter ID, specified in the dc_id field of the botBusinessConnection that is being used.

Channel and supergroup boosts #

Telegram Premium users can grant their favorite channels and supergroups additional features like the ability to post stories by giving them boosts.

Telegram Premium #

Telegram Premium is an optional subscription service that unlocks additional exclusive client-side and API-side features, while helping support the development of the app.