postStory
İşletme hesabı adına hikaye paylaşır.
Dönüş değeri: Başarılı olduğunda Story döndürür.
Parametreler
| Parametre | Tür | Zorunlu | Açıklama |
|---|---|---|---|
business_connection_id | String | Evet | İşletme bağlantısı ID'si |
content | InputStoryContent | Evet | JSON InputStoryContent nesnesi |
active_period | Integer | Evet | Aktif kalma süresi (saniye): 21600, 43200, 86400 veya 172800 |
caption | String | İsteğe bağlı | Altyazı (0-2048) |
parse_mode | String | İsteğe bağlı | HTML, Markdown, MarkdownV2 |
caption_entities | Array of MessageEntity | İsteğe bağlı | JSON MessageEntity dizisi |
areas | Array of StoryArea | İsteğe bağlı | JSON StoryArea dizisi |
post_to_chat_page | Boolean | İsteğe bağlı | Sohbet sayfasında yayınla |
protect_content | Boolean | İsteğe bağlı | İçeriği koru |
Örnek istek
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());
Adım adım rehber: Telegram bot nasıl yapılır? BotFather ile adım adım bot oluşturma
İlgili metotlar
editStoryİşletme hesabı adına hikayeyi düzenler.deleteStoryİşletme hesabı adına hikayeyi siler.repostStoryHikayeyi işletme hesapları arasında yeniden paylaşır (Bot API 9.3).