Skip to content
Back to skills

Tg Media Resolve

ASecurity

Resolve Telegram <media:image>, <media:document>, <media:video> and other media placeholders into actual files for vision/analysis. Use when a Telegram message contains a media placeholder (e.g. <media:image>) that you cannot see — typically in quoted/replied-to messages or group chat history. Downloads the media via Telegram Bot API and returns a local file path for the image tool or further processing.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
content-marketingpythonbashapi

Works with

  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned November 11, 2026

npx -y skills add johnalbertini14-glitch/openclaw-skills --skill tg-media-resolve --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tg Media Resolve?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Tg Media Resolve
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/johnalbertini14-glitch-tg-media-resolve/badge)](https://www.skillsdirectory.com/skills/johnalbertini14-glitch-tg-media-resolve)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: tg-media-resolve
description: Resolve Telegram <media:image>, <media:document>, <media:video> and other media placeholders into actual files for vision/analysis. Use when a Telegram message contains a media placeholder (e.g. <media:image>) that you cannot see — typically in quoted/replied-to messages or group chat history. Downloads the media via Telegram Bot API and returns a local file path for the image tool or further processing.
---

# 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

Files in this skill

  • SKILL.md2.7 KB
  • _meta.json292 B
  • scripts/fetch_media.py4.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in content-marketing →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.