tg-file-sender for Openclaw

An AI coding agent skill designed to securely transmit local workspace files and media directly to Telegram chats via the Telegram Bot API.

bustes01
v1.0.0
May 19, 2026
1
796
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install tg-file-sender

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install tg-file-sender using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is tg-file-sender?

The tg-file-sender skill provides a streamlined and highly secure mechanism for AI assistants to deliver local files straight to a user's Telegram chat. Built to handle explicit prompts such as "send this file to me" or "send to telegram", it automates workspace path resolution, file type optimization, and strict multi-layered security checks to ensure data integrity during transmission.

By leveraging this plugin within the Openclaw Skills ecosystem, developers can eliminate manual file downloads or external transfers. The skill intelligently selects the optimal Telegram Bot API delivery method based on file format while enforcing rigid privacy guardrails, ensuring that sensitive access credentials and out-of-scope workspace paths remain completely safe.

tg-file-sender Use Cases

  • Transferring generated reports, code files, or build artifacts from a local workspace directly to a mobile device.
  • Quickly sharing images, videos, or audio assets produced by automated workflows through Telegram media methods.
  • Safeguarding automated file deliveries by validating boundaries and enforcing strict size restrictions before calling external networks.

How tg-file-sender Works

  1. Resolve File Path: The skill receives a workspace path requested by the user, converts it to an absolute path using realpath, and ensures it falls within the authorized root workspace.
  2. Validate Security Constraints: It verifies the file exists, ensures it is not a symlink to prevent directory traversal, and enforces a hard 50 MB size limit dictated by the Telegram Bot API.
  3. Detect File Type: The skill parses the file extension to select the appropriate endpoint method (sendPhoto, sendVideo, sendAudio, or sendDocument).
  4. Transmit via Bot API: An authorized POST request is made securely using curl, routing the localized file stream and an optional caption payload using the token retrieved from environment configurations.
  5. Handle Response: The skill parses the Telegram JSON response, reporting success back to the user interface or exposing the exact error description string if delivery fails.

tg-file-sender Setup

Prerequisites

Before activating this skill within Openclaw Skills, ensure that curl is installed on your host system and that your targeted chat session has initialized a thread with your bot.

Configuration

Export your secret Telegram Bot token into your environment variables. The skill reads this dynamically and will never log or hardcode the value:

export TG_BOT_TOKEN="your_telegram_bot_token_here"

tg-file-sender Data Schema & Taxonomy

The skill manages its analytical flow externally through environment parameters and enforces standard multi-media classification schemas.

File Extension Mapping

Extension Telegram Method Caption Support
.jpg, .jpeg, .png, .gif, .webp sendPhoto Yes
.mp4, .mov, .avi, .webm sendVideo Yes
.mp3, .ogg, .wav, .flac sendAudio Yes
Others (.xlsx, .pdf, .md, .zip, etc.) sendDocument Yes

Behavioral Rule Matrix

Condition Trigger User Response / Action
TG_BOT_TOKEN Unset "请先设置 TG_BOT_TOKEN 环境变量"
File Missing "文件不存在,请检查路径"
Target Outside Workspace "路径不在工作目录范围内,已拒绝"
File Size Exceeds 50 MB "文件超过 50MB,Telegram 不支持发送"

tg-file-sender Advanced Features

  • Directory Traversal Defense: Automatically intercepts and rejects symlinks or relative paths escaping the workspace root via realpath validation.
  • Smart Size Alerts: Prompts confirmation warnings for files larger than 10 MB to improve transparency before initiating network uploads.
  • Automated Ephemeral Cleanup: Detects files dispatched from temporary systems (/tmp/) and completely purges them from disk post-transmission.
  • Contextual Chat ID Inheritance: Safely extracts the required chat identifier from the active session context instead of prompting user queries.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*