editEphemeralMessageText
Chỉnh sửa nội dung củ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 |
text | String | Tùy chọn | Nội dung mới (1-4096, bắt buộc nếu không chỉ định rich_message) |
parse_mode | String | Tùy chọn | HTML, Markdown, MarkdownV2 |
entities | Array of MessageEntity | Tùy chọn | Mảng JSON MessageEntity |
rich_message | InputRichMessage | Tùy chọn | Đối tượng JSON InputRichMessage — bắt buộc nếu không chỉ định text (Bot API 10.3) |
link_preview_options | LinkPreviewOptions | Tùy chọn | Đối tượng JSON LinkPreviewOptions |
reply_markup | InlineKeyboardMarkup | Tùy chọn | JSON: InlineKeyboardMarkup |
Ví dụ request
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/editEphemeralMessageText" \
-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}/editEphemeralMessageText",
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}/editEphemeralMessageText`, {
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
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).deleteEphemeralMessageXóa tin nhắn tạm thời (Bot API 10.2).