postStory
Posts a story on behalf of a business account.
Returns: On success, returns Story.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
business_connection_id | String | Yes | Business connection ID |
content | InputStoryContent | Yes | JSON InputStoryContent object |
active_period | Integer | Yes | Active period in seconds: 21600, 43200, 86400 or 172800 |
caption | String | Optional | Caption (0-2048) |
parse_mode | String | Optional | HTML, Markdown, MarkdownV2 |
caption_entities | Array of MessageEntity | Optional | JSON MessageEntity array |
areas | Array of StoryArea | Optional | JSON StoryArea array |
post_to_chat_page | Boolean | Optional | Post to chat page |
protect_content | Boolean | Optional | Protect content |
Example request
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/postStory" \
-H "Content-Type: application/json" \
-d '{
"business_connection_id": "BUSINESS_CONNECTION_ID",
"content": {
"type": "photo",
"photo": "attach://photo"
},
"active_period": 86400
}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/postStory",
json={
"business_connection_id": "BUSINESS_CONNECTION_ID",
"content": {
"type": "photo",
"photo": "attach://photo"
},
"active_period": 86400
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/postStory`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"business_connection_id": "BUSINESS_CONNECTION_ID",
"content": {
"type": "photo",
"photo": "attach://photo"
},
"active_period": 86400
}),
});
console.log(await res.json());
Step-by-step guide: How to Create a Telegram Bot: Step by Step with BotFather and Python
Related methods
editStoryEdits a story on behalf of a business account.deleteStoryDeletes a story on behalf of a business account.repostStoryReposts a story between business accounts (Bot API 9.3).