Telegram Bot API
🌐 한국어

sendRichMessageDraft

카테고리: 리치 메시지 · Bot API 10.3 · 공식 문서

리치 메시지의 일부를 스트리밍합니다 — 30초 미리보기 (Bot API 10.1).

반환값: 성공 시 반환값: True.

매개변수

매개변수타입필수설명
chat_idInteger예개인 채팅 ID
message_thread_idInteger선택토픽 ID (포럼용)
draft_idInteger예고유 초안 ID (0이 아닌 값)
rich_messageInputRichMessage예InputRichMessage JSON 객체 — 스트리밍할 부분 메시지
can_stopBoolean선택이후 초안을 중단하는 버튼 표시 (Bot API 10.3)
keep_on_stopBoolean선택중단 버튼을 눌러도 초안을 채팅에 유지 (Bot API 10.3)

매개변수 설명은 핵심만 간추린 요약입니다. 전체 설명은 공식 문서에서 확인할 수 있습니다.

요청 예제

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());

단계별 가이드: 텔레그램 봇 만들기: @BotFather로 생성하고 첫 메시지 보내기