Telegram Bot API
🌐 Tiếng Việt

editEphemeralMessageMedia

Danh mục: Tin nhắn tạm thời · Bot API 10.3 · Tài liệu chính thức

Chỉnh sửa media 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ểuBắt buộcMô tả
chat_idInteger or StringCóID chat hoặc @username
receiver_user_idIntegerCóID của người dùng đã nhận tin nhắn
ephemeral_message_idIntegerCóID tin nhắn tạm thời
mediaInputMediaCóĐối tượng JSON InputMedia
reply_markupInlineKeyboardMarkupTùy chọnJSON: InlineKeyboardMarkup

Mô tả tham số chỉ là bản tóm tắt ngắn gọn; xem tài liệu chính thức để đọc toàn văn.

Ví dụ request

curl

curl -s -X POST "https://api.telegram.org/bot$TOKEN/editEphemeralMessageMedia" \
  -H "Content-Type: application/json" \
  -d '{
  "chat_id": 123456789,
  "receiver_user_id": 123456789,
  "ephemeral_message_id": 1,
  "media": {
    "type": "photo",
    "media": "https://telegram.org/img/t_logo.png"
  }
}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/editEphemeralMessageMedia",
    json={
        "chat_id": 123456789,
        "receiver_user_id": 123456789,
        "ephemeral_message_id": 1,
        "media": {
            "type": "photo",
            "media": "https://telegram.org/img/t_logo.png"
        }
    },
    timeout=30,
)
print(resp.json())

JavaScript

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/editEphemeralMessageMedia`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "chat_id": 123456789,
    "receiver_user_id": 123456789,
    "ephemeral_message_id": 1,
    "media": {
      "type": "photo",
      "media": "https://telegram.org/img/t_logo.png"
    }
  }),
});
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