pinChatMessage
Fija un mensaje en un chat.
Devuelve: Si la llamada tiene éxito, devuelve True.
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 |
message_id | Integer | Sí | ID del mensaje |
disable_notification | Boolean | Opcional | Enviar sin sonido |
Ejemplo de solicitud
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/pinChatMessage" \
-H "Content-Type: application/json" \
-d '{"chat_id":123456789,"message_id":42}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/pinChatMessage",
json={
"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}/pinChatMessage`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789,
"message_id": 42
}),
});
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
banChatMemberBanea a un miembro del chat.unbanChatMemberDesbanea a un miembro del chat.restrictChatMemberRestringe a un miembro del chat.promoteChatMemberPromueve a un miembro del chat a administrador.setChatAdministratorCustomTitleEstablece un título personalizado para un administrador.banChatSenderChatBanea un canal en un grupo/supergrupo.unbanChatSenderChatDesbanea un canal en un grupo/supergrupo.unpinChatMessageDesfija un mensaje en un chat.unpinAllChatMessagesDesfija todos los mensajes de un chat.setChatMemberTagEstablece la etiqueta de un miembro del chat (Bot API 9.5).