Telegram Bot API
🌐 Español

repostStory

Categoría: Historias · Bot API 10.3 · Documentación oficial

Republica una historia entre cuentas empresariales (Bot API 9.3).

Devuelve: Si la llamada tiene éxito, devuelve Story.

Parámetros

ParámetroTipoObligatorioDescripción
business_connection_idStringSíID de la conexión empresarial
from_chat_idIntegerSíID del chat que publicó la historia
from_story_idIntegerSíID de la historia a republicar
active_periodIntegerSíPeríodo de actividad en segundos: 21600, 43200, 86400 o 172800
post_to_chat_pageBooleanOpcionalMantener la historia accesible después de que expire
protect_contentBooleanOpcionalProteger el contenido contra reenvíos y capturas de pantalla

Las descripciones de los parámetros son resúmenes breves; consulta la documentación oficial para ver el texto completo.

Ejemplo de solicitud

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());

Guía paso a paso: Cómo crear un bot en Telegram paso a paso: de BotFather a tu primer mensaje