answerWebAppQuery
Web App 상호작용 결과를 전송합니다.
반환값: 성공 시 반환값: SentWebAppMessage.
매개변수
| 매개변수 | 타입 | 필수 | 설명 |
|---|---|---|---|
web_app_query_id | String | 예 | Web App 쿼리 ID |
result | InlineQueryResult | 예 | InlineQueryResult JSON 객체 |
요청 예제
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/answerWebAppQuery" \
-H "Content-Type: application/json" \
-d '{
"web_app_query_id": "WEB_APP_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}/answerWebAppQuery",
json={
"web_app_query_id": "WEB_APP_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}/answerWebAppQuery`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"web_app_query_id": "WEB_APP_QUERY_ID",
"result": {
"type": "article",
"id": "1",
"title": "Hello",
"input_message_content": {
"message_text": "Hello!"
}
}
}),
});
console.log(await res.json());
단계별 가이드: 텔레그램 봇 만들기: @BotFather로 생성하고 첫 메시지 보내기
관련 메서드
answerCallbackQuery콜백 쿼리에 응답합니다.answerInlineQuery인라인 쿼리에 응답합니다.answerGuestQuery게스트 모드에서 게스트 쿼리에 응답합니다 (Bot API 10.0).answerChatJoinRequestQuery채팅 가입 요청 쿼리에 응답합니다 (Bot API 10.1).sendChatJoinRequestWebApp채팅 가입 요청 쿼리에 대해 Mini App을 표시합니다 (Bot API 10.1).