forwardMessage
Reenvía un mensaje.
Devuelve: Si la llamada tiene éxito, devuelve Message.
Parámetros
| Parámetro | Tipo | Obligatorio | Descripción |
|---|---|---|---|
chat_id | Integer or String | Sí | ID del chat de destino |
message_thread_id | Integer | Opcional | ID del tema del foro |
direct_messages_topic_id | Integer | Opcional | ID del tema de mensajes directos (Bot API 10.0) |
from_chat_id | Integer or String | Sí | ID del chat de origen |
video_start_timestamp | Integer | Opcional | Marca de tiempo de inicio del video (Bot API 10.0) |
disable_notification | Boolean | Opcional | Enviar sin sonido |
protect_content | Boolean | Opcional | Proteger el contenido |
message_effect_id | String | Opcional | ID del efecto del mensaje |
suggested_post_parameters | SuggestedPostParameters | Opcional | Objeto JSON SuggestedPostParameters |
message_id | Integer | Sí | ID del mensaje reenviado |
Ejemplo de solicitud
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/forwardMessage" \
-H "Content-Type: application/json" \
-d '{"chat_id":123456789,"from_chat_id":123456789,"message_id":42}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/forwardMessage",
json={
"chat_id": 123456789,
"from_chat_id": 123456789,
"message_id": 42
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/forwardMessage`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789,
"from_chat_id": 123456789,
"message_id": 42
}),
});
console.log(await res.json());
Guía paso a paso: Cómo enviar mensajes con la API de Telegram: sendMessage paso a paso
Métodos relacionados
sendMessageEnvía un mensaje de texto.forwardMessagesReenvía varios mensajes.copyMessageCopia un mensaje sin el enlace al original.copyMessagesCopia varios mensajes.deleteMessageElimina un mensaje.deleteMessagesElimina varios mensajes.sendChatActionEnvía una acción de chat (typing, etc.).sendMessageDraftEnvía un borrador de mensaje: vista previa temporal (Bot API 9.5+).sendContactEnvía un contacto.sendLocationEnvía una ubicación.sendVenueEnvía un lugar.setMessageReactionEstablece una reacción en un mensaje.