Telegram Bot API
🌐 한국어

answerGuestQuery

카테고리: 콜백 · Bot API 10.3 · 공식 문서

게스트 모드에서 게스트 쿼리에 응답합니다 (Bot API 10.0).

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

매개변수

매개변수타입필수설명
guest_query_idString예게스트 쿼리 ID
resultInlineQueryResult예InlineQueryResult JSON 객체 — 전송할 메시지

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

요청 예제

curl

curl -s -X POST "https://api.telegram.org/bot$TOKEN/answerGuestQuery" \
  -H "Content-Type: application/json" \
  -d '{
  "guest_query_id": "GUEST_QUERY_ID",
  "result": {
    "type": "article",
    "id": "1",
    "title": "Hello",
    "input_message_content": {
      "message_text": "Hello!"
    }
  }
}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/answerGuestQuery",
    json={
        "guest_query_id": "GUEST_QUERY_ID",
        "result": {
            "type": "article",
            "id": "1",
            "title": "Hello",
            "input_message_content": {
                "message_text": "Hello!"
            }
        }
    },
    timeout=30,
)
print(resp.json())

JavaScript

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/answerGuestQuery`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "guest_query_id": "GUEST_QUERY_ID",
    "result": {
      "type": "article",
      "id": "1",
      "title": "Hello",
      "input_message_content": {
        "message_text": "Hello!"
      }
    }
  }),
});
console.log(await res.json());

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