deleteEphemeralMessage
Xóa tin nhắn tạm thời (Bot API 10.2).
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 |
receiver_user_id | Integer | Có | ID của người dùng đã nhận tin nhắn |
ephemeral_message_id | Integer | Có | ID tin nhắn tạm thời |
Ví dụ request
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/deleteEphemeralMessage" \
-H "Content-Type: application/json" \
-d '{
"chat_id": 123456789,
"receiver_user_id": 123456789,
"ephemeral_message_id": 1
}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/deleteEphemeralMessage",
json={
"chat_id": 123456789,
"receiver_user_id": 123456789,
"ephemeral_message_id": 1
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/deleteEphemeralMessage`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789,
"receiver_user_id": 123456789,
"ephemeral_message_id": 1
}),
});
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
editEphemeralMessageTextChỉnh sửa nội dung của tin nhắn tạm thời (Bot API 10.2).editEphemeralMessageMediaChỉnh sửa media của tin nhắn tạm thời (Bot API 10.2).editEphemeralMessageCaptionChỉnh sửa chú thích của tin nhắn tạm thời (Bot API 10.2).editEphemeralMessageReplyMarkupChỉnh sửa reply markup của tin nhắn tạm thời (Bot API 10.2).