Telegram Bot API
🌐 Português

repostStory

Categoria: Stories · Bot API 10.3 · Documentação oficial

Reposta um story entre contas comerciais (Bot API 9.3).

Retorno: Em caso de sucesso, retorna Story.

Parâmetros

ParâmetroTipoObrigatórioDescrição
business_connection_idStringSimID da conexão comercial
from_chat_idIntegerSimChat ID de quem publicou o story
from_story_idIntegerSimID do story a repostar
active_periodIntegerSimPeríodo ativo em segundos: 21600, 43200, 86400 ou 172800
post_to_chat_pageBooleanOpcionalManter o story acessível após expirar
protect_contentBooleanOpcionalProteger o conteúdo contra encaminhamento e capturas de tela

As descrições dos parâmetros são resumos concisos; consulte a documentação oficial para ver o texto completo.

Exemplo de requisição

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

Guia passo a passo: Como criar um bot no Telegram grátis: do BotFather à primeira mensagem