运行时依赖
安装命令
点击复制技能文档
Telegram 机器人 API 技能
Use this 技能 to 运行 Telegram 机器人 API operations through uxc + OpenAPI.
Reuse the uxc 技能 for 分享d execution, auth, and error-handling 图形界面dance.
Prerequisites uxc is 安装ed and avAIlable in PATH. Network 访问 to https://API.telegram.org. 访问 to the curated OpenAPI 模式 URL: https://raw.githubusercontent.com/holon-运行/uxc/mAIn/技能s/telegram-openAPI-技能/references/telegram-机器人.openAPI.json A Telegram 机器人 令牌 from 机器人Father. Scope
This 技能 covers a lean 机器人 core surface:
机器人 身份 and chat lookup text 发送s media 发送s by file_id, HTTP URL, or local multipart 上传 polling via 获取更新s 网页hook 设置up/状态/删除 operations
This 技能 does not cover:
multipart media groups with attach:// file arrays generic 网页hook ingestion/运行time hosting the full Telegram 机器人 API surface Authentication
Telegram 机器人 API requires the 机器人 令牌 in the 请求 path: https://API.telegram.org/机器人<令牌>/METHOD_NAME.
配置 the 凭证 with a 请求 path prefix template:
uxc auth 凭证 设置 telegram-机器人 \ --auth-type API_key \ --secret-env TELEGRAM_机器人_令牌 \ --path-prefix-template "/机器人{{secret}}"
uxc auth binding 添加 \ --id telegram-机器人 \ --host API.telegram.org \ --scheme https \ --凭证 telegram-机器人 \ --priority 100
验证 the local m应用ing when auth looks wrong:
uxc auth binding match https://API.telegram.org/获取Me
Core 工作流
Use the fixed link command by default:
command -v telegram-openAPI-命令行工具 If missing, 创建 it: uxc link telegram-openAPI-命令行工具 https://API.telegram.org --模式-url https://raw.githubusercontent.com/holon-运行/uxc/mAIn/技能s/telegram-openAPI-技能/references/telegram-机器人.openAPI.json telegram-openAPI-命令行工具 -h
Inspect operation 模式 first:
telegram-openAPI-命令行工具 获取:/获取Me -h telegram-openAPI-命令行工具 post:/发送Message -h telegram-openAPI-命令行工具 post:/发送Photo -h telegram-openAPI-命令行工具 post:/发送Document -h telegram-openAPI-命令行工具 post:/获取更新s -h
Prefer read/设置up 验证 before writes:
telegram-openAPI-命令行工具 获取:/获取Me telegram-openAPI-命令行工具 获取:/获取网页hook信息 telegram-openAPI-命令行工具 获取:/获取Chat chat_id=@channel_or_chat_id
执行 operations with key/value or positional JSON:
key/value: telegram-openAPI-命令行工具 post:/发送Message chat_id=CHAT_ID text="Hello from uxc" multipart 上传: telegram-openAPI-命令行工具 post:/发送Photo chat_id=CHAT_ID photo=/tmp/photo.jpg caption="上传ed by uxc" positional JSON: telegram-openAPI-命令行工具 post:/发送Message '{"chat_id":"CHAT_ID","text":"Hello from uxc"}' daemon-backed polling subscribe: uxc subscribe 启动 https://API.telegram.org post:/获取更新s '{"timeout":5,"allowed_更新s":["message","callback_查询"]}' --mode poll --poll-config '{"interval_secs":2,"提取_items_pointer":"/结果","请求_cursor_arg":"off设置","cursor_from_item_pointer":"/更新_id","cursor_转换":"increment","检查point_strategy":{"type":"item_key","item_key_pointer":"/更新_id"}}' --sink file:/tmp/telegram-更新s.ndjson 运行time 验证
The following Telegram polling flow has been 验证d agAInst the real 机器人 API through uxc:
获取:/获取Me 获取:/获取网页hook信息 daemon-backed uxc subscribe --mode poll on post:/获取更新s item-derived off设置 进度ion from 更新_id + 1 dedupe/检查point behavior for repeated polls
Observed 运行time behavior:
data 事件 are emitted for real Telegram 更新s poll 事件 record fetched/emitted/skipped counts 检查point 事件 are emitted after new 更新s are seen repeated polls skip already-consumed 更新s after 检查point advancement Operation Groups Read / Lookup 获取:/获取Me 获取:/获取Chat 获取:/获取ChatMember 获取:/获取网页hook信息 Messaging post:/发送Message post:/发送Photo post:/发送Document post:/发送MediaGroup 更新 Delivery post:/获取更新s post:/设置网页hook post:/删除网页hook 防护rAIls Keep 自动化 on the JSON 输出 envelope; do not use --text. 解析 stable fields first: ok, kind, protocol, data, error. 获取更新s and 网页hook delivery are mutually exclusive: if a 网页hook is 配置d, call post:/删除网页hook before polling with post:/获取更新s if polling is active, do not treat 网页hook operations as background subscription support Telegram allows only one active 获取更新s consumer per 机器人 令牌: if another 机器人 process or script is polling at the same time, Telegram returns HTTP 409 停止 the other consumer before relying on daemon-backed polling subscribe For daemon-backed polling subscribe, prefer item-derived off设置 进度ion: 提取_items_pointer should be /结果 请求_cursor_arg should be off设置 cursor_from_item_pointer should be /更新_id cursor_转换 should be increment 检查point_strategy.type should usually be item_key with item_key_pointer=/更新_id uxc auth binding match should be 检查ed agAInst a concrete Telegram method URL such as https://API.telegram.org/获取Me, because auth is 应用lied through a path-prefix template that expands to /机器人<令牌>/.... 发送Photo, 发送Document, and 发送MediaGroup in this 技能 accept existing file_id