Telegram Bot API
🌐 Tiếng Việt

sendRichMessageDraft

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

Stream tin nhắn rich từng phần — bản xem trước trong 30 giây (Bot API 10.1).

Giá trị trả về: Nếu thành công, trả về True.

Tham số

Tham sốKiểuBắt buộcMô tả
chat_idIntegerCóID chat riêng
message_thread_idIntegerTùy chọnID chủ đề (cho diễn đàn)
draft_idIntegerCóID bản nháp duy nhất (khác 0)
rich_messageInputRichMessageCóĐối tượng JSON InputRichMessage — phần tin nhắn để stream
can_stopBooleanTùy chọnHiển thị nút dừng các bản nháp tiếp theo (Bot API 10.3)
keep_on_stopBooleanTùy chọnGiữ bản nháp trong chat khi nhấn nút dừng (Bot API 10.3)

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/sendRichMessageDraft" \
  -H "Content-Type: application/json" \
  -d '{
  "chat_id": 123456789,
  "draft_id": 1,
  "rich_message": {
    "markdown": "**Hello** from a rich message"
  }
}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/sendRichMessageDraft",
    json={
        "chat_id": 123456789,
        "draft_id": 1,
        "rich_message": {
            "markdown": "**Hello** from a rich message"
        }
    },
    timeout=30,
)
print(resp.json())

JavaScript

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/sendRichMessageDraft`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "chat_id": 123456789,
    "draft_id": 1,
    "rich_message": {
      "markdown": "**Hello** from a rich message"
    }
  }),
});
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