tg-media-resolve
Resolve Telegram \x3Cmedia:image>, \x3Cmedia:document>, \x3Cmedia:video> and other media placeholders into actual files.
Setup & Installation
Install command
clawhub install kurinzo/tg-media-resolveIf the CLI is not installed:
Install command
npx clawhub@latest install kurinzo/tg-media-resolveOr install with OpenClaw CLI:
Install command
openclaw skills install kurinzo/tg-media-resolveor paste the repo link into your assistant's chat
Install command
https://github.com/openclaw/skills/tree/main/skills/kurinzo/tg-media-resolveWhat This Skill Does
Resolves Telegram media placeholders like `\x3Cmedia:image>` or `\x3Cmedia:video>` into actual downloaded files. When a Telegram message contains a media reference the agent cannot directly see, this skill uses the Bot API to forward, download, and clean up the file. Returns a local file path ready for vision analysis or further processing.
Directly bridges the gap between opaque media placeholders in Telegram message context and usable local files, without requiring manual download steps.
When to Use It
- Analyzing an image shared in a Telegram group chat
- Reading a document sent as a reply in a bot conversation
- Inspecting a video or GIF from a forwarded Telegram message
- Running OCR on a photo referenced in group history
- Processing voice messages or stickers from Telegram chats
View original SKILL.md file
# Telegram Media Resolver Resolves `<media:*>` placeholders from Telegram messages into downloadable files. ## When to use When you see `<media:image>`, `<media:document>`, `<media:video>`, `<media:sticker>`, `<media:voice>`, or `<media:animation>` in a Telegram message (especially in reply-quoted context or group history) and need to actually see/analyze the content. ## How it works 1. Temporarily forwards the target message via Bot API to get file metadata 2. Downloads the file from Telegram servers 3. Deletes the forwarded copy (cleanup) 4. Returns local file path for use with `image` tool or `exec` ## Usage ```bash python3 scripts/fetch_media.py \ --bot-token "$BOT_TOKEN" \ --chat-id CHAT_ID \ --message-id MESSAGE_ID \ [--out /tmp] \ [--forward-to SELF_CHAT_ID] ``` ### Parameters - `--bot-token` — Telegram Bot API token (read from OpenClaw config: `channels.telegram.botToken`) - `--chat-id` — Chat where the message lives (from message context, e.g. `-1001234567890`) - `--message-id` — ID of the message containing media (from `[id:XXXXX]` in message context) - `--out` — Output directory (default: `/tmp`) - `--forward-to` — Chat ID for temporary forward (default: same as `--chat-id`). Use bot owner's DM chat ID to avoid visible forwards in groups. ### Extracting parameters from message context OpenClaw formats Telegram messages like: ``` [Telegram GroupName id:CHAT_ID topic:N ...] User (USER_ID): <media:image> [id:MSG_ID chat:CHAT_ID] ``` Extract `CHAT_ID` and `MSG_ID` from this format. ## Workflow 1. Extract `chat_id` and `message_id` from the message context 2. Read bot token: `cat ~/.openclaw/openclaw.json | python3 -c "import sys,json; print(json.load(sys.stdin)['channels']['telegram']['botToken'])"` 3. Run fetch script 4. Use returned file path with `image` tool for vision analysis ## Supported media types Photos, documents, videos, animations (GIFs), stickers, voice messages, video notes, audio files. ## Limitations - Bot must be a member of the chat containing the target message - Files over 20MB cannot be downloaded via Bot API - The temporary forward may briefly appear in the forward-to chat before deletion - Use `--forward-to` with a private chat (e.g. bot owner's DM) to avoid visible forwards in group chats
Example Workflow
Here's how your AI assistant might use this skill in practice.
User asks: Analyzing an image shared in a Telegram group chat
- 1Analyzing an image shared in a Telegram group chat
- 2Reading a document sent as a reply in a bot conversation
- 3Inspecting a video or GIF from a forwarded Telegram message
- 4Running OCR on a photo referenced in group history
- 5Processing voice messages or stickers from Telegram chats
Resolve Telegram \x3Cmedia:image>, \x3Cmedia:document>, \x3Cmedia:video> and other media placeholders into actual files.
Security Audits
These signals reflect official OpenClaw status values. A Suspicious status means the skill should be used with extra caution.