360 Secure SkillHub
360 安全技能中心

Telegram .md File Uploader

该 Skill 提供一个 Python 脚本,读取本地 .md 文件,校验扩展名后以 multipart/form-data 调用 Telegram Bot API 的 sendDocument 方法,把文件发送到环境变量指定的 Telegram 聊天。使用前需设置机器人令牌与聊天 ID,并运行脚本传入 .md 文件路径。

courtneejay
courtneejay
热度 50.56
最近更新 2026-05-11 17:32:57
分类:协作依赖:代码执行 / 读写文件 / 第三方 API应用场景:自动化脚本 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add telegram-md-uploader
Metadata
name
telegram-md-uploader
description
Uploads and sends .md files from your OpenClaw workspace to a specific Telegram chat using the Telegram Bot API. Use when you need to share workspace files (e.g., drafts, code, content) with a Telegram recipient.

Telegram MD Uploader

This skill enables you to send markdown files directly from your workspace to a Telegram chat.

Prerequisites

  1. Telegram Bot Token: You need a bot token from @BotFather.
  2. Chat ID: You need the Chat ID for the recipient (the bot must be a member of the chat).

Setup & Usage

1. Configure Environment Variables

To keep your credentials secure, set your tokens in your shell environment (e.g., add to .bashrc or .zshrc):

export TELEGRAM_BOT_TOKEN='your_token_here'
export TELEGRAM_CHAT_ID='your_chat_id_here'

2. Usage

Run the script directly from your terminal:

python3 scripts/upload.py <file_path.md>

How It Works

This skill utilizes the Telegram Bot API sendDocument method. It takes the file path, validates that it is a .md file, wraps it in a POST request with multipart/form-data, and sends it to your specified chat.

Troubleshooting

  • Error: TELEGRAM_BOT_TOKEN... must be set: Verify your environment variables are exported.
  • Error: File not found: Double-check the file path.
  • Error: Not a valid .md file: Ensure the file ends with the .md extension.