setMessageReaction
Đặt cảm xúc cho tin nhắn.
Giá trị trả về: Nếu thành công, trả về True.
Tham số
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
chat_id | Integer or String | Có | ID chat hoặc @username |
message_id | Integer | Có | ID tin nhắn |
reaction | Array of ReactionType | Tùy chọn | Mảng JSON ReactionType |
is_big | Boolean | Tùy chọn | Hiển thị cảm xúc cỡ lớn |
Ví dụ request
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/setMessageReaction" \
-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}/setMessageReaction",
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}/setMessageReaction`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789,
"message_id": 42
}),
});
console.log(await res.json());
Hướng dẫn từng bước: Cách tạo bot Telegram từ A đến Z: BotFather, token và tin nhắn đầu tiên
Phương thức liên quan
sendMessageGửi tin nhắn văn bản.forwardMessageChuyển tiếp một tin nhắn.forwardMessagesChuyển tiếp nhiều tin nhắn.copyMessageSao chép tin nhắn mà không kèm liên kết chuyển tiếp.copyMessagesSao chép nhiều tin nhắn.deleteMessageXóa một tin nhắn.deleteMessagesXóa nhiều tin nhắn.sendChatActionGửi hành động trong chat (đang nhập, v.v.).sendMessageDraftGửi bản nháp tin nhắn - bản xem trước tạm thời (Bot API 9.5+).sendContactGửi thông tin liên hệ.sendLocationGửi vị trí.sendVenueGửi địa điểm.