answerGuestQuery
게스트 모드에서 게스트 쿼리에 응답합니다 (Bot API 10.0).
반환값: 성공 시 반환값: SentGuestMessage.
매개변수
| 매개변수 | 타입 | 필수 | 설명 |
|---|---|---|---|
guest_query_id | String | 예 | 게스트 쿼리 ID |
result | InlineQueryResult | 예 | 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로 생성하고 첫 메시지 보내기
관련 메서드
answerCallbackQuery콜백 쿼리에 응답합니다.answerInlineQuery인라인 쿼리에 응답합니다.answerWebAppQueryWeb App 상호작용 결과를 전송합니다.answerChatJoinRequestQuery채팅 가입 요청 쿼리에 응답합니다 (Bot API 10.1).sendChatJoinRequestWebApp채팅 가입 요청 쿼리에 대해 Mini App을 표시합니다 (Bot API 10.1).