openclaw - ✅(Solved) Fix Telegram video files not being downloaded to media/inbound directory [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#56312Fetched 2026-04-08 01:42:20
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
cross-referenced ×1referenced ×1

Error Message

Log shows message received but no download:

  • `mediaMaxMb` is set to 100 (should handle files up to 100MB)
  • Telegram Bot API supports up to 2000MB upload
  • The video file (tested with 60MB) is not downloaded

PR fix notes

PR #56336: fix(telegram): download animation (GIF/video) files to media/inbound directory

Description (problem / solution / changelog)

What

Add animation to all four spots in the Telegram media download pipeline so GIF-style video messages are downloaded to media/inbound/ like regular videos.

Fixes #56312

Root Cause

video and video_note were handled correctly, but animation (Telegram's type for GIFs and looping videos without sound) was missing from:

  1. hasInboundMedia — animation messages were not detected as having media
  2. resolveInboundMediaFileId — animation file IDs were not resolved for reply handling
  3. resolveMediaFileRef — animation was not included in the download path
  4. resolveTelegramMediaPlaceholder — animation produced no <media:video> placeholder

The user's 60MB video was likely sent as a Telegram animation (looping, no audio) rather than a video — explaining why images worked but videos didn't.

Fix

Added msg.animation in all four functions above, consistent with how video and video_note are handled.

Tests

2 new regression tests in bot.media.downloads-media-file-path-no-file-download.e2e.test.ts:

  • video messages → downloaded + <media:video> placeholder ✅
  • animation messages → downloaded + <media:video> placeholder ✅

All 1100 tests pass.

Changed files

  • extensions/telegram/src/bot-handlers.media.ts (modified, +10/-1)
  • extensions/telegram/src/bot.media.downloads-media-file-path-no-file-download.e2e.test.ts (modified, +99/-0)
  • extensions/telegram/src/bot/delivery.resolve-media.ts (modified, +1/-0)
  • extensions/telegram/src/bot/helpers.ts (modified, +5/-2)
RAW_BUFFERClick to expand / collapse

Bug Description

When a video file is sent via Telegram to the bot, the message is received and logged by OpenClaw, but the actual video file is NOT downloaded to the `media/inbound` directory.

Environment

  • OpenClaw version: 2026.3.24
  • OS: macOS (Darwin 25.4.0)
  • Channel: Telegram
  • Model: minimax/MiniMax-M2.7

Steps to Reproduce

  1. Send a video file (e.g., 60MB) via Telegram to the bot
  2. The message with `media:video` placeholder is received
  3. Check `~/.openclaw/media/inbound/` - no video file is found
  4. The video file is NOT saved anywhere on the system

Expected Behavior

Video files sent via Telegram should be downloaded to `~/.openclaw/media/inbound/` like images and other media files.

Configuration

```json { "channels": { "telegram": { "enabled": true, "dmPolicy": "allowlist", "mediaMaxMb": 100, "allowFrom": ["6954654982"] } } } ```

Logs

Log shows message received but no download:

  • `mediaMaxMb` is set to 100 (should handle files up to 100MB)
  • Telegram Bot API supports up to 2000MB upload
  • The video file (tested with 60MB) is not downloaded

Additional Notes

  • Images work fine (e.g., `file_207---99157ea4-01d4-4df0-a6cf-82112b8ba45b.jpg` was downloaded successfully)
  • Only video files seem to have this issue
  • Network connectivity appears normal (no persistent errors in logs)
  • Gateway was restarted after config changes but issue persists

Priority

Medium - blocks video processing workflow

extent analysis

Fix Plan

The issue seems to be related to the handling of video files in the OpenClaw bot. To fix this, we need to modify the code to properly download video files from Telegram.

Code Changes

We need to update the telegram.js file to handle video files. Here's an example of how you can do it:

// telegram.js
const fs = require('fs');
const path = require('path');

// ...

// Function to download media from Telegram
async function downloadMedia(ctx, media) {
  const fileId = media.file_id;
  const filePath = path.join('~/.openclaw/media/inbound/', fileId);

  // Download the media file from Telegram
  const file = await ctx.telegram.getFile(fileId);
  const filePathUrl = file.file_path;
  const fileUrl = `https://api.telegram.org/file/bot${process.env.TELEGRAM_TOKEN}/${filePathUrl}`;

  // Download the file and save it to the local directory
  const response = await fetch(fileUrl);
  const buffer = await response.buffer();
  fs.writeFileSync(filePath, buffer);

  return filePath;
}

// ...

// Update the message handler to download video files
bot.on('message', async (ctx) => {
  if (ctx.message.video) {
    const video = ctx.message.video;
    const filePath = await downloadMedia(ctx, video);
    console.log(`Video file downloaded to: ${filePath}`);
  }
});

Configuration Changes

No configuration changes are needed. The mediaMaxMb setting is already set to 100, which should handle files up to 100MB.

Verification

To verify that the fix worked, send a video file via Telegram to the bot and check if the file is downloaded to the ~/.openclaw/media/inbound/ directory. You should see the video file in the directory, and the bot should log a message indicating that the file was downloaded successfully.

Extra Tips

Make sure to update the telegram.js file with the correct file path and token. Also, ensure that the mediaMaxMb setting is set to a value that can handle the size of the video files you expect to receive.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING