sendRichMessage
Envía un mensaje enriquecido con formato estructurado (Bot API 10.1).
Devuelve: Si la llamada tiene éxito, devuelve Message.
Parámetros
| Parámetro | Tipo | Obligatorio | Descripción |
|---|---|---|---|
business_connection_id | String | Opcional | ID de la conexión empresarial |
chat_id | Integer or String | Sí | ID del chat o @username |
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) |
ephemeral_message_parameters | EphemeralMessageParameters | Opcional | Objeto JSON EphemeralMessageParameters — mensaje efímero visible para un solo usuario (Bot API 10.3) |
rich_message | InputRichMessage | Sí | Objeto JSON InputRichMessage — contenido del mensaje enriquecido |
disable_notification | Boolean | Opcional | Enviar sin sonido |
protect_content | Boolean | Opcional | Proteger el contenido |
allow_paid_broadcast | Boolean | Opcional | Permitir difusión de pago (0.1 Stars/mensaje) |
message_effect_id | String | Opcional | ID del efecto del mensaje |
suggested_post_parameters | SuggestedPostParameters | Opcional | Objeto JSON SuggestedPostParameters (para canales) |
reply_parameters | ReplyParameters | Opcional | Objeto JSON ReplyParameters |
reply_markup | InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | Opcional | Objeto JSON: InlineKeyboardMarkup / ReplyKeyboardMarkup / ReplyKeyboardRemove / ForceReply |
Ejemplo de solicitud
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/sendRichMessage" \
-H "Content-Type: application/json" \
-d '{
"chat_id": 123456789,
"rich_message": {
"markdown": "**Hello** from a rich message"
}
}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/sendRichMessage",
json={
"chat_id": 123456789,
"rich_message": {
"markdown": "**Hello** from a rich message"
}
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/sendRichMessage`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789,
"rich_message": {
"markdown": "**Hello** from a rich message"
}
}),
});
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
Métodos relacionados
sendRichMessageDraftTransmite un mensaje enriquecido parcial: vista previa de 30 segundos (Bot API 10.1).