repostStory
在商业账户之间转发动态 (Bot API 9.3)。
返回值: 调用成功时返回 Story。
参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
business_connection_id | String | 是 | 商业连接 ID |
from_chat_id | Integer | 是 | 发布该动态的聊天 ID |
from_story_id | Integer | 是 | 要转发的动态 ID |
active_period | Integer | 是 | 有效期(秒):21600、43200、86400 或 172800 |
post_to_chat_page | Boolean | 可选 | 动态过期后仍可访问 |
protect_content | Boolean | 可选 | 保护内容,禁止转发和截图 |
请求示例
curl
curl -s -X POST "https://api.telegram.org/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": 86400
}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/repostStory",
json={
"business_connection_id": "BUSINESS_CONNECTION_ID",
"from_chat_id": 123456789,
"from_story_id": 1,
"active_period": 86400
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/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": 86400
}),
});
console.log(await res.json());
分步教程: Telegram 机器人教程:从零创建 Telegram 机器人并发送第一条消息
相关方法
postStory代表商业账户发布动态。editStory代表商业账户编辑动态。deleteStory代表商业账户删除动态。