wait_for_reply
Wait for the next Telegram reply (message, button click, or poll answer) using long polling; returns matching updates or times out so AI agents can pause until a user responds.
Instructions
Wait for the next user reply (message, button click, or poll answer) via long polling.
長輪詢等待使用者下一則回覆(訊息/按鈕點擊/投票作答)。
連續長輪詢(每段最長 10 秒)直到 timeout 秒內出現符合項目或逾時;
poll_interval 僅用於網路錯誤後的退避等待(至少 1 秒),正常情況下不會隔段輪詢。
auto_answer=True(預設)時,回傳的 callback_query 會當下立即以通用提示
應答,payload 標記 auto_answered=True,不需也切勿再用 answer_callback_query
重複應答(將收到 query is too old);應答失敗時改標記 auto_answer_error。
需要自訂提示文字、show_alert 或 url 時設 auto_answer=False。
未設定白名單時回傳設定提示,請 AI 提醒使用者補上 TELEGRAM_ALLOWED_CHAT_IDS 後重啟。
注意:
- 首次呼叫(尚無狀態檔)時會先撈回全部 pending updates,最舊的先被
比對回傳;建議先以 get_updates(mark_read=False) 預覽確認沒有積壓。
- types 以外的更新仍會被讀取推進(offset 單一串流,無法單獨保留);
若等待訊息期間按鈕被點擊,該 callback_query 會被消耗而不回傳,
需要接收點擊事件時請讓 types 涵蓋 callback_query。
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "wait_for_reply"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| types | No | ||
| chat_id | No | ||
| timeout | No | ||
| auto_answer | No | ||
| poll_interval | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |